|02 February 2004||#1|
Join Date: Jan 2003
Applying materials on object by corresponging names
Hello, I would like to do something like this using Maxscript.
If the name of material has "shpere_blue_mat"
then apply the material to all the objects that have
"shpere_blue" in the names.
I am new to this script and am wondering how I could start writing a script to accomplish this.
I may be able to start like this, but I am not sure how I can write a code that expresses "if part of material's name is equal to part of selected objects" part.
I am also thinking that I have to write a loop code that goes
through all the materials' names and objects name, then compare
each material name to each object's name.
Sorry about my vague question, but I appreciate any help that could get me somewhere.
|02 February 2004||#2|
Join Date: Oct 2003
Loop through all Materials, and loop again through all your Objects. The Compare the names and if they match, assign the Material.
A simple aproach would go like this:
It compares the full name of the Material and the Objects. So your Material and Objects need to share the same name.
Another Method is actually compare single parts of the string values.
This will search for the name of the Object in the given (given = i) Material name.
It works ok. But be carefull with numbers.
If you have names like "green" and "green2" it will not work properly, because the searchstring function will find both strings in the checked Material (for example "green2_mat" both "green" and "green2" will be detected)
|01 January 2006||#3|
Join Date: Sep 2003
Thread automatically closed
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
|Thread Closed share thread|