Cloning a shader [SOLVED]
-
On 04/03/2015 at 02:00, xxxxxxxx wrote:
I have a material from which I want to copy a shader to a tag with a texture field.
So I get the material, get the shader, clone it and copy it to the tag texture field.This does not work
cloneShd = mat1[c4d.MATERIAL_COLOR_SHADER] shd = cloneShd.GetClone()
When I do not use a clone it works!
shd = mat1[c4d.MATERIAL_COLOR_SHADER]
What am I doing wrong here?
-Pim
-
On 04/03/2015 at 02:13, xxxxxxxx wrote:
Have you inserted the clone into the tag using BaseList2D.InsertShader()?
-
On 04/03/2015 at 06:14, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Have you inserted the clone into the tag using BaseList2D.InsertShader()?
No, I use it in a VRay tag to set the texture.
tag[c4d.VRAYLIGHTTAG_AREA_RECT_TEX] = shd
Without the clone it works fine. Using a clone, the texture does not seem to be filled.
-Pim
-
On 04/03/2015 at 06:34, xxxxxxxx wrote:
You have to insert it, else it won't have any connection to the document.
shd = mat1[c4d.MATERIAL_COLOR_SHADER].GetClone() tag.InsertShader(shd) tag[c4d.VRAYLIGHTTAG_AREA_RECT_TEX] = shd
-
On 04/03/2015 at 08:27, xxxxxxxx wrote:
Strange things are happening with this post.
On my mobile I received a message that a post was added by Yannick saying:
"This is a limitation of the python api.
For such situations the c++ api provides the "AliasTrans" class but the python api does not implement this classand c4datom.getclone() misses the AliasTrans parameter."Did I quote you correctly Yannick?
-Pim
-
On 04/03/2015 at 08:36, xxxxxxxx wrote:
Originally posted by xxxxxxxx
You have to insert it, else it won't have any connection to the document.
shd = mat1[c4d.MATERIAL_COLOR_SHADER].GetClone() tag.InsertShader(shd) tag[c4d.VRAYLIGHTTAG_AREA_RECT_TEX] = shd
Great, it is working now.
I guess when I use the original it is already inserted (somewhere?) and the clone is still to be inserted.-Pim
-
On 04/03/2015 at 08:44, xxxxxxxx wrote:
Exactly the shader you create a clone of has already been inserted into the material.