View Full Version : need help about material!
thorsten hartmann 07-02-2009, 04:50 PM Hi Guys,
i want write a very little script and i think for profis no problem, but for me.:curious:
My situation: I have selected many Object and i want each Object have a new Material ( A&D or Standard). How can i do that. I have a Scene with 30 Object and i need 30 Materials. Or give it a Code somewhere that can do this. Thanks for help!
mfg
hot chip
|
|
cyfer
07-02-2009, 05:30 PM
I don't think this is what you're asking for , as far as i understand your post
see this
--Select your objects first
Object_array = Selection as array
for i = 1 to Object_array.count do
(
the_mat = Arch___Design__mi()
the_mat.name = ("material" +"__"+i as string)
the_mat.diff_color = (random Black White)
Object_array[i].material = the_mat
)
if it's not please explain more
maxplugins
07-02-2009, 05:40 PM
For A&D material on selected objects:
for i in selection do i.material = Arch___Design__mi()
For standard material on selected objects:
for i in selection do i.material = standardMaterial()
For A&D material on all objects:
for obj in geometry do obj.material = Arch___Design__mi()
For standard material on all objects:
for obj in geometry do obj.material = standardMaterial()
That is the easy way to do it, but all of your materials will be called either StandardMaterial or Arch___Design__mi, so you'll have to add a naming routine as well, like this:
for obj in geometry do (obj.material = Arch___Design__mi(); obj.material.name = obj.material.name + "_" + obj.name)
That just adds the name of the object to the end of the material name.
Dave
This tool should do it for you.
http://www.paulneale.com/scripts/autoMaterial/autoMaterial.htm
thorsten hartmann
07-02-2009, 06:52 PM
oh thank you very much Dave & cyfer. :D
edit: and Paul Thank you.
Let me know if it does what you need. Looks like if you add a material from a library or from the mat editor it will not make unique copies of it if you don't have Instance Material turned on. I could correct that for you if you need it to do that.
CGTalk Moderation
07-02-2009, 07:01 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.