PDA

View Full Version : Replace all materal extensino from tga to dds?


Gibbz
11-02-2005, 07:46 AM
Ok looking for a script that will basically go though all materials, and replace the extension from .tga, to .dds Paths are all the same.

Anyone point me in the direction of something like that?

Blue
11-02-2005, 02:38 PM
I wrote this some time ago, it sets all the extensions for images to one type.

(
fileFormatType = "dds"
for i = 1 to sceneMaterials.count do
(
try(
trimmedFile = #()
bitmapname = sceneMaterials[i].diffuseMap.filename
trimmedFile = filterstring bitmapname " \ "
baseFile = trimmedFile[trimmedFile.count]
bitmapFileName = #()
bitmapFileName = filterstring baseFile "."
myVal = bitmapFileName.count - 1
newfilename = ""
for x = 1 to myVal do
(
newfilename = append newfilename bitmapFileName[x]
newfilename = append newfilename "."
)
finalBitmapName = newfilename + fileFormatType
sceneMaterials[i].diffuseMap.filename = finalBitmapName
)catch(
for j = 1 to sceneMaterials[i].numsubs do
(
try(
trimmedFile = #()
bitmapname = sceneMaterials[i][j].diffuseMap.filename
trimmedFile = filterstring bitmapname " \ "
bitmapFileName = #()
bitmapFileName = filterstring baseFile "."
myVal = bitmapFileName.count - 1
newfilename = ""
for x = 1 to myVal do
(
newfilename = append newfilename bitmapFileName[x]
newfilename = append newfilename "."
)
finalBitmapName = newfilename + fileFormatType
sceneMaterials[i].diffuseMap.filename = finalBitmapName
)catch()
)
)
)
)

Blue
11-02-2005, 02:38 PM
The script was designed to work with the diffuse map but should be easy to augment to your needs.

soulburn3d
11-02-2005, 02:51 PM
Check out the Renamer script here:

http://www.neilblevins.com/blurscripts/blurscripts.htm

It also lets you search and replace in scene materials.

- Neil

Gibbz
11-02-2005, 11:30 PM
Hey blue your script didnt seem to work,

now trying the blur scripts

Cheers

Blue
11-03-2005, 01:00 AM
It will only work on materials that are assigned to objects in the scene, guess I should have mentioned that. It also strips the path out so you should have the map dir setup in the paths. Like I said it was written a while ago for a large team where this result was required.

CGTalk Moderation
11-03-2005, 01:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.