Repository navigation
feat(scenes): accept @ref target-override keys + engine version gate (labelle-engine#801)
#650
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
Changes from all commits
783957f
2f1d490
7b062fa
24dae7a
129d537
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 |
|---|---|---|
|
|
@@ -136,6 +136,31 @@ pub fn isPascalCase(name: []const u8) bool { | |
| return name[0] >= 'A' and name[0] <= 'Z'; | ||
| } | ||
|
|
||
| /// Byte-parity twin of the engine's `unified_format.zig` `isTargetKey` | ||
| /// (labelle-engine#801): `"@<ref>"` on a prefab reference's override map | ||
| /// targets a ref-named entity inside the referenced prefab's body. Like | ||
| /// PascalCase component keys, `@` keys are flat patch CONTENT at entity | ||
| /// scope — pass 1 must move them into the synthesized wrapper and pass 2 | ||
| /// must open a component map for their values, or the copy's shape drifts | ||
| /// from the author's meaning. | ||
| pub fn isTargetKey(name: []const u8) bool { | ||
| if (name.len > 1 and name[0] == '@') return true; | ||
| // The JSON-escaped spelling decodes to `@` at engine load. These | ||
| // walkers classify RAW bytes, so recognize it here too — otherwise | ||
| // pass 1 leaves an escaped target outside the synthesized wrapper | ||
| // and pass 2 treats its value as opaque payload, silently losing | ||
| // the pack-namespace rewrite on a supported engine (codex P2 on | ||
| // #650). The PascalCase analog (`\u0057orker`) is the broader | ||
| // pre-existing class tracked in #651. | ||
| return name.len > 6 and std.mem.startsWith(u8, name, "\\u0040"); | ||
| } | ||
|
Comment on lines
+146
to
+156
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.
When a pack uses the valid JSON spelling Useful? React with 👍 / 👎. |
||
|
|
||
| /// A flat patch-content key at entity scope: PascalCase component | ||
| /// (RFC #596 axis 2) or `@` target (labelle-engine#801). | ||
| pub fn isFlatComponentKey(name: []const u8) bool { | ||
| return isPascalCase(name) or isTargetKey(name); | ||
| } | ||
|
|
||
| /// The two array-valued entity-list keys the engine walks (`children` on any | ||
| /// entity scope, legacy `entities` at file level). Shared between pass 2's | ||
| /// `childArrayScope` and pass 1's flat-wrap recursion so the two walks can | ||
|
|
@@ -181,7 +206,7 @@ pub fn isOnlyMetaHeaderObject(src: []const u8, open: usize) bool { | |
| std.mem.eql(u8, key, "components") or | ||
| std.mem.eql(u8, key, "overrides") or | ||
| std.mem.eql(u8, key, "ref") or | ||
| isPascalCase(key)) | ||
| isFlatComponentKey(key)) | ||
| { | ||
| // Any entity-shape key disqualifies — this is an entity that | ||
| // happens to carry a `meta` field, not a file header. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.