Enhance path editing controls by adding handlers for curve mode and sampled resolution.
This commit is contained in:
@@ -229,15 +229,19 @@ import {
|
|||||||
type SceneLoadingScreenSettings
|
type SceneLoadingScreenSettings
|
||||||
} from "../document/scene-document";
|
} from "../document/scene-document";
|
||||||
import {
|
import {
|
||||||
|
MAX_SCENE_PATH_SAMPLED_RESOLUTION,
|
||||||
MIN_SCENE_PATH_POINT_COUNT,
|
MIN_SCENE_PATH_POINT_COUNT,
|
||||||
|
MIN_SCENE_PATH_SAMPLED_RESOLUTION,
|
||||||
areScenePathsEqual,
|
areScenePathsEqual,
|
||||||
createAppendedScenePathPoint,
|
createAppendedScenePathPoint,
|
||||||
createScenePath,
|
createScenePath,
|
||||||
getScenePathLabel,
|
getScenePathLabel,
|
||||||
getScenePathPointIndex,
|
getScenePathPointIndex,
|
||||||
getScenePaths,
|
getScenePaths,
|
||||||
|
normalizeScenePathSampledResolution,
|
||||||
normalizeScenePathName,
|
normalizeScenePathName,
|
||||||
type ScenePath,
|
type ScenePath,
|
||||||
|
type ScenePathCurveMode,
|
||||||
type ScenePathPoint
|
type ScenePathPoint
|
||||||
} from "../document/paths";
|
} from "../document/paths";
|
||||||
import {
|
import {
|
||||||
@@ -9599,6 +9603,8 @@ export function App({
|
|||||||
visible: selectedPath.visible,
|
visible: selectedPath.visible,
|
||||||
enabled: selectedPath.enabled,
|
enabled: selectedPath.enabled,
|
||||||
loop: selectedPath.loop,
|
loop: selectedPath.loop,
|
||||||
|
curveMode: selectedPath.curveMode,
|
||||||
|
sampledResolution: selectedPath.sampledResolution,
|
||||||
points: selectedPath.points.map((point, index) => ({
|
points: selectedPath.points.map((point, index) => ({
|
||||||
id: point.id,
|
id: point.id,
|
||||||
position: readVec3Draft(
|
position: readVec3Draft(
|
||||||
@@ -9636,6 +9642,40 @@ export function App({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handlePathCurveModeChange = (curveMode: ScenePathCurveMode) => {
|
||||||
|
if (selectedPath === null) {
|
||||||
|
setStatusMessage("Select a path before changing its curve mode.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextPath = createScenePath({
|
||||||
|
...selectedPath,
|
||||||
|
curveMode
|
||||||
|
});
|
||||||
|
|
||||||
|
commitPathChange(
|
||||||
|
selectedPath,
|
||||||
|
nextPath,
|
||||||
|
curveMode === "catmullRom"
|
||||||
|
? "Set Path curve mode to Spline."
|
||||||
|
: "Set Path curve mode to Linear."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePathSampledResolutionChange = (sampledResolution: number) => {
|
||||||
|
if (selectedPath === null) {
|
||||||
|
setStatusMessage("Select a path before changing its spline resolution.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextPath = createScenePath({
|
||||||
|
...selectedPath,
|
||||||
|
sampledResolution: normalizeScenePathSampledResolution(sampledResolution)
|
||||||
|
});
|
||||||
|
|
||||||
|
commitPathChange(selectedPath, nextPath, "Updated Path spline resolution.");
|
||||||
|
};
|
||||||
|
|
||||||
const handlePathPointDraftChange = (
|
const handlePathPointDraftChange = (
|
||||||
pointIndex: number,
|
pointIndex: number,
|
||||||
axis: keyof Vec3Draft,
|
axis: keyof Vec3Draft,
|
||||||
|
|||||||
Reference in New Issue
Block a user