Cant figure out how to copy material
Posted: Tue May 12, 2015 9:37 pm
Hi.
Need a little help to get me going.
I want to write some code that from an imported mesh creates material nodes for some known materials in the mesh.
In this case it's models exported from DAZ that I would like to handle.
If someone could supply some code snippets that help me get starteds I would be very greateful.
I want to create one material node for every type of material. I know as an example that legs, feets, hands, arms etc use the same material so for them i would want to create a material Limbs that has the same properties as Legs and then connect the material pin of legs, feets, hands, arms etc to that material instead.
Splitting it up it would be something like this.
1 Create a "mastermateriallist" list with the name of the master materials and the name I want for the created material node. [legs = Limbsmaterial,head = Headmaterial]
2 Create a "linklist" list with info on witch materials should use witch material node. [legs=Limbsmaterials,feets=Limbsmaterials,hands=Limbsmaterial] and so on.
3 Find the known mastermateriallist materials in the mesh by name and create a new material with the name given by the mastermateriallist that is a copy of of the found material in the mesh.
4 Use the linklist and connect all the the material pins in the mesh as given by the linklist to the material also given by the linklist.
Regards
Wallan
Need a little help to get me going.
I want to write some code that from an imported mesh creates material nodes for some known materials in the mesh.
In this case it's models exported from DAZ that I would like to handle.
If someone could supply some code snippets that help me get starteds I would be very greateful.
I want to create one material node for every type of material. I know as an example that legs, feets, hands, arms etc use the same material so for them i would want to create a material Limbs that has the same properties as Legs and then connect the material pin of legs, feets, hands, arms etc to that material instead.
Splitting it up it would be something like this.
1 Create a "mastermateriallist" list with the name of the master materials and the name I want for the created material node. [legs = Limbsmaterial,head = Headmaterial]
2 Create a "linklist" list with info on witch materials should use witch material node. [legs=Limbsmaterials,feets=Limbsmaterials,hands=Limbsmaterial] and so on.
3 Find the known mastermateriallist materials in the mesh by name and create a new material with the name given by the mastermateriallist that is a copy of of the found material in the mesh.
4 Use the linklist and connect all the the material pins in the mesh as given by the linklist to the material also given by the linklist.
Regards
Wallan