Jump to content

Material Rename Script


Randy liddil
 Share

Recommended Posts

i have about 50 different buildings that i'm importing thats in sketchup from another client and all of the textures that were embedded in sketchup are just called "texture01,texture02, etc" for every single building...so when i bring them into max there are tons of duplicate texture names for the buildings. Even if I can somehow just name the textures as they relate to each building like "texture01 warehouse" so all of the textures on the warehouse building are at least named unique to that building. Hope this makes sense.

Link to comment
Share on other sites

Ok, third time i've clicked Reply to Thread instead of post quick reply. /sad.

 

Anyway, this should rename the materials for all selected objects to be the format "Object Name+MaterialName"

 

--Script: prefix object names to material names for all selected objects.
(
sel = selection as array
for obj in sel do
(
try(
if obj.material != undefined then
	(
		obj.material.name = (obj.name+" " +obj.material.name)
	)
)--end try
catch(print "something failed on: " + obj.name + "maybe it doesn't have a material?!" )
)--end for loop
)--end script

Link to comment
Share on other sites

Ok, third time i've clicked Reply to Thread instead of post quick reply. /sad.

 

Anyway, this should rename the materials for all selected objects to be the format "Object Name+MaterialName"

 

--Script: prefix object names to material names for all selected objects.
(
sel = selection as array
for obj in sel do
(
try(
if obj.material != undefined then
	(
		obj.material.name = (obj.name+" " +obj.material.name)
	)
)--end try
catch(print "something failed on: " + obj.name + "maybe it doesn't have a material?!" )
)--end for loop
)--end script

 

Very nice of you to try and help out by creating a script for them.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...