MCPcopy Create free account
hub / github.com/Lightricks/ComfyUI-LTXVideo / LTXVSparseTrackEditor

Class LTXVSparseTrackEditor

sparse_tracks.py:65–139  ·  view source on GitHub ↗

Interactive spline editor for drawing sparse motion tracks. Provides a canvas widget where users can draw and edit spline control points on top of a reference image. Outputs interpolated track coordinates compatible with LTXVDrawTracks.

Source from the content-addressed store, hash-verified

63
64@comfy_node(name="LTXVSparseTrackEditor", description="LTX Sparse Track Editor")
65class LTXVSparseTrackEditor(io.ComfyNode):
66 """Interactive spline editor for drawing sparse motion tracks.
67
68 Provides a canvas widget where users can draw and edit spline control
69 points on top of a reference image. Outputs interpolated track
70 coordinates compatible with LTXVDrawTracks.
71 """
72
73 @classmethod
74 def define_schema(cls):
75 return io.Schema(
76 node_id="LTXVSparseTrackEditor",
77 category="Lightricks/motion_tracking",
78 description=(
79 "Interactive spline editor for drawing sparse motion tracks "
80 "on a reference image."
81 ),
82 inputs=[
83 io.Image.Input(
84 "image",
85 tooltip="Reference image displayed as the editor canvas background.",
86 ),
87 io.String.Input(
88 "points_store",
89 default="[]",
90 tooltip="JSON array of spline control points managed by the editor widget.",
91 ),
92 io.String.Input(
93 "coordinates",
94 default="[]",
95 tooltip="JSON array of interpolated track coordinates produced by the editor.",
96 ),
97 io.Int.Input(
98 "points_to_sample",
99 default=121,
100 min=2,
101 max=10000,
102 tooltip="Number of points sampled along each spline curve.",
103 ),
104 ],
105 outputs=[
106 io.String.Output("tracks"),
107 ],
108 is_output_node=True,
109 )
110
111 @classmethod
112 def execute(
113 cls,
114 image,
115 points_store: str,
116 coordinates: str,
117 points_to_sample: int,
118 ) -> io.NodeOutput:
119 # Re-interpolate from control points so that changes to
120 # points_to_sample are always respected, regardless of JS sync.
121 try:
122 splines = json.loads(points_store) if points_store else []

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected