c4d.SplineData

Spline data type (CUSTOMDATATYPE_SPLINE) for the SplineCustomGui GUI

This type is called by value.

Inheritance

Members

SplineData.__init__(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()

Selects all points.

SplineData.Flip()

Flips the spline.

SplineData.Mirror()

Mirrors the spline.

SplineData.SetRound(r)

Set the tension.

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

Gets the tension.

Return type:float
Returns:Tension.

Warning

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

SplineData.Maximum()

Makes all Y coordinates less than or equal to 1.

SplineData.Minimum()

Makes all Y coordinates greater than or equal to 0.

SplineData.SetZero(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(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()

Deletes all points.

SplineData.MakePointBuffer(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(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(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(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(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(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(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(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(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(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(a)

Deletes a knot.

Parameters:a (int) – The knot index to delete.
Return type:bool
Returns:True if successful, otherwise False.
SplineData.InsertKnot(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()

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(index, vPos, lFlagsSettings, bSelect=False, vTangentLeft=c4d.Vector(), vTangentRight=c4d.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(r)

Gets a point from its X coordinate.

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

Returns the count of knots which are selected.

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

Gets the knot count.

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

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()

Sort the knots.

Return type:int
Returns:The new index of the active knot.
SplineData.SetRange(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(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(pDest)

New in version R14.014.

Copies this spline data values into the destination spline data.

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