add shader in user data [SOLVED]

On 29/04/2015 at 16:00, xxxxxxxx wrote:

hi

i try to add a new gradient shader to a shader field in my user data

insertShader don`t work with the user data field

shader = c4d.BaseList2D(c4d.Xgradient)
                    	gradient = shader[c4d.SLA_GRADIENT_GRADIENT]
                    	gradient.InsertKnot(Value,1,0)
                    	shader[c4d.SLA_GRADIENT_GRADIENT] = gradient
                    	node[id].InsertShader(shader)
  

i

On 30/04/2015 at 07:37, xxxxxxxx wrote:

Hello,

InsertShader() does not assign a shader to a specific parameter. This function is used to add a shader to a host object so it can be part of the document. So you have to assign the created shader to your userdata parameter in addition to using InsertShader(). You find an example on how to do this in the  documentation of the function.

Best wishes,
Sebastian

On 30/04/2015 at 12:51, xxxxxxxx wrote:

this don`t work

it clear the actually Shader from the user data but don`t add the new one

shader = c4d.BaseList2D(c4d.Xgradient)
                    	gradient = shader[c4d.SLA_GRADIENT_GRADIENT]
                    	gradient.InsertKnot(Value,1,0)
                    	shader[c4d.SLA_GRADIENT_GRADIENT] = gradient
                    	node[id] = shader
                    	node[id].InsertShader(shader)

On 30/04/2015 at 12:56, xxxxxxxx wrote:

shader = c4d.BaseList2D(c4d.Xgradient)
node[id] = shader
node.InsertShader(shader)

On 30/04/2015 at 14:07, xxxxxxxx wrote:

thanks Niklas