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++  ;

---------
Hello,

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.

Thanks!

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 https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_base_list2_d.html#ab92ca1997b2f1e2b879c1e3f18cd01ed

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

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