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

    Flip spline in RSScalarRamp / Invert Gradient in RSRamp not possible in Node Material?

    Cinema 4D SDK
    python 2024 2023
    2
    3
    472
    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.
    • D
      danielsian
      last edited by

      Hi there,
      In a ShaderGraph material I'm able to flip the spline in a Scalar Ramp node as well as invert the gradient in a Ramp node by using:

      Flip()
      
      InvertKnots()
      

      Do we have similar methods for the Maxon API?
      Do I need to invert the knots and points one by one manually?
      If so I'd appreciate any examples.

      Thanks a lot

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @danielsian
        last edited by

        Hey @danielsian,

        Thank you for reaching out to us. I am not the biggest Nodes API expert. @m_adam is our Nodes API expert in the SDK group but he is currently on FMX.

        The counterpart to c4d.GradientData is maxon.GradientInterface. For SplineData the counter part would be maxon::SplineMapperInterface but that has never been wrapped for Python.

        But material nodes, e.g., RS Ramp or RS Scalar Ramp, decompose gradients and splines into their values. When I poke around in the Node Editor I cannot get hold of the spline/gradient instance for such node. The parent port of the "Ramp" port bundle does not have a data type. And the "Points" port then realizes the points as a variadic port.

        9b83d0ce-4f3d-4357-a97d-4dee4fea2060-image.png
        ac9b0f19-bf94-406a-b0d3-a2eed3e2de97-image.png

        So, what I would do, is get values all child ports of the points port and then write them back in reverse order.

        As always, tangible code would be better than abstract questions, as I would then not have to guess what you are doing exactly.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • D
          danielsian
          last edited by

          Thanks @ferdinand, you answered my question brilliantly, as you always do.
          Cheers

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