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
    • Recent
    • Tags
    • Users
    • Login

    add shader in user data [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 462 Views
    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 Offline
      Helper
      last edited by

      On 29/04/2015 at 16:00, xxxxxxxx wrote:

      hi

      i try to add a new gradient shader to a shader field in my user data

      insertShader don`t work with the user data field

      shader = c4d.BaseList2D(c4d.Xgradient)
                          	gradient = shader[c4d.SLA_GRADIENT_GRADIENT]
                          	gradient.InsertKnot(Value,1,0)
                          	shader[c4d.SLA_GRADIENT_GRADIENT] = gradient
                          	node[id].InsertShader(shader)
        
      
      

      i

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

        On 30/04/2015 at 07:37, xxxxxxxx wrote:

        Hello,

        InsertShader() does not assign a shader to a specific parameter. This function is used to add a shader to a host object so it can be part of the document. So you have to assign the created shader to your userdata parameter in addition to using InsertShader(). You find an example on how to do this in the  documentation of the function.

        Best wishes,
        Sebastian

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

          On 30/04/2015 at 12:51, xxxxxxxx wrote:

          this don`t work

          it clear the actually Shader from the user data but don`t add the new one

          shader = c4d.BaseList2D(c4d.Xgradient)
                              	gradient = shader[c4d.SLA_GRADIENT_GRADIENT]
                              	gradient.InsertKnot(Value,1,0)
                              	shader[c4d.SLA_GRADIENT_GRADIENT] = gradient
                              	node[id] = shader
                              	node[id].InsertShader(shader)
          
          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 30/04/2015 at 12:56, xxxxxxxx wrote:

            shader = c4d.BaseList2D(c4d.Xgradient)
            node[id] = shader
            node.InsertShader(shader)
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 30/04/2015 at 14:07, xxxxxxxx wrote:

              thanks Niklas

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