Repository navigation
Initialize loaded scene transforms, lights and material overrides #3002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
dfbc0c5
5775cb4
021fd5c
74ce32c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1718,6 +1718,14 @@ public void read(JmeImporter im) throws IOException { | |
|
|
||
| localLights = (LightList) ic.readSavable("lights", null); | ||
| localLights.setOwner(this); | ||
| // Rebuild derived world state without invoking overridable refresh methods during loading. | ||
| refreshFlags |= RF_TRANSFORM | RF_BOUND | RF_LIGHTLIST | RF_MATPARAM_OVERRIDE; | ||
| for (Light light : localLights) { | ||
| if (light.isGlobal()) { | ||
| refreshFlags |= RF_GLOBAL_LIGHTS; | ||
| break; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heads up on this flag: Cheap way to close it: have the read-time invalidation re-mark light state too (not just
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked this on 5775cb4. getWorldLightList only returns worldLights; it does not recompute anything or clear flags. The protected updateWorldLightList clears RF_LIGHTLIST, not RF_GLOBAL_LIGHTS. I also replayed read-time controls across six getter scenarios and six separate protected-updater diagnostics (different global-light owners, settled/unsettled saves). RF_GLOBAL_LIGHTS remains pending in every case, and normal final root updates produce the expected ancestor and descendant light lists. A full updateGeometricState during partial deserialization is a different operation, outside the stated getter scenario and the limits documented in this PR.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, and I'm withdrawing this one. I misread the flag lifecycles: One residual, clearly outside the stated getter scenario: a full Light point closed on my side. My remaining note is the |
||
| } | ||
| } | ||
|
|
||
| ArrayList<MatParamOverride> localOverridesList = ic.readSavableArrayList("overrides", null); | ||
| if (localOverridesList == null) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and tidy — marking everything derived here avoids calling overridable refresh hooks on half-built subclasses. One thing to keep in mind:
localLightscomes straight fromreadSavable("lights", null), so the newforloop is the first thing that dereferences it. Everything jME writes includeslights, so this only matters for hand-built capsules — just a heads-up in case you want a guard for symmetry with the older file formats.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The preceding localLights.setOwner(this) already dereferences the result, before the new loop; that call is unchanged from the base. So this patch does not introduce the null dereference. I have kept the existing serialized-LightList contract unchanged rather than add an unrelated legacy-format behavior without a failing fixture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair — and thanks for checking the surrounding line rather than taking my note at face value.
localLights.setOwner(this)on the line above already dereferences it, so nothing here changes the existing contract. Dropping that point; agreed there's no reason to invent legacy-format behavior without a failing fixture.That leaves
invalidateReadTransform's short-circuit as the one open item — theP → C → Dsequence is up in the PR conversation if you want a concrete sequence to replay.