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.

feat(assets): a list field can say where its row names come from

esengine24791e60a1f3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d57ebaec..e8f0b2fee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,6 +33,11 @@ published separately; it ships inside the editor.
primitive that node draws, one channel per target, and the clip that raises the
example robot's banner now furls it as it rises.
+ The inspector shows **a slider per shape, under the name the mesh gave it** —
+ a weight is positional, so a column of unlabelled numbers would be unusable for
+ the thing morph targets are for. The labels come from a source the field
+ declares, read through the same `.esmesh` reader the asset panel uses.
+
- **A controller is a stack of machines, not one.** One state machine can say a
character is running or that it is waving, never both. A `.esanimator` now
carries layers over its base one — each a machine with its own clock, its own
diff --git a/desktop b/desktop
index aaa7189a2..2ebe9b39f 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit aaa7189a2f8ce6682961935d90d4e3b8e481d5fb
+Subproject commit 2ebe9b39feb0382633d7815346fb4aeb1f73f97b
diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.md
index 2fcf7adc9..2fdbf7151 100644
--- a/sdk/etc/index.api.md
+++ b/sdk/etc/index.api.md
@@ -3476,6 +3476,7 @@ enumSource: string | undefined
flags: readonly { label: string; value: number; }[] | undefined
gradient: boolean | undefined
label: string | undefined
+labelSource: string | undefined
map: boolean | undefined
max: number | undefined
min: number | undefined
diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.md
index 08c5a75b9..4860978dc 100644
--- a/sdk/etc/index.native.api.md
+++ b/sdk/etc/index.native.api.md
@@ -3484,6 +3484,7 @@ enumSource: string | undefined
flags: readonly { label: string; value: number; }[] | undefined
gradient: boolean | undefined
label: string | undefined
+labelSource: string | undefined
map: boolean | undefined
max: number | undefined
min: number | undefined
diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.md
index 2a1bbfb0a..cd44163a8 100644
--- a/sdk/etc/index.node.api.md
+++ b/sdk/etc/index.node.api.md
@@ -3471,6 +3471,7 @@ enumSource: string | undefined
flags: readonly { label: string; value: number; }[] | undefined
gradient: boolean | undefined
label: string | undefined
+labelSource: string | undefined
map: boolean | undefined
max: number | undefined
min: number | undefined
diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.md
index 16405dd09..5281cff0c 100644
--- a/sdk/etc/minigame.api.md
+++ b/sdk/etc/minigame.api.md
@@ -3471,6 +3471,7 @@ enumSource: string | undefined
flags: readonly { label: string; value: number; }[] | undefined
gradient: boolean | undefined
label: string | undefined
+labelSource: string | undefined
map: boolean | undefined
max: number | undefined
min: number | undefined
diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.md
index e6cbc695d..c4d5a0577 100644
--- a/sdk/etc/wechat.api.md
+++ b/sdk/etc/wechat.api.md
@@ -3471,6 +3471,7 @@ enumSource: string | undefined
flags: readonly { label: string; value: number; }[] | undefined
gradient: boolean | undefined
label: string | undefined
+labelSource: string | undefined
map: boolean | undefined
max: number | undefined
min: number | undefined
diff --git a/sdk/src/ecs/component.generated.ts b/sdk/src/ecs/component.generated.ts
index e779b92ab..1fa507137 100644
--- a/sdk/src/ecs/component.generated.ts
+++ b/sdk/src/ecs/component.generated.ts
@@ -536,7 +536,7 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {
colorFields: [],
animatableFields: ['weights'],
fields: {
- weights: { tooltip: "Weight per morph target of the mesh, in the order the mesh carries them." },
+ weights: { tooltip: "Weight per morph target of the mesh, in the order the mesh carries them.", labelSource: "meshMorphTargets" },
},
},
MeshRenderer: {
diff --git a/sdk/src/ecs/component.ts b/sdk/src/ecs/component.ts
index ae057dbd6..e6685596f 100644
--- a/sdk/src/ecs/component.ts
+++ b/sdk/src/ecs/component.ts
@@ -67,6 +67,13 @@ export interface FieldMeta {
* source yields none, so free-int editing survives a project with no named set.
*/
enumSource?: string;
+ /**
+ * Names a registered source of LABELS for the entries of a LIST field: the
+ * inspector shows a row per entry under the name that source gives it (a
+ * morph weight under its shape's name). The labels come from elsewhere —
+ * a mesh's own targets — which is why the field cannot state them itself.
+ */
+ labelSource?: string;
/** Render as a bitmask multi-select; each option is a single bit. */
flags?: ReadonlyArray<{ label: string; value: number }>;
/** Render as a color-gradient editor (the field value is `{ stops: [...] }`). */
diff --git a/src/esengine/bindings/EditorAPI.generated.cpp b/src/esengine/bindings/EditorAPI.generated.cpp
index 783742787..e72745a4b 100644
--- a/src/esengine/bindings/EditorAPI.generated.cpp
+++ b/src/esengine/bindings/EditorAPI.generated.cpp
@@ -2,10 +2,10 @@
* @file EditorAPI.generated.cpp
* @brief Auto-generated editor API with string-dispatched component access
* @details Generated by EHT - DO NOT EDIT
- * @schema_hash 568d2025de148a47
+ * @schema_hash 6b07b247cfa8569a
*/
-#define ES_EDITOR_API_SCHEMA_HASH "568d2025de148a47"
+#define ES_EDITOR_API_SCHEMA_HASH "6b07b247cfa8569a"
#include <emscripten/bind.h>
#include <string>
diff --git a/src/esengine/ecs/components/MeshRenderer.hpp b/src/esengine/ecs/components/MeshRenderer.hpp
index 3b9888854..0a72454b1 100644
--- a/src/esengine/ecs/components/MeshRenderer.hpp
+++ b/src/esengine/ecs/components/MeshRenderer.hpp
@@ -158,7 +158,8 @@ struct MeshMorph {
/** @brief Weight per target, 0 leaving the mesh as authored. Not clamped: a
* negative weight and one past 1 are both shapes an author may want,
* and glTF states neither bound. */
- ES_PROPERTY(animatable, tooltip="Weight per morph target of the mesh, in the order the mesh carries them.")
+ ES_PROPERTY(animatable, label_source=meshMorphTargets,
+ tooltip="Weight per morph target of the mesh, in the order the mesh carries them.")
std::vector<f32> weights;
MeshMorph() = default;
diff --git a/tools/eht/generators/metadata.py b/tools/eht/generators/metadata.py
index a7dbc3d89..390dd629a 100644
--- a/tools/eht/generators/metadata.py
+++ b/tools/eht/generators/metadata.py
@@ -120,6 +120,8 @@ class MetadataGenerator:
entries.append(('advanced', 'true'))
if 'enum_source' in a:
entries.append(('enumSource', json.dumps(a['enum_source'], ensure_ascii=False)))
+ if 'label_source' in a:
+ entries.append(('labelSource', json.dumps(a['label_source'], ensure_ascii=False)))
if 'bitmask_source' in a:
entries.append(('bitmask', '{ source: ' + json.dumps(a['bitmask_source'], ensure_ascii=False) + ' }'))
if 'normalized_of' in a:
diff --git a/tools/eht/parser.py b/tools/eht/parser.py
index 2a25e5dd0..f83e4cd27 100644
--- a/tools/eht/parser.py
+++ b/tools/eht/parser.py
@@ -61,6 +61,11 @@ class CppParser:
KV_ANNOTATIONS = frozenset({
'asset', 'anim_flag', 'min', 'max', 'step', 'unit', 'label',
'tooltip', 'category', 'enum_source', 'bitmask_source', 'invalidates',
+ # `label_source=<name>` names a source of LABELS for a list field's entries,
+ # so the inspector can show a weight per shape under the shape's own name.
+ # Like enum_source the source is registered editor-side; unlike it, what it
+ # names is a row rather than a value.
+ 'label_source',
# `enum=SomeEnum` links an int field to a C++ ES_ENUM so EHT generates the
# editor dropdown from that enum's values — for fields kept as i32 (not the
# enum type) but still single-choice. Enum-TYPED fields need no annotation.