On 19/06/2017 at 08:12, xxxxxxxx wrote:
Cinema 4D Version: R18
Platform: Windows ;
Language(s) : C++ ;
Once you set a shader as colorizer, it uses the already existing shader (e.g. xbitmap) and sets it to SLA_COLORIZER_TEXTURE parameter.
I have a ShaderData with an inner shaderlink parameter and I need to do the same. Once the user creates the my shader, I need to user already existing shader in the parameter and set it to my ShaderData's shaderlink parameter.
How can I do that ?
Thank you for your time.
On 20/06/2017 at 05:42, xxxxxxxx wrote:
you touched a badly documented topic here...
The easiest is to use HandleInitialChannel() in your shader's Message() function. For node, type and data you just forward the parameters of Message() and ID is the parameter ID of the shader slot in your shader (see code snippet for HandleShaderMessage() on the same page).
Now, this function got deprecated in R16, so I can't make any promises...
On the other hand the function contains no magic, it just reacts to MSG_INITIALCHANNEL, the data received is the pointer to the previous shader (the one you want to use a child). It then inserts the previous shader under the new one and sets the link of the shader slot. So you could definitely do it manually yourself.
On 21/06/2017 at 01:20, xxxxxxxx wrote:
Hello Andreas and thank you for your answer.
Using HandleInitialChannel works fine ! Do I also have to call HandleShaderMessage ?
On 21/06/2017 at 02:16, xxxxxxxx wrote:
Yes, you probably should. It forwards MSG_GETALLASSETS to sub-shaders.