KJNodes/weightsgenerated

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

bg_image
mask
coord_str
float
count
normalized_str
points_store
STRING
coordinates
STRING
mask_width
512
mask_height
512
points_to_sample
16
sampling_method
time
interpolation
cardinal
tension
0.50
repeat_output
1
float_output_type
list
min_value
0.00
max_value
1.00
KJNodes

⚠️ 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 themselves
  • speed – 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 NameData TypeRequiredDescription
points_storeSTRINGYespoints_store: A STRING used to store and pass control point coordinate data, typically generated by node interface interaction in an internally defined format.
coordinatesSTRINGYescoordinates: Directly input the coordinate sequence of control points as a STRING. The format must comply with "x1,y1,x2,y2...".
bg_imageIMAGENobg_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 NameData TypeRequiredDefault ValueRange/OptionsDescription
sampling_methodCOMBOYestime"path", "time", "controlpoints", "speed"Determines the logic for value generation. Options include time, controlpoints, speed, and path.
interpolationCOMBOYescardinal"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_typeCOMBOYeslist"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_widthINTYes51284096 (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_heightINTYes51284096 (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_sampleINTYes1621000 (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.
tensionFLOATYes0.50.01.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_outputINTYes114096 (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_valueFLOATNo0.0-10000.010000.0 (Step: 0.01)Optional lower bound for remapping the output float values.
max_valueFLOATNo1.0-10000.010000.0 (Step: 0.01)Optional upper bound for remapping the output float values.

Outputs

Parameter NameData TypeDescription
maskMASKmask (Output Parameter): The output grayscale mask image. White areas represent the spline path.
coord_strSTRINGcoord_str (Output Parameter): The output STRING containing coordinate information for all sampled points.
floatFLOATfloat (Output Parameter): The output sequence of FLOAT values representing the values sampled along the spline curve.
countINTcount (Output Parameter): The output INT representing the actual number of sampled points.
normalized_strSTRINGnormalized_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.

The Spline Editor node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…