Spline Editor(SplineEditor)
From a technical implementation perspective, this node supports multiple sampling methods (such as by path length or time) and interpolation algorithms (like Cardinal, Basis, etc.) to compute smooth transitions between control points.
Spline Editor
⚠️ WORK IN PROGRESS
Do not count on this as part of your workflow yet,
probably contains lots of bugs and stability is not
guaranteed!!
Graphical editor to create values for various schedules and/or mask batches
From a technical implementation perspective, the Spline Editor node supports various sampling methods (such as by path length or time) and interpolation algorithms (like Cardinal, Basis, etc.) to calculate smooth transitions between control points.
The Spline Editor is a node for creating and editing spline curves. It allows users to generate smooth paths or numerical sequences by defining a series of control points. The core function of this node is to convert these points into masks (Mask) usable for image processing or a series of FLOAT values, providing foundational data for subsequent animation or weight control.
Editing Controls
- Shift + click to add a control point at the end.
- Ctrl + click to add a control point (subdivide) between two points.
- Right click on a point to delete it (note: you cannot delete the first/last point).
- Right click on the canvas for a context menu:
- Add new spline – creates a new spline on the same canvas; these paths are currently only output as coordinates.
- Add single point – creates a single point that returns its current position coordinates.
- Delete spline – deletes the currently selected spline (select by clicking on its path or cycle through splines via the "Next spline" option).
- Purely visual options (do not affect output):
- Toggle handles visibility
- Display sample points – shows the points that will be returned.
The points_to_sample value sets the number of samples returned from the drawn spline itself; this is independent of the actual control points, so the interpolation type matters.
sampling_method:
time– samples along the time axis (for schedules)path– samples along the path itself (useful for coordinates)controlpoints– samples only the control points themselvesspeed– samples based on speed along the path
output types:
- mask batch – compatible with nodes that accept masks
- list of floats – compatible with IPAdapter weights, etc.
- pandas series – compatible with Fizz’ nodes Batch Value Schedule
- torch tensor – compatible with unknown nodes
Node Functionality
From a technical implementation perspective, this node supports various sampling methods (such as by path length or time) and interpolation algorithms (like Cardinal, Basis, etc.) to calculate smooth transitions between control points. It receives coordinate point data in STRING format and can generate corresponding grayscale mask images or numerical lists on a user-defined canvas size (mask_width and mask_height). It also supports repeating the output a specified number of times.
Node Parameter Description - Spline Editor
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Description |
|---|---|---|---|
points_store | STRING | Yes | points_store: A STRING used to store and pass control point coordinate data, typically generated by node interface interaction in an internally defined format. |
coordinates | STRING | Yes | coordinates: Directly input the coordinate sequence of control points as a STRING. The format must comply with "x1,y1,x2,y2...". |
bg_image | IMAGE | No | bg_image: Optionally input a background image. The node will generate the mask based on the dimensions of this image, overriding the manually set width and height parameters. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
sampling_method | COMBO | Yes | time | "path", "time", "controlpoints", "speed" | Determines the logic for value generation. Options include time, controlpoints, speed, and path. |
interpolation | COMBO | Yes | cardinal | "cardinal", "monotone", "basis", "linear", "step-before", "step-after", "polar", "polar-reverse", "bezier" | Directly affects the smoothness and shape of the generated curve. Options include cardinal, monotone, basis, linear, step-before, step-after, polar, polar-reverse, and bezier. |
float_output_type | COMBO | Yes | list | "list", "pandas series", "tensor" | Specifies the format of the FLOAT output, such as list, pandas series, or tensor, to adapt to different downstream processing nodes. |
mask_width | INT | Yes | 512 | 8 – 4096 (Step: 8) | mask_width: Sets the width of the output mask image. Range 8 to 4096, step 8. Should match the image width of the usage scenario. |
mask_height | INT | Yes | 512 | 8 – 4096 (Step: 8) | mask_height: Sets the height of the output mask image. Range 8 to 4096, step 8. Should match the image height of the usage scenario. |
points_to_sample | INT | Yes | 16 | 2 – 1000 (Step: 1) | points_to_sample: Sets the number of points to sample from the spline curve. Range 2 to 1000. More points result in a finer description of the curve. |
tension | FLOAT | Yes | 0.5 | 0.0 – 1.0 (Step: 0.01) | tension: Adjusts the tension of the Cardinal interpolation algorithm. Range 0.0 to 1.0, step 0.01. Affects how tightly the curve passes through the control points. |
repeat_output | INT | Yes | 1 | 1 – 4096 (Step: 1) | repeat_output: Controls the number of times the output sequence (e.g., mask list) is repeated. Range 1 to 4096. Used to quickly generate loops or extend sequences. |
min_value | FLOAT | No | 0.0 | -10000.0 – 10000.0 (Step: 0.01) | Optional lower bound for remapping the output float values. |
max_value | FLOAT | No | 1.0 | -10000.0 – 10000.0 (Step: 0.01) | Optional upper bound for remapping the output float values. |
Outputs
| Parameter Name | Data Type | Description |
|---|---|---|
| mask | MASK | mask (Output Parameter): The output grayscale mask image. White areas represent the spline path. |
| coord_str | STRING | coord_str (Output Parameter): The output STRING containing coordinate information for all sampled points. |
| float | FLOAT | float (Output Parameter): The output sequence of FLOAT values representing the values sampled along the spline curve. |
| count | INT | count (Output Parameter): The output INT representing the actual number of sampled points. |
| normalized_str | STRING | normalized_str (Output Parameter): The output STRING containing normalized coordinate information for the sampled points. |
Usage Scenarios
In practical applications, this node is commonly used to construct dynamic masks or control parameter curves. For example, in a video frame processing workflow, a user can draw a motion path. The Spline Editor will generate a mask sequence along that path, which can be used in subsequent nodes to guide the movement trajectory of image content (such as particles or light rays), thereby creating complex animation effects.
Notes
It is important to note that the input coordinate point STRING format must be correct, and the defined canvas dimensions must match the final image dimensions used. Otherwise, the generated mask may be misaligned. Additionally, the number of sampling points should not be set too low to ensure the smoothness of the curve.
Spline Editor Node Source Code Link
The Spline Editor node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.