c4d.SplineData

class c4d.SplineData

Spline data type (CUSTOMDATATYPE_SPLINE) for the SplineCustomGui GUI

This type is called by value.

Methods Signatures

SplineData.__init__(self, v) Creates a default 2 points spline.
SplineData.SelectAll(self) Selects all points.
SplineData.Flip(self) Flips the spline.
SplineData.Mirror(self) Mirrors the spline.
SplineData.SetRound(self, r) Set the tension.
SplineData.GetRound(self)

Deprecated since version Since: R13

This method is only available in R12 and always returns 0.0 in R13.

SplineData.Maximum(self) Makes all Y coordinates less than or equal to 1.
SplineData.Minimum(self) Makes all Y coordinates greater than or equal to 0.
SplineData.SetZero(self, bY, bAll) Sets the tangents of selected knots to zero.
SplineData.InitDefaultFlag(self, flag) Sets the knot flag for selected knots.
SplineData.DeleteAllPoints(self) Deletes all points.
SplineData.MakePointBuffer(self[, lPoints]) Makes an uninitialized spline with lPoints number of points.
SplineData.MakeLinearSplineLinear(self[, lPoints]) Makes a linear spline with lPoints number of points.
SplineData.MakeLinearSplineBezier(self[, lPoints]) Makes a linear bezier spline with lPoints number of points.
SplineData.MakeSquareSpline(self[, lPoints]) Makes a square spline with lPoints number of points.
SplineData.MakeCubicSpline(self[, lPoints]) Makes a cubic spline with lPoints number of points.
SplineData.MakeRootSpline(self[, lPoints]) Makes a root spline with lPoints number of points.
SplineData.MakeInversSpline(self[, lPoints]) Makes an inverse spline with lPoints number of points.
SplineData.MakeSinSpline(self[, lPoints]) Makes a sinus spline with lPoints number of points.
SplineData.MakeAbsCosSpline(self[, lPoints]) Makes an absolute cosinus spline with lPoints number of points.
SplineData.MakeUserSpline(self, str, lPoints) Makes a user spline from str with lPoints number of points.
SplineData.DeleteKnot(self, a) Deletes a knot.
SplineData.InsertKnot(self, x, y[, flags]) Inserts a knot.
SplineData.GetKnots(self) Returns all knots.
SplineData.SetKnot(self, index, vPos, ...) Sets knot properties.
SplineData.GetPoint(self, r) Gets a point from its X coordinate.
SplineData.GetSelectedCount(self) Returns the count of knots which are selected.
SplineData.GetKnotCount(self) Gets the knot count.
SplineData.GetRange(self) Gets the range of the spline.
SplineData.SortKnots(self) Sort the knots.
SplineData.SetRange(self, xmin, xmax, ...) Set the range of the spline.
SplineData.AdaptRange(self, xmin, xmax, ...) Adapts the internal 0-1 range of the old spline GUI to the range set by xmin, xmax, ymin and ymax.
SplineData.CopyTo(self, pDest) Copies this spline data values into the destination spline data.

Inheritance

Inheritance

Parent Class:

Methods Documentation

SplineData.__init__(self, v)

Creates a default 2 points spline.

Parameters:v (c4d.SplineData) – Source spline data for copy constructor.
Return type:c4d.SplineData
Returns:The spline data instance.
SplineData.SelectAll(self)

Selects all points.

SplineData.Flip(self)

Flips the spline.

SplineData.Mirror(self)

Mirrors the spline.

SplineData.SetRound(self, r)

Set the tension.

Parameters:r (float) – The tension
SplineData.GetRound(self)

Deprecated since version Since: R13

This method is only available in R12 and always returns 0.0 in R13.

Gets the tension.

Return type:float
Returns:Tension.
SplineData.Maximum(self)

Makes all Y coordinates less than or equal to 1.

SplineData.Minimum(self)

Makes all Y coordinates greater than or equal to 0.

SplineData.SetZero(self, bY, bAll)

Sets the tangents of selected knots to zero.

Parameters:
  • bY (bool) – True to set the tangets’ Y coordinate to zero, False to set the X coordinate.
  • bAll (bool) – True to set all tangents, False to set the tangents of selected knots only.
Return type:

bool

Returns:

True if successful, otherwise False.

SplineData.InitDefaultFlag(self, flag)

Sets the knot flag for selected knots.

Parameters:flag (int) –

A combination of these flags:

FLAG_KNOT_T_BREAK Break knot tangents.
FLAG_KNOT_LOCK_X Lock knot’s X movement.
FLAG_KNOT_LOCK_Y Lock knot’s Y movement.
FLAG_KNOT_T_LOCK_A Lock knot’s tangent angle.
FLAG_KNOT_T_LOCK_L Lock knot’s tangent length.
FLAG_KNOT_T_KEEPVISUALANGLE Keep visual angle between knot’s tangents.
ADD_KNOT_ADAPT_TANGENTS Tangents of new knots are set in such a way that the resulting spline will match the curvature of the original spline.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.DeleteAllPoints(self)

Deletes all points.

SplineData.MakePointBuffer(self, lPoints=-1)

Makes an uninitialized spline with lPoints number of points.

Parameters:lPoints (int) – Number of points, or -1 to get the default value.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.MakeLinearSplineLinear(self, lPoints=-1)

Makes a linear spline with lPoints number of points.

Parameters:lPoints (int) – Number of points, or -1 to get the default value.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.MakeLinearSplineBezier(self, lPoints=-1)

Makes a linear bezier spline with lPoints number of points.

Parameters:lPoints (int) – Number of points, or -1 to get the default value.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.MakeSquareSpline(self, lPoints=-1)

Makes a square spline with lPoints number of points.

Parameters:lPoints (int) – Number of points, or -1 to get the default value.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.MakeCubicSpline(self, lPoints=-1)

Makes a cubic spline with lPoints number of points.

Parameters:lPoints (int) – Number of points, or -1 to get the default value.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.MakeRootSpline(self, lPoints=-1)

Makes a root spline with lPoints number of points.

Parameters:lPoints (int) – Number of points, or -1 to get the default value.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.MakeInversSpline(self, lPoints=-1)

Makes an inverse spline with lPoints number of points.

Parameters:lPoints (int) – Number of points, or -1 to get the default value.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.MakeSinSpline(self, lPoints=-1)

Makes a sinus spline with lPoints number of points.

Parameters:lPoints (int) – Number of points, or -1 to get the default value.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.MakeAbsCosSpline(self, lPoints=-1)

Makes an absolute cosinus spline with lPoints number of points.

Parameters:lPoints (int) – Number of points, or -1 to get the default value.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.MakeUserSpline(self, str, lPoints)

Makes a user spline from str with lPoints number of points.

Parameters:
  • str (str) – User spline string. Any valid formula can be used.
  • lPoints (int) – Number of points, or -1 to get the default value.
Return type:

bool

Returns:

True if successful, otherwise False.

SplineData.DeleteKnot(self, a)

Deletes a knot.

Parameters:a (int) – The knot index to delete.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.InsertKnot(self, x, y, flags=0)

Inserts a knot.

Parameters:
  • x (float) – X coordinate
  • y (float) – Y coordinate
  • flags (int) –

    Flags:

    FLAG_KNOT_T_BREAK Break knot tangents.
    FLAG_KNOT_LOCK_X Lock knot’s X movement.
    FLAG_KNOT_LOCK_Y Lock knot’s Y movement.
    FLAG_KNOT_T_LOCK_A Lock knot’s tangent angle.
    FLAG_KNOT_T_LOCK_L Lock knot’s tangent length.
    FLAG_KNOT_T_KEEPVISUALANGLE Keep visual angle between knot’s tangents.
    ADD_KNOT_ADAPT_TANGENTS Tangents of new knots are set in such a way that the resulting spline will match the curvature of the original spline.
Return type:

int

Returns:

Knot index.

SplineData.GetKnots(self)

Returns all knots.

Return type:list of dict{vPos: Vector, lFlagsSettings: int, bSelect: bool, vTangentLeft: Vector, vTangentRight: Vector, interpol: int}
Returns:A list of dictionaries with information about the knot.
SplineData.SetKnot(self, index, vPos, lFlagsSettings, bSelect=False, vTangentLeft=Vector(), vTangentRight=Vector(), interpol=CustomSplineKnotInterpolationBezier)

Sets knot properties.

Parameters:
  • index (int) – The knot index.
  • vPos (c4d.Vector) – Knot position.
  • lFlagsSettings (int) –

    Contains knot flags:

    FLAG_KNOT_T_BREAK Break knot tangents.
    FLAG_KNOT_LOCK_X Lock knot’s X movement.
    FLAG_KNOT_LOCK_Y Lock knot’s Y movement.
    FLAG_KNOT_T_LOCK_A Lock knot’s tangent angle.
    FLAG_KNOT_T_LOCK_L Lock knot’s tangent length.
    FLAG_KNOT_T_KEEPVISUALANGLE Keep visual angle between knot’s tangents.
    ADD_KNOT_ADAPT_TANGENTS Tangents of new knots are set in such a way that the resulting spline will match the curvature of the original spline.

    Note

    Also contains the point index ID. The ID can be accessed using these functions:

    def SplineKnotGetID(flags):
        return ((flags >> 16) & 0x0000ffff)
    
    def SplineKnotSetID(flags, flag_id):
        flags = (flags & 65535) | ((flag_id & 0x0000ffff) << 16)
    

    Important

    This means that the flags must only be accessed using ‘|=’ and ‘&=’ (a good advice for any set of flags, for maximum forward compatibility).

  • bSelect (bool) – Internal select state. Do not change this.
  • vTangentLeft (c4d.Vector) – The left tangent.
  • vTangentRight (c4d.Vector) – The right tangent.
  • interpol (int) –

    Spline knot’s interpolation:

    CustomSplineKnotInterpolationBezier Bezier interpolation.
    CustomSplineKnotInterpolationLinear Linear interpolation.
    CustomSplineKnotInterpolationCubic Cubic interpolation.
Raises:

RangeError – If the knot index is out of range : 0<=index<GetKnotCount().

SplineData.GetPoint(self, r)

Gets a point from its X coordinate.

Parameters:r (float) – The x position
Return type:c4d.Vector
Returns:The position
SplineData.GetSelectedCount(self)

Returns the count of knots which are selected.

Return type:int
Returns:The count
SplineData.GetKnotCount(self)

Gets the knot count.

Return type:int
Returns:Knot count.
SplineData.GetRange(self)

Gets the range of the spline.

def PrintRange(sd):
    sdrange = sd.GetRange()
    if not range: return

    print sdrange["xmin"], sdrange["xmax"], sdrange["xstep"], sdrange["ymin"], sdrange["ymax"], sdrange["ystep"]
Return type:dict{xmin: float, xmax: float, xstep: float, ymin: float, ymax: float, ystep: float}
Returns:The range dictionary or None.
SplineData.SortKnots(self)

Sort the knots.

Return type:int
Returns:The new index of the active knot.
SplineData.SetRange(self, xmin, xmax, xsteps, ymin, ymax, ysteps)

Set the range of the spline.

Parameters:
  • xmin (float) – The X min range.
  • xmax (float) – The X max range.
  • xsteps (float) – The X steps.
  • ymin (float) – The Y min range.
  • ymax (float) – The Y max range.
  • ysteps (float) – The Y steps.
SplineData.AdaptRange(self, xmin, xmax, xsteps, ymin, ymax, ysteps)

Adapts the internal 0-1 range of the old spline GUI to the range set by xmin, xmax, ymin and ymax.

Parameters:
  • xmin (float) – The new X minimum.
  • xmax (float) – The new X maximum.
  • xsteps (float) – The new X step size.
  • ymin (float) – The new Y minimum.
  • ymax (float) – The new Y maximum.
  • ysteps (float) – The new Y step size.
SplineData.CopyTo(self, pDest)

Copies this spline data values into the destination spline data.

New in version R14.014.

Parameters:pDest (c4d.SplineData) – The destination spline data.
Return type:bool
Returns:True if successful, otherwise False