Shared sketches across scenes#667
Open
funwithtriangles wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds UI affordances to share a single sketch node instance across multiple scenes, including a new sketch options panel and some refactors to selected-node UI rendering. It also standardizes sketch child node access via childGroups.nodeIds and introduces an engine helper for unlinking parent/child relationships.
Changes:
- Add a sketch options panel (desktop UI) that can attach/detach a sketch to/from multiple scenes.
- Introduce
useSceneNodesinui-coreand reuse it in scene-related panels. - Migrate sketch child traversal from
sketch.nodeIdstosketch.childGroups.nodeIdsacross engine selectors/actions and input UIs.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ui-core/src/index.ts | Exports the new useSceneNodes hook. |
| packages/ui-core/src/hooks/useSceneNodes.ts | Adds a shared hook to retrieve scene nodes from the engine store. |
| packages/scene-control/src/components/SceneControlGlobalPanel/SceneControlGlobalPanel.tsx | Replaces inline scene selection logic with useSceneNodes. |
| packages/midi-input/src/MidiGlobalPanel.tsx | Updates sketch membership lookup to use sketch.childGroups.nodeIds. |
| packages/gamepad-input/src/GamepadGlobalPanel.tsx | Updates sketch membership lookup to use sketch.childGroups.nodeIds. |
| packages/engine/src/store/types/SketchNode.ts | Removes redundant nodeIds field; keeps childGroups.nodeIds as source of truth. |
| packages/engine/src/store/selectors/getSketchShotNodes.ts | Reads sketch shot nodes via childGroups.nodeIds. |
| packages/engine/src/store/selectors/getSketchParamValues.ts | Reads sketch param nodes via childGroups.nodeIds. |
| packages/engine/src/store/actionCreators/createReconcileSketchNodes.ts | Reconciles sketch children via childGroups.nodeIds. |
| packages/engine/src/store/actionCreators/addSketch.ts | Stops writing nodeIds at the sketch root; only writes childGroups.nodeIds. |
| packages/engine/src/HedronEngine/HedronEngine.ts | Adds removeChildFromNode helper for unlinking nodes. |
| apps/desktop/src/renderer/components/SelectedNode/SelectedSketch.tsx | New panel for sharing a sketch instance across multiple scenes. |
| apps/desktop/src/renderer/components/SelectedNode/SelectedParamOrShot.tsx | Extracts param/shot selection UI from SelectedNode. |
| apps/desktop/src/renderer/components/SelectedNode/SelectedNode.tsx | Routes selected-node rendering by node type (sketch vs param/shot). |
| apps/desktop/src/renderer/components/SelectedNode/SelectedNode.module.css | Adds styling for the new scene sharing checklist. |
| apps/desktop/src/renderer/components/ActiveSketch/ActiveSketch.tsx | Adds “Sketch Options” entry and updates grouped node lookup to childGroups.nodeIds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+241
to
+249
| const childGroups = parentNode.childGroups as ChildGroupsLoose | ||
| const childGroup = childGroups[childGroupKey] | ||
|
|
||
| if (!childGroup) { | ||
| return | ||
| } | ||
|
|
||
| childGroups[childGroupKey] = childGroup.filter((id) => id !== childId) | ||
| childNode.parentIds = childNode.parentIds.filter((id) => id !== parentId) |
Comment on lines
+19
to
+23
| if (shouldInclude) { | ||
| engine.addChildToNode(sceneId, 'sketchIds', sketchNode.id) | ||
| } else { | ||
| engine.removeChildFromNode(sceneId, 'sketchIds', sketchNode.id) | ||
| } |
Comment on lines
+61
to
+65
| { | ||
| label: 'Sketch Options', | ||
| icon: 'settings', | ||
| onClick: openSketchOptions, | ||
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a sketch options panel with only one feature: allow the same instance of a sketch to be shared across multiple scenes. I didn't have to update any real engine stuff here, just some UI stuff to allow for sketches to be added as children to other scenes. It seems to automatically work for both post processing and object-based sketches.
This PR also does a bit of tidying up, we had
nodeIdsas a property on sketches, which shouldn't be there, we're now usingchildGroups.nodeIdsfor thatTodo