The level formats' contribution for managed properties.
This is the side that knows what the json means, and the formats only know the extension by name.
The managed entry points are resolved once at registration and cached here, which is what keeps the level format from resolving them through hostfxr for every entity it writes.
The text is the entity as one node per property. It is the only shape the formats can use, because they cannot read the text and cannot group it, and it is the shape an editor command holds as well: a command applies the entity's whole text, which is what makes a change that took a property off read as a change rather than as an addition.
What an editor knows that this side cannot read is handed over as callbacks: the change the managed write path reported, the key a marker was pressed on, and whether a row is the instance's own. These are the editor's half of the contract, and they are null in a build that has no editor.
- See also
- Game::LevelExtension
- Copyright
- (C) 2026 Individual contributors, see AUTHORS file
|
| static void | SetChangeCallback (ChangeFunc func) |
| | An editor attaches itself here.
|
| static void | SetRevertCallback (RevertFunc func) |
| | An editor attaches itself here.
|
| static void | SetAuthoredCallback (AuthoredFunc func) |
| | An editor attaches itself here.
|
| static void | Register (Scripting::NSharpServer *server, Scripting::AssemblyId assemblyId) |
| | resolve the managed entry points and register the extension with the level formats
|
| static void | Capture (Game::Entity entity, Util::String &out) |
| | the json for one entity, as the managed runtime produces it
|
| static void | Apply (Game::Entity entity, const char *json) |
| | one entity, put back from the json the file carried for it
|
| static void | CaptureKeys (Game::Entity entity, const Util::Array< Util::String > &keys, Util::String &out) |
| | the json for one entity with only the named keys, which is what a linked entity writes
|
| static void | TextKeys (const char *text, Util::Array< Util::String > &out) |
| | the keys a text carries, as the paths this extension names them by
|
| static void | Merge (const char *base, const char *over, Util::String &out) |
| | what the base text gives when the keys the other text carries are put over it
|
| static void | Resolve (const char *base, const Util::Array< Util::String > &keys, Util::String &out) |
| | the text for the named keys, each value read from the base text, or the field's default when the base has nothing.
|
| static void | SetRefContext (const char *pairs) |
| | the file's guid map, as "guid:entityId" pairs.
|
| static void | TextRefs (const char *text, Util::Array< Game::TextRef > &out) |
| | the entity references a text names, as the paths this extension names its fields by.
|
| static void | Remap (const char *text, const char *pairs, Util::String &out) |
| | the text with the named paths' references put as the given guids, as "path\tguid" pairs
|
| static void | ClearMirror (uint32_t worldId) |
| | the mirror this extension keeps of a world, dropped.
|
| static void | Draw (Game::Entity entity) |
| | the property section, drawn by the managed side through the editor's ImGui surface.
|
| static Util::StringAtom | ExtensionName () |
| | the name the extension registered under, which is what the editor's override marker is keyed by
|
| static void | RecordChange (Game::Entity entity, const char *path, const char *oldText, const char *newText) |
| | the change the managed write path reported.
|
| static void | RequestRevert (Game::Entity entity, const char *path) |
| | the key the managed side pressed the override marker on.
|
| static bool | IsAuthored (Game::Entity entity, const char *path) |
| | whether the editor's marker says this entity authored the path.
|
| static void | AddPropertyName (const char *propertyName) |
| | One of the names the editor's dropdown lists.
|
| static void | ClearPropertyNames () |
| static const Util::Array< Util::String > & | PropertyNames () |
| static bool | HasProperty (Game::Entity entity, const char *propertyName) |
| | true when the entity has the property, which is what makes a dropdown row read as already added
|
| static void | DefaultPropertyJson (const char *propertyName, Util::String &out) |
| | the text a default instance of the property produces, which is what an add writes
|
| void Scripting::PropertyLevelExtension::ClearMirror |
( |
uint32_t | worldId | ) |
|
|
static |
the mirror this extension keeps of a world, dropped.
The mirror this extension keeps of a world, dropped.
This is the only way the side that owns the mirror can be told that a world was emptied and refilled, because the formats cannot know which world an extension mirrors
The formats cannot know which world an extension mirrors, so this is how a build that empties and refills a world tells this side that the mirror has to go with the content it had.
| bool Scripting::PropertyLevelExtension::IsAuthored |
( |
Game::Entity | entity, |
|
|
const char * | path ) |
|
static |
whether the editor's marker says this entity authored the path.
Whether the editor's marker says this entity authored the path.
A path with no field asks whether any field of the property is authored, which is what a section row answers with
The marker is the editor's own and this side cannot read it, so a row asks. Without a callback nothing is authored, which is what makes a game build a no-op.
| void Scripting::PropertyLevelExtension::RecordChange |
( |
Game::Entity | entity, |
|
|
const char * | path, |
|
|
const char * | oldText, |
|
|
const char * | newText ) |
|
static |
the change the managed write path reported.
The change the managed write path reported.
Runs the callback, which is what builds the command. The path is the key inside the text the change is about, which is the only place the editor ever learns what a key means, and a path with no field is the whole property
The managed side does not write anything itself: it works out the text before and after and hands both here, and the callback is what runs the change through a command. Without a callback there is nothing to record, which is what makes a game build a no-op.
The path is the key inside the text the change is about. A path with no field is the whole property, which is what an add and a removal report.
| void Scripting::PropertyLevelExtension::RequestRevert |
( |
Game::Entity | entity, |
|
|
const char * | path ) |
|
static |
the key the managed side pressed the override marker on.
The key the managed side pressed the override marker on.
Runs the callback, which is what builds the revert. A path with no field is the whole property
The managed side cannot know what a press means, so it only says which key it was, and the callback is what builds the revert. Without a callback there is nothing to do, which is what makes a game build a no-op.
the text for the named keys, each value read from the base text, or the field's default when the base has nothing.
The text for the named keys, each value read from the base text, or the field's default when the base has nothing.
This is what a revert to the prefab writes, because a key the chain does not carry has no value to put back
This is what a revert to the prefab writes, and the same buffer pattern as the merge is what makes the length come back right when the buffer was too small.
| void Scripting::PropertyLevelExtension::SetRefContext |
( |
const char * | pairs | ) |
|
|
static |
the file's guid map, as "guid:entityId" pairs.
The file's guid map, as "guid:entityId" pairs.
Only valid for the duration of the call that sets it, which is what makes a merged text resolve against the files it names guids from
The formats cannot resolve what a text names, because they do not read it, so this is how the map gets to the side that does. It is only valid for the duration of the call that sets it.
the entity references a text names, as the paths this extension names its fields by.
The entity references a text names.
Only this side can answer, because the formats cannot read the text
The managed side answers them as "path\tguid" lines, because this side cannot read the text, and the buffer is the only thing that comes back across the boundary. The strings have to be copied out of the buffer before it is used for anything else.