feat: add CurveInput wrapper class with interp method#12986
Merged
jtydhr88 merged 1 commit intocurve-nodefrom Mar 16, 2026
Merged
feat: add CurveInput wrapper class with interp method#12986jtydhr88 merged 1 commit intocurve-nodefrom
jtydhr88 merged 1 commit intocurve-nodefrom
Conversation
CurveInput is an abstract base class so future curve representations (bezier, LUT-based, analytical functions) can be added without breaking downstream nodes that type-check against CurveInput. MonotoneCubicCurve is the concrete implementation that: - Mirrors frontend createMonotoneInterpolator (curveUtils.ts) exactly - Pre-computes slopes as numpy arrays at construction time - Provides vectorised interp_array() using numpy for batch evaluation - interp() for single-value evaluation - to_lut() for generating lookup tables CurveEditor node wraps raw widget points in MonotoneCubicCurve.
ca54e4c to
1c40a58
Compare
Contributor
|
I merged this and will add one more type of curve - linear, then make changes on FE |
jtydhr88
pushed a commit
that referenced
this pull request
Mar 18, 2026
CurveInput is an abstract base class so future curve representations (bezier, LUT-based, analytical functions) can be added without breaking downstream nodes that type-check against CurveInput. MonotoneCubicCurve is the concrete implementation that: - Mirrors frontend createMonotoneInterpolator (curveUtils.ts) exactly - Pre-computes slopes as numpy arrays at construction time - Provides vectorised interp_array() using numpy for batch evaluation - interp() for single-value evaluation - to_lut() for generating lookup tables CurveEditor node wraps raw widget points in MonotoneCubicCurve.
jtydhr88
pushed a commit
that referenced
this pull request
Mar 21, 2026
CurveInput is an abstract base class so future curve representations (bezier, LUT-based, analytical functions) can be added without breaking downstream nodes that type-check against CurveInput. MonotoneCubicCurve is the concrete implementation that: - Mirrors frontend createMonotoneInterpolator (curveUtils.ts) exactly - Pre-computes slopes as numpy arrays at construction time - Provides vectorised interp_array() using numpy for batch evaluation - interp() for single-value evaluation - to_lut() for generating lookup tables CurveEditor node wraps raw widget points in MonotoneCubicCurve.
jtydhr88
added a commit
that referenced
this pull request
Mar 24, 2026
* CURVE node * remove curve to sigmas node * feat: add CurveInput ABC with MonotoneCubicCurve implementation (#12986) CurveInput is an abstract base class so future curve representations (bezier, LUT-based, analytical functions) can be added without breaking downstream nodes that type-check against CurveInput. MonotoneCubicCurve is the concrete implementation that: - Mirrors frontend createMonotoneInterpolator (curveUtils.ts) exactly - Pre-computes slopes as numpy arrays at construction time - Provides vectorised interp_array() using numpy for batch evaluation - interp() for single-value evaluation - to_lut() for generating lookup tables CurveEditor node wraps raw widget points in MonotoneCubicCurve. * linear curve * refactor: move CurveEditor to comfy_extras/nodes_curve.py with V3 schema * feat: add HISTOGRAM type and histogram support to CurveEditor * code improve --------- Co-authored-by: Christian Byrne <cbyrne@comfy.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Demo PR targeting
curve-nodebranch to show what the wrapper class + interpolation function should look like.Changes
CurveInputclass (comfy_api/latest/_input/basic_types.py):list[tuple[float, float]]control pointsinterp(x): Monotone cubic Hermite interpolation matching the frontendcreateMonotoneInterpolatorincurveUtils.tsto_lut(size): Generate a lookup table of evenly-spaced samplesType wiring:
Curve.Type = CurveInput(underTYPE_CHECKING)comfy_api.inputandcomfy_api.latest._inputCurveEditor node:
CurveInputbefore outputtingCurveInputinstancesUsage by downstream nodes
cc @jtydhr88 — this demonstrates the wrapper class and interp function we discussed. Feel free to merge into your branch or adapt as needed.