Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(editor): Spine path setters flip needsReload so live-edit actually reloads

esenginedd18e9ce64da
diff --git a/src/esengine/bindings/EditorAPI.generated.cpp b/src/esengine/bindings/EditorAPI.generated.cpp
index 045ab2889..1d5900148 100644
--- a/src/esengine/bindings/EditorAPI.generated.cpp
+++ b/src/esengine/bindings/EditorAPI.generated.cpp
@@ -1846,6 +1846,7 @@ bool editor_setString(Registry& reg, u32 e, const std::string& comp, const std::
else if (field == "skin") { c.skin = value; }
else if (field == "animation") { c.animation = value; }
else { return false; }
+ c.needsReload = true;
return true;
} else if (comp == "StateMachine") {
if (!reg.has<esengine::ecs::StateMachine>(entity)) return false;
diff --git a/tools/eht/generators/editor_api.py b/tools/eht/generators/editor_api.py
index 8ed6a1df8..f092b1bc9 100644
--- a/tools/eht/generators/editor_api.py
+++ b/tools/eht/generators/editor_api.py
@@ -25,6 +25,16 @@ def compute_schema_hash(components: List[Component]) -> str:
return h.hexdigest()[:16]
+# Components whose non-scalar field changes require a runtime-side
+# invalidation flag to be flipped so the owning system re-runs its load
+# path on the next tick. Expressed as raw C++ appended after the field
+# assignment in editor_setString. When a proper ES_PROPERTY(invalidates=)
+# annotation exists this table should go away.
+_STRING_SET_SIDE_EFFECTS = {
+ 'SpineAnimation': 'c.needsReload = true;',
+}
+
+
class EditorAPIGenerator:
def __init__(self, components: List[Component], enums: List[Enum]):
self.components = components
@@ -658,6 +668,9 @@ class EditorAPIGenerator:
lines.append(f' {prefix} (field == "{key}") {{ c.{cpp_path} = value; }}')
lines.append(' else { return false; }')
+ side_effect = _STRING_SET_SIDE_EFFECTS.get(comp.name)
+ if side_effect:
+ lines.append(f' {side_effect}')
lines.append(' return true;')
if not first_comp: