Direct controlpoint sample method to spline editor

This commit is contained in:
kijai 2024-07-31 12:18:18 +03:00
parent 7191a1fbbb
commit ad60519856
2 changed files with 12 additions and 1 deletions

View File

@ -113,6 +113,7 @@ class SplineEditor:
[
'path',
'time',
'controlpoints'
],
{
"default": 'time'

View File

@ -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 = () => {