Notifications
Clear all

[Closed] jpg renaming

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

8 Replies
1 Reply
(@rustyknight)
Joined: 11 months ago

Posts: 0

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

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

1 Reply
(@rustyknight)
Joined: 11 months ago

Posts: 0

This is good to know, shame it’s only avaliable in max9+

Shane

 JHN

Ah didn’t know your not using max9+, I’ll put it in my postscript…

1 Reply
(@rustyknight)
Joined: 11 months ago

Posts: 0

Actually, using max8 through 2008…talk about confusing

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

Shane

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

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

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

Cheers
Shane