SetParameter doesn't work on node

On 29/08/2017 at 03:27, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R18 
Platform:   Windows  ;   
Language(s) :     C++  ;


I have a ShaderData plugin in which user can click a button to add dynamically shaderlink parameters to it:

BaseContainer texture_cont = GetCustomDataTypeDefault(DTYPE_BASELISTLINK);
texture_cont.SetString(DESC_NAME, "Texture");
texture_cont.SetBool(DESC_SHADERLINKFLAG, TRUE);
description->SetParameter(texture, texture_cont, group );

This one works fine.

I have another button that allows to add Xnoise shader parameters.
I create an Xnoise shader and I insert the shader in the document doc->InsertShader(xnoise_shader);
I do that in the button's MSG_DESCRIPTION_COMMAND on Message call.

The problem is that I don't see the shader. 
It appears that I cannot set the link to a dynamically added shaderlink parameter (I have tested the same code in a static shaderlink parameter defined in a description res and it works fine).

Thank you for your time.

On 30/08/2017 at 01:50, xxxxxxxx wrote:


could you please post the complete code you use to insert and link the shader?

In your message above you mention that you insert the shader into the document. This is not how you handle shaders. A new shader instance is typically inserted into the host material (or in your case the host shader). You find examples on how to create and insert shaders in the BaseShader Manual.

best wishes,

On 30/08/2017 at 23:54, xxxxxxxx wrote:

Adding the shader in the parent shader solves the problem.
Thank you for your help.