Rename Bitmaps for exporting

Hi
Is there any script out there that allows me to rename the bitmaps used in my scene and update the name in 3ds max materials?
I have for example bitmaps used in scene:

Wood_cgtextures_01_VeryCOOL Lighting_Effect.jpg
Just Another Wood material Name With Spaces in its name.tga
etc.

And i want to rename these bitmaps (both in 3ds max and "windows" so they "match") to a name i would like (of my choise)+ automaticly append numbers, so for example

TEX001.jpg
TEX002.tga

I need this for proper exporting to some formats (like 3ds for example).

I didnt find any script that does this, i like Neil Blevins Name manager from soulburn scripts, but it doesnt handle renaming the bitmaps (just maps, materials etc. not really bitmaps)

Does such a "simple" but needed script exist please?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

Send me or post here a small test file (archived) and tell me which names you want to use for renaming.

bga

barigazy's picture

...

This is a simple example how to rename and update bitmap.
Supports only bitmap textures.
If you want more complex solution search on this forum recursive function which
will help you to collect all maps with filemane. Anyway...

fn renameBmpFile source target =
(
	local sioFile = dotNetClass "System.IO.File"
	local sysStr = dotNetClass "System.String"
 
	if not (sioFile.Exists source) then messageBox "Bitmap File not exist!" title:"Warning" beep:off else
	(
		if  sioFile.Exists target then messageBox "You already used this name!" title:"Warning" beep:off else
		(
			local bitmaps = getClassInstances Bitmaptex 
			if bitmaps.count == 0 then messageBox "No Bitmaps In The Scene" title:"Warning" beep:off else
			(
				local bmpArr = for b in bitmaps where isKindOf b.filename String and (sysStr.Compare source b.filename true) == 0 collect b
				if bmpArr.count == 0 then messageBox "This Bitmap Is Not Assigned!" title:"Warning" beep:off else
				(
					sioFile.Move source target
					for b in bmpArr do setProperty b #filename target
					free bmpArr
				)
				free bitmaps
			)
		)
	)
)
-- example
sceneMapString = @"c:\Users\Maps\Bark map.jpg"
newFileName = @"c:\Users\Maps\Wood_Bark.tiff"
renameBmpFile sceneMapString newFileName

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.