Skip to content

Shared sketches across scenes#667

Open
funwithtriangles wants to merge 2 commits into
alphafrom
shared-sketches
Open

Shared sketches across scenes#667
funwithtriangles wants to merge 2 commits into
alphafrom
shared-sketches

Conversation

@funwithtriangles

@funwithtriangles funwithtriangles commented Jul 12, 2026

Copy link
Copy Markdown
Member

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 nodeIds as a property on sketches, which shouldn't be there, we're now using childGroups.nodeIds for that

Todo

  • make it more clear when a sketch is shared
  • check breadcrumbs logic when a sketch has multiple parents
  • check webgl sketches

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useSceneNodes in ui-core and reuse it in scene-related panels.
  • Migrate sketch child traversal from sketch.nodeIds to sketch.childGroups.nodeIds across 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,
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants