Working with Splines

MCG offers several ways to create and manipulate splines. The Splines category contains many nodes and compounds that you can use in your graphs.

Note: It is better to work with the newer Spline data type, instead of the older ShapeObject data type.

Getting Data from Splines in the Scene

Use SplineFromNode in your graph to allow a tool's users to specify a spline object in the scene. It's a good practice to use CanGetSplineFromNode with an If node to check the specified scene object, and take an appropriate action if no valid spline has been specified.

After that, you can use other nodes in the Splines category, such as SplineVerticesBuffer or SplineTangentsBuffer, to get data from the spline and then perform operations on the resulting arrays.

Creating Spline Data

There are two basic nodes for creating splines:
  • CreateSplineFromKnots creates a linear spline from an array of positions.
  • CreateSplineFromBuffers has additional options for tangents and segment types.

Many of the compounds in the Splines category provide examples of using these nodes to create splines from scratch, or based on data in the scene.

Creating Spline Shapes

There are a couple of ways to create spline shapes in a scene.

Modifying Splines

You cannot create modifiers that can be applied to a spline shape. However, you can use SplineToMesh to store spline data as a mesh, to which modifiers can be applied. You can either leave the data as a mesh for further modification, or convert it back using MeshToSpline and create a spline shape in the scene.