Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    1. Maxon Developers Forum
    2. Vladislav Borovikov
    V
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    Vladislav Borovikov

    @Vladislav Borovikov

    0
    Reputation
    1
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Vladislav Borovikov Unfollow Follow

    Latest posts made by Vladislav Borovikov

    • RE: Python - How to insert knots in c4d.Gradient

      Thank you very much, @i_mazlov! This is what I needed!

      posted in Cinema 4D SDK
      V
      Vladislav Borovikov
    • Python - How to insert knots in c4d.Gradient

      Hello everyone!
      I'm trying to add knots to the c4d.Gradient object, in GvNode. But the changes are not applied to the parameter, maybe I missed something, and this parameter needs to be updated?

      import c4d
      import redshift
      
      knots = [
          (c4d.Vector(1,0,1), 0.25, 0.25, 0.25),
          (c4d.Vector(0,1,1), 0.5, 0.5, 0.5),
          (c4d.Vector(1,1,0), 0.75, 0.75, 0.75),
          
      ]
      
      def main() -> None:
          rs_material = doc.GetActiveMaterial()
          if not rs_material.GetTypeName() == "RS Shader Graph":
              print(rs_material.GetTypeName())
              return
          
          # Get node master and root
          nm = redshift.GetRSMaterialNodeMaster(rs_material)
          root = nm.GetRoot()
          
          # Create RSRamp gvNode
          ramp_node = nm.CreateNode(root, 1036227)
          ramp_node[c4d.GV_REDSHIFT_SHADER_META_CLASSNAME] = 'RSRamp'
          
          # Get Gradient
          gradient = ramp_node[c4d.REDSHIFT_SHADER_RSRAMP_RAMP]
          gradient.FlushKnots()
          for i, knot in enumerate(knots):
              gradient.InsertKnot(knot[0], knot[1], knot[2], knot[3], i )
          
          #  Check values
          for i in range(gradient.GetKnotCount()):
              knot = gradient.GetKnot(i)
              col = knot.get("col")
              pos = knot.get("pos")
              br = knot.get('brightness')
              print(f"col = {col}, pos = {pos}, brightness = {br} ")
      
      main()
      
      posted in Cinema 4D SDK python
      V
      Vladislav Borovikov