Skip to content

CURVE type#12581

Open
jtydhr88 wants to merge 1 commit intomasterfrom
curve
Open

CURVE type#12581
jtydhr88 wants to merge 1 commit intomasterfrom
curve

Conversation

@jtydhr88
Copy link
Contributor

@jtydhr88 jtydhr88 commented Feb 22, 2026

add curve type, FE change(curve editor) is Comfy-Org/ComfyUI_frontend#8860
curve is a list[list[float, float]] — sorted by x, both x and y in [0, 1].

from comfy_api.latest import io                           
                                                                                                                                                                                           class MyCurveNode(io.ComfyNode):                                                                                                                                                       
      @classmethod
      def define_schema(cls):                                                                                                                                                            
          return io.Schema(
              node_id="MyCurveNode",
              display_name="My Curve Node",
              category="utils",
              inputs=[
                  io.Curve.Input("curve"),
              ],
              outputs=[io.Float.Output("value")],
          )

      @classmethod                                                                                                                                                                       
      def execute(cls, curve) -> io.NodeOutput:                                                                                                                                          
          # curve is [[0, 0], [0.3, 0.5], [1, 1]]                                                                                                                                        
          # sorted by x, values in [0, 1]                                                                                                                                                
          return io.NodeOutput(some_value)

UI would be

2026-02-22.15-14-23.mp4

Curve Editor would be used in Color Curve Node
image

@coderabbitai
Copy link

coderabbitai bot commented Feb 22, 2026

📝 Walkthrough

Walkthrough

This pull request adds a new Curve type to the ComfyTypeIO system. The Curve type is defined as a list-based type with a new Input subclass that provides a default value of [[0, 0], [1, 1]] when no default is explicitly provided. The implementation maintains compatibility with existing as_dict behavior. The new Curve type is registered for export and added to the public API exports list, making it available for use throughout the codebase.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'CURVE type' is concise and directly describes the main change: introduction of a new CURVE type to the ComfyUI API.
Description check ✅ Passed The pull request description clearly explains the new Curve type, its structure, usage example, and associated frontend changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
comfy_api/latest/_io.py (1)

1242-1242: Type = list is unnecessarily broad — consider list[list[float]].

Every other concrete widget type carries a precise type hint (bool, int, str, torch.Tensor, etc.). list gives callers zero guidance. The PR description says the value is a list of [x, y] float pairs, so list[list[float]] accurately captures that.

(list[float, float] is not valid Python generic syntax; for a fixed-length pair, tuple[float, float] would be canonical, but since the wire format uses JSON arrays, list[float] per element is the correct choice here.)

✏️ Proposed fix
-    Type = list
+    Type = list[list[float]]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@comfy_api/latest/_io.py` at line 1242, The Type alias currently set as "Type
= list" is too vague; update the definition of the symbol "Type" to a nested
list of floats (e.g. list[list[float]]) so callers know this widget carries an
array of [x,y] float pairs; if the codebase targets older Python add the
appropriate typing import (List) and use List[List[float]] instead of the bare
built-in generics.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@comfy_api/latest/_io.py`:
- Line 1242: The Type alias currently set as "Type = list" is too vague; update
the definition of the symbol "Type" to a nested list of floats (e.g.
list[list[float]]) so callers know this widget carries an array of [x,y] float
pairs; if the codebase targets older Python add the appropriate typing import
(List) and use List[List[float]] instead of the bare built-in generics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants