Modify Spline Gui



  • 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?


  • Global Moderator

    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


  • Global Moderator

    Hello @HolgerBiebrach ,

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

    best wishes,
    Sebastian