Inserting shader into Shaderlink [SOLVED]

On 09/08/2017 at 02:53, xxxxxxxx wrote:

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


In my object generator plugin, I have a shaderlink as a description parameter.
I would like to click on a button that inserts a shader into that shaderlink.

In the button Message, I tried using the following:

AutoAlloc<BaseShader> shader1(Xcolor);
BaseContainer* bc = op->GetDataInstance();
bc->SetLink(MY_SHADER_LINK_ID, shader1);						

Obviously it does not work. 
I know how to set a shader in a material, but I would like to be able to set in an independent shaderlink.


On 09/08/2017 at 06:11, xxxxxxxx wrote:

The shader have to belong to a BaseList2d so you have to insert it using YourObject.InsertShader
For more information take a look at

On 09/08/2017 at 06:37, xxxxxxxx wrote:

Thank you for your answer gr4ph0s. I was missing MyObject->InsertShader. 
It works now.