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
    • Register
    • Register
    • Login

    Modify Spline Gui

    Cinema 4D SDK
    python
    2
    3
    1.0k
    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
      HolgerBiebrach
      last edited by HolgerBiebrach

      Hi, is there a way to modify the shape of a Spline in the Spline Gui? For example I want to edit the Curve in the Splinedeformer Shape Parameter. The Log only spits out c4d.SPLINEDEFORMEROBJECT_SPLINECONTROL
      How can I modify the cooridates of the spline points?

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by

        Hello,

        the parameter c4d.SPLINEDEFORMEROBJECT_SPLINECONTROL contains a c4d.SplineData object. You can edit this object to edit the spline.

        Please notice that the Spline Deformer adapts the spline range based on the "Radius" parameter.

        With that in mind you can easily access and edit the points defining that spline:

        # get spline data
        splineData = op[c4d.SPLINEDEFORMEROBJECT_SPLINECONTROL]
        
        # print information on the data
        print(splineData)
        
        # radius is max. value
        radius = op[c4d.SPLINEDEFORMEROBJECT_RADIUS]
        
        # delete all points
        splineData.DeleteAllPoints()
        splineData.SetRange(0.0, radius, 0.1, 0.0, 1.0, 0.1)
        
        # insert knots
        splineData.InsertKnot(0.0, 0.0)
        splineData.InsertKnot(radius, 1.0)
        
        # modify knots
        splineData.SetKnot(0,c4d.Vector(0.0,0.0,0), 0, False, c4d.Vector(0,0,0), c4d.Vector(1,1,0),c4d.CustomSplineKnotInterpolationBezier)
        splineData.SetKnot(1,c4d.Vector(radius,1.0,0), 0, False, c4d.Vector(-1,-1,0), c4d.Vector(0,0,0),c4d.CustomSplineKnotInterpolationBezier)
        
        # store back to deformer object
        op.SetParameter(c4d.SPLINEDEFORMEROBJECT_SPLINECONTROL, splineData, c4d.DESCFLAGS_SET_0)
        
        c4d.EventAdd()
        

        best wishes,
        Sebastian

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 2
        • S
          s_bach
          last edited by

          Hello @HolgerBiebrach ,

          I'm wondering if your question has been answered. If so, please mark this thread as solved.

          best wishes,
          Sebastian

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

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