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

    Inserting shader into Shaderlink [SOLVED]

    SDK Help
    0
    3
    416
    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 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!

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

        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/cpp/2023_2/class_base_list2_d.html#ab92ca1997b2f1e2b879c1e3f18cd01ed

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

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

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

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