Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    ShaderData with inner shaders

    SDK Help
    0
    4
    420
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 19/06/2017 at 08:12, xxxxxxxx wrote:

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

      ---------
      Hello.

      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.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 20/06/2017 at 05:42, xxxxxxxx wrote:

        Hi,

        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.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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 ?
          Thank you.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 21/06/2017 at 02:16, xxxxxxxx wrote:

            Yes, you probably should. It forwards MSG_GETALLASSETS to sub-shaders.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post