PDA

View Full Version : jpg renaming


reedha
01-17-2008, 05:44 PM
I hope someone can help me... i have a dire need for a renaming script in max8...

we have a library of 3d city models that we license to many clients, and we need to customize them for each client.

Example:

i have a max scene that has a large number of textures that reference a large number of jpgs in a certain folder ...

is it possible to create a script that will rename all jpgs in this folder, change all of the material names in the material editor to reflect the name changes, and retain the bitmap path to all of the new jpgs? we have different clients that need custom naming structures for the same models we license out. it is too much work to manually rename the jpgs in a folder and then go into max and re-assign them in the material editor, and that is what i have been spending way too much time doing. I have looked high and low for a script like this, and we do not have anyone in house to handle this.


also, when i deliver a max file to a client, they see the actual working path of my textures, like:

C:\Documents and Settings\\Desktop\cambridge Mass\Cambridge\Textures\Buildings\building101.jpg



is there a way to collapse the bitmap file path to simply:

Textures\Buildings\building101.jpg
?



your help is much appreciated!!!

--
Reed Ingersoll

Planet 9 Studios
525 Brannan St. #407
San Francisco, CA 94107
(415) 348-1200
www.planet9.com (http://www.planet9.com/)

RustyKnight
01-17-2008, 09:58 PM
I hope someone can help me... i have a dire need for a renaming script in max8...

we have a library of 3d city models that we license to many clients, and we need to customize them for each client.

Example:

i have a max scene that has a large number of textures that reference a large number of jpgs in a certain folder ...

is it possible to create a script that will rename all jpgs in this folder, change all of the material names in the material editor to reflect the name changes, and retain the bitmap path to all of the new jpgs? we have different clients that need custom naming structures for the same models we license out. it is too much work to manually rename the jpgs in a folder and then go into max and re-assign them in the material editor, and that is what i have been spending way too much time doing. I have looked high and low for a script like this, and we do not have anyone in house to handle this.
Yes, all this is possible and it can be done a number of different ways...

also, when i deliver a max file to a client, they see the actual working path of my textures, like:

C:\Documents and Settings\\Desktop\cambridge Mass\Cambridge\Textures\Buildings\building101.jpg


is there a way to collapse the bitmap file path to simply:

Textures\Buildings\building101.jpg
? I think this would relie on the search path for max, so the short answer is no, but it is worth looking into

Shane

JHN
01-18-2008, 07:58 AM
RustyKnight: Paths in max can be made relative. Look up "PathConfig Struct" in the manual. These commands are also available in the asset tracking tool.

For the images as RustyKnight says, there are many ways. I think some sort of tool with an interface is best suited... but it depends on many things...

-Johan

RustyKnight
01-18-2008, 08:36 AM
RustyKnight: Paths in max can be made relative. Look up "PathConfig Struct" in the manual. These commands are also available in the asset tracking tool.This is good to know, shame it's only avaliable in max9+

Shane

JHN
01-18-2008, 08:50 AM
Ah didn't know your not using max9+, I'll put it in my postscript...

MoonDoggie
01-18-2008, 02:45 PM
Some things to get you started

get (almost) all the bitmaps in the scene by using GetClassInstances()


thebitmaps = getClassInstances BitmapTexture


Iterate through them to change their names and paths

local num = 1
for b in thebitmaps where (doesFileExist b.filename) do (
-- File exists
b.name = "Test" + (num as string)
b.filename = "Textures\\Buildings\\" + (filenameFromPath b.filename)
num+=1
)



If you want to change material names, you'll have to iterate through sceneMaterials.

-Colin

RustyKnight
01-19-2008, 12:13 AM
Ah didn't know your not using max9+, I'll put it in my postscript...Actually, using max8 through 2008...talk about confusing :P

Hay moondoggie! That's an interesting approach, wouldn't enumerateFiles do the same thing or is this to much information??

Shane

MoonDoggie
01-19-2008, 12:49 AM
Shane,
EnumerateFiles does the same thing, albeit I wasn't sure reedha knew about defining functions etc. I hesistate to use it because it always does strange things for me when I do, it always calls the function I define twice, and I'm not quite sure why. However, getClassInstances BitmapTexture does a good job of getting all bitmaps in the scene (though no method is able to get them all from what I've gathered).

Check out my Relink Bitmap script on scriptspot here
http://www.scriptspot.com/3ds-max/relink-bitmaps

It uses a combination of both in custom functions to find bitmaps,
for the quick method it uses GetClassInstances(), for "Interactive Mode" it uses enumerateFiles, which allows the user to see which objects the missing map is assigned to.

Any insight you have would be very appreciated, I always look forward to seeing your posts and learning.

-Colin

RustyKnight
01-19-2008, 04:21 AM
Shane,
EnumerateFiles does the same thing, albeit I wasn't sure reedha knew about defining functions etc. I hesistate to use it because it always does strange things for me when I do, it always calls the function I define twice, and I'm not quite sure why. However, getClassInstances BitmapTexture does a good job of getting all bitmaps in the scene (though no method is able to get them all from what I've gathered).

Check out my Relink Bitmap script on scriptspot here
http://www.scriptspot.com/3ds-max/relink-bitmaps

It uses a combination of both in custom functions to find bitmaps,
for the quick method it uses GetClassInstances(), for "Interactive Mode" it uses enumerateFiles, which allows the user to see which objects the missing map is assigned to.

Any insight you have would be very appreciated, I always look forward to seeing your posts and learning.

-ColinThis good to know! I've not used either of these methods, but they seem quite useful to keep in mind.

Cheers
Shane

CGTalk Moderation
01-19-2008, 04:21 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.