Rename texture name

The scene have many textures, but the texture name is not correct. I want to rename the textures, and the link of texture should be keep!

I'm sorry for my bad english,I wish you can understand it.

Can someone help me? So thanks!


Comment viewing options

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

okay , what he wants is...

actually what i want too...

the script to rename all bitmaps renamed to "scene name"+ extension.
pine_tree.max has some mesh and two textures.

he wants a script to do some actions so the result will become:


and materials target the new bitmap they wont report as missing.

Anubis's picture

rename w/o relink, right?

I re-read 2-3 times the original question: "I want to rename the textures, and the link of texture should be keep!" and looks like all replies below are about Relinking texture #FileNames.
--Here is 2 staffs:

assignNewName <TextureMap>

And as you say "the texture name is not correct", then give more details about.

my recent MAXScripts RSS (archive here)

crystal3d's picture

good subject, you want to turn an untidy scene into a tidy scene

like evermotion's scenes...
dont have a solution for you however...

br0t's picture

mhm maybe tryout "Set Bitmap

mhm maybe tryout "Set Bitmap Parameters" here:
It has an option to do a Search&Replace on bitmap filenames

Never get low & slow & out of ideas

SmallGhost's picture

I have try it,but the file

I have try it,but the file name is not change, how to set it?

br0t's picture

Dont really know if this is

Dont really know if this is what you want but maybe it helps:

--Script to rename paths of bitmap textures in a scene.
try(destroyDialog ro_bmRename)catch()
rollout ro_bmRename "Single edit Bitmap filepaths or do a search & replace on all (case insensitive)" width:906 height:495
	local arrBMs = #()
	local arrPaths = #()
	combobox cbx_bm "Bitmap Filepaths" pos:[6,5] width:890 height:31
	button btn_get "Get Bitmaps in Scene" pos:[5,449] width:124 height:40
	checkbutton ckb_edit "Enable Edit" pos:[134,449] width:140 height:40
	edittext edt_s "Search for:" pos:[323,450] width:439 height:16 enabled:false
	edittext edt_r "Replace with: " pos:[323,472] width:439 height:16 enabled:false
	button btn_rep "Do for All" pos:[769,449] width:132 height:40 enabled:false
	button btn_swap "Swap" pos:[279,449] width:40 height:40
	fn update_list=
		arrBMs = #()
		arrPaths = #()
		arrBMs = getClassInstances bitmapTexture
		for i=1 to arrBMs.count do
			append arrPaths arrBMs[i].filename
		cbx_bm.items = arrPaths
	)--end fn
	on cbx_bm entered txt do
		if ckb_edit.checked do
			arrBMs[cbx_bm.selection].filename = txt
		)--end if
	)--end on
	on btn_get pressed do
	)--end on
	on ckb_edit changed state do
		if state then
			edt_s.enabled = true
			edt_r.enabled = true
			btn_rep.enabled = true
		)--end if
			edt_s.enabled = false
			edt_r.enabled = false
			btn_rep.enabled = false
		)--end else
	on btn_swap pressed do
		temp = edt_s.text
		edt_s.text = edt_r.text
		edt_r.text = temp
	)--end on
	on btn_rep pressed do
		local searchFor = edt_s.text
		local replaceWith = edt_r.text
		if searchFor != "" AND replaceWith != "" then
			--loop through object names:
			for i=1 to arrBMs.count do
				local startIndex = findString arrBMs[i].fileName searchFor -- returns the starting index of the found string
				if startindex != undefined do
					-- replace the string at "startIndex" with length of "searchFor.count" with "replaceWith" 
					arrBMs[i].fileName = (replace arrBMs[i].fileName startIndex searchFor.count replaceWith)
				)--end if
			)--end for
		)--end if
		else displayTempPrompt ">>>>>> Fill in what to search for and what to replace with! <<<<<<<" 5000
	)--end on
createDialog ro_bmRename

To see bitmap names, press the "Get.." Button. To edit them, enabled the checkbox. You can then select single bitmap filepaths in the list and change them on top. The changes will be accepted when you leave the edit field with your mouse.
You can also do a search and replace on all paths, e.t. to change "C:\" to "D:\"
or "silly.jpg" to "dummy.tif"
This is case insensitive, which might not be so good.
Be careful with it, better save to a new scene first before you accidently kill any paths.

Never get low & slow & out of ideas

aj2jjworld's picture

Nice Script

Hey, i use this script. and it really work for me. script change all jpg name according to me. but in max only. but its fine and i change name with advance rename. ALL OVER VERY GOOD SCRIPT. Save lots of time.


SmallGhost's picture

So thanks for your help!

I test it...

Yes,the bitmap name is changed,but the bitmap lost the link. The bitmap which is saved in disk is not changed name with it.

theMaps = getClassInstances BitmapTexture
for i in 1 to theMaps.count do
fileName = theMaps[i].filename
newFilename = getFilenamePath fileName + "\\map_" + i as string + getFilenameType fileName
if renameFile fileName newFilename then theMaps[i].filename = newFilename

this is someone help to change the bitmap name,but it can't change others except the diffuse channel....

Thank you for your help!

SmallGhost's picture

Thanks br0t! I will try it.

Thanks br0t!

I will try it.

Comment viewing options

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