From ad6051985635ba23458331f8bb5f60368347fa36 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Wed, 31 Jul 2024 12:18:18 +0300 Subject: [PATCH] Direct controlpoint sample method to spline editor --- nodes/curve_nodes.py | 1 + web/js/spline_editor.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/nodes/curve_nodes.py b/nodes/curve_nodes.py index 89d2655..e0cb613 100644 --- a/nodes/curve_nodes.py +++ b/nodes/curve_nodes.py @@ -113,6 +113,7 @@ class SplineEditor: [ 'path', 'time', + 'controlpoints' ], { "default": 'time' diff --git a/web/js/spline_editor.js b/web/js/spline_editor.js index ac39cf6..ebed27f 100644 --- a/web/js/spline_editor.js +++ b/web/js/spline_editor.js @@ -303,7 +303,12 @@ function createSplineEditor(context, reset=false) { createContextMenu(); function updatePath() { - let coords = samplePoints(pathElements[0], points_to_sample, samplingMethod, w); + if (samplingMethod != "controlpoints") { + var coords = samplePoints(pathElements[0], points_to_sample, samplingMethod, w); + } + else { + var coords = points + } if (drawSamplePoints) { if (pointsLayer) { @@ -362,6 +367,7 @@ function createSplineEditor(context, reset=false) { dotShape = "triangle" } + interpolationWidget.callback = () => { interpolation = interpolationWidget.value updatePath(); @@ -371,6 +377,10 @@ function createSplineEditor(context, reset=false) { if (samplingMethod == "path") { dotShape = "triangle" } + else if (samplingMethod == "controlpoints") { + dotShape = "circle" + drawSamplePoints = true; + } updatePath(); } tensionWidget.callback = () => {