Repository navigation
packaging: find lights below glTF orientation helpers after a runtime load - #646
Merged
Merged
Conversation
A table loaded from a .vpe in the player left every insert's spill light lit at its exported intensity, whatever the lamp did: the insert went dark, the spot under it kept lighting the plastics. glTF spots point the other way than Unity's, so glTFast puts them on a rotated <name>_Orientation child, once when exporting and again when instantiating. The spill reference resolved with GetComponent<Light>() on the node its id names, which at runtime holds no light, so the insert never drove it. The editor import folds the helpers back into the prefab's light, which is why only the player was affected. VpeLightRestore.FindLight follows the helpers named after their parent down to the light. No package format change: existing .vpe files load correctly.
[Medium impact] The PR appears safe to merge. SummaryRestores insert spill references through glTFast’s orientation helpers.
Reviews (2) · Last reviewed commit: "packaging: restore the lights payload af..." · Reviewed by Greptile |
A lamp's light sources are packed with sibling-index paths. At runtime those paths land on the wrong lights: glTFast puts a spot or directional light on rotated <name>_Orientation helpers that it prepends to the node's children, and the export skips inactive objects that the paths still count. A lamp with a spot and point lights below it then gave a point light another light's settings, a spot's included. The lights payload (meta/lights.json) holds every exported light by node id. The runtime reader applied it before the items and let the path-based restore override it; it now applies it after them, as the editor import already does.
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.
In the player, tables loaded from a
.vpelost track of lights that glTFast moves onto its orientation helpers. Two symptoms, one cause.1. Insert spill lights stayed lit
Every insert's spill light stayed lit at its exported intensity, whatever the lamp did. The insert shader went dark, but the spot under it kept lighting the plastics.
glTF spots point the other way than Unity's, so glTFast puts a spot on a rotated
<name>_Orientationchild: once when exporting, and again when instantiating. At runtime the light sits two helpers below the node the spill reference names.InsertLightPackable.UnpackReferencesresolved it withGetComponent<Light>()on that node, got null, and the insert never drove its spill. The light kept the statemeta/lights.jsongave it: enabled, at the authored intensity.Fix:
VpeLightRestore.FindLightreturns the node's own light, or follows the helpers named after their parent down to it. The spill reference resolves through it.2. A lamp's lights could take each other's settings
A
LightComponentpacks its light sources with sibling-index paths. At runtime those paths land on the wrong lights: glTFast prepends its helper to a spot's node's children, and the export skips inactive objects (such as a hidden bulb mesh) that the paths still count. On a lamp with a spot and point lights below it, a point light could get another light's settings, a spot's type included.Fix: the runtime reader now applies the lights payload (
meta/lights.json, every exported light by stable node id) after the items, so the path-based restore no longer has the last word. The editor import already used this order.Package compatibility
Only reading changed, not the format: no items schema bump. Existing
.vpefiles load correctly with this build.Tests
SpillReferenceFindsTheSpotBelowGltfOrientationHelpers: the spot two helpers down is found, and an authored light named like a helper isn't taken for one.PackagedInsertUsesGlbMeshAndRestoresLampInRuntimeReadernow exports a spot spill and loads it throughRuntimePackageReader. The spill's own node has no light, and the reference still resolves to the spot.LampLightSourcesKeepTheirSettingsBesideASpot: a lamp with a spot, point A, spot B, point C and a hidden bulb, throughPackageWriter+RuntimePackageReader. Every light keeps its own type and range. With the old order it fails: A loads as a spot with B's range.