Experiment: Edit non-main composites - #1324
Open
nearnshaw wants to merge 4 commits into
Open
Conversation
Contributor
Test @dcl/asset-packs package
|
Contributor
Test @dcl/inspector package
|
Contributor
Test this pull request on macos-latestDownload the correct version for your architecture:Click here if you don't know which version to downloadFor running this unsigned version of the app, you will need to run the xattr command on it:
|
Contributor
Test this pull request on windows-latestDownload the correct version for your architecture: |
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.
Summary
Adds a dropdown next to the scene name that lets you pick a composite file other than
main.composite. The selected composite is what the inspector edits.These alternative composites are meant to describe items that can be added dynamically to a scene at runtime via js-sdk-toolchain#1333. Changing a composite doesn't retroactively update instances already placed in
main.composite, but it affects any new ones spawned dynamically once the scene starts.What the dropdown does
assets/(main scene + alt composites discovered by recursive scan, with corruptedcomposite.jsonfiles filtered out).assets/custom/<slug>/composite.jsonwith a singlecore-schema::Namecomponent on the root entity.data.jsonso the duplicate gets its own identity) and Delete (removes just the composite file; assets in the same folder are kept).What's different when editing an alternative composite
Scene-level concepts don't apply when you're authoring a single item, so the UI hides or repurposes them:
BackgroundPlaneground is disabled so the item isn't half-buried at y=0.spawn_pointsnode) are disabled.SceneInspectorare not rendered.isEntityOutsideLayoutreturns false), so no entities get the yellow "outside layout" material or warning icons.editorCamera.centerViewOnEntity(sceneContext.rootNode)on the firstonDataLoadedObservablefire.Namecomponent value as the label (falls back to "Scene" if absent).ROOT_COMPOSITEfilter is bypassed for ROOT in alt mode).Asset placement
When dropping assets while editing an alt composite, files go into the composite's folder rather than the project-wide
assets/asset-packs/assets/custom:<compositeBaseFolder>/<assetPackageName>/.<compositeBaseFolder>/<assetPackageName>/.<compositeBaseFolder>/Scripts/.Loading alt composites into the engine
Alt-composite files (
composite.jsonunderassets/custom/...orassets/asset-packs/...) aren't picked up by the existing.composite-only scan, socomposite-provider.tsfalls back to reading them directly and resolving smart-item placeholders before handing them toComposite.fromJson:{self}→ numeric component id allocated from a counter seeded from the existingCounter.valueon entity 0 (and the final value is written back into the composite JSON before instancing, so we don't mutate the engine beforeComposite.instanceruns).{self:ComponentName}/{N:ComponentName}→ resolved against the same id map.core-schema::Sync-Components.componentIdsentries that are stored as component name strings → resolved to numeric component ids viaengine.getComponent(name).componentId(mirroringparseSyncComponentsfrom add-asset). Unregistered components are dropped rather than crashing the stream.{assetPath}→ replaced with the composite's parent folder in every string in the composite, including JSON-encoded action payloads like'{"src":"{assetPath}/fireworkexplode.mp3"}'.Test plan
assets/custom/<slug>/, the inspector reloads into the new composite, and the root entity is labeled with the name you typed.assets/custom/<slug>/.assets/asset-packs/confetti/composite.json) — placeholders resolve, GLBs load, noBigInterrors.🤖 Generated with Claude Code