Add link property for animation selection (dummy).

This commit is contained in:
Davide Tantillo 2026-01-26 10:29:46 +01:00
parent 7dd315e2dd
commit bab3bf625c
4 changed files with 21 additions and 0 deletions

View File

@ -561,6 +561,10 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
if (!spriteType) await project.CreateObjectType("Sprite", collisionSpriteName); if (!spriteType) await project.CreateObjectType("Sprite", collisionSpriteName);
} }
public async selectAnimation () {
console.log('[Spine] Select animation dialog called');
}
private lang (stringKey: string, interpolate: (string | number)[] = []): string { private lang (stringKey: string, interpolate: (string | number)[] = []): string {
const pluginContext = "plugins.esotericsoftware_spineconstruct3.custom_ui."; const pluginContext = "plugins.esotericsoftware_spineconstruct3.custom_ui.";
let intlString = globalThis.lang(`${pluginContext}${stringKey}`); let intlString = globalThis.lang(`${pluginContext}${stringKey}`);

View File

@ -22,6 +22,11 @@
"name": "Loader scale", "name": "Loader scale",
"desc": "Loader scale" "desc": "Loader scale"
}, },
"select-animation": {
"name": "Select animation",
"desc": "Open a dialog to select an animation from the skeleton",
"link-text": "Select"
},
"spine-animation": { "spine-animation": {
"name": "animation", "name": "animation",
"desc": "animation" "desc": "animation"

View File

@ -22,6 +22,11 @@
"name": "加载比例", "name": "加载比例",
"desc": "加载比例" "desc": "加载比例"
}, },
"select-animation": {
"name": "选择动画",
"desc": "打开对话框从骨架中选择动画",
"link-text": "选择"
},
"spine-animation": { "spine-animation": {
"name": "动画", "name": "动画",
"desc": "动画" "desc": "动画"

View File

@ -79,6 +79,13 @@ const PLUGIN_CLASS = class SpineC3Plugin extends SDK.IPluginBase {
new SDK.PluginProperty("projectfile", SpineC3Plugin.PROP_SKELETON, { initialValue: "", filter: ".json,.skel" }), new SDK.PluginProperty("projectfile", SpineC3Plugin.PROP_SKELETON, { initialValue: "", filter: ".json,.skel" }),
new SDK.PluginProperty("float", SpineC3Plugin.PROP_LOADER_SCALE, 1), new SDK.PluginProperty("float", SpineC3Plugin.PROP_LOADER_SCALE, 1),
new SDK.PluginProperty("text", SpineC3Plugin.PROP_SKIN, ""), new SDK.PluginProperty("text", SpineC3Plugin.PROP_SKIN, ""),
new SDK.PluginProperty("link", "select-animation", {
linkCallback: async (instance) => {
const sdkInst = instance as SDKEditorInstanceClass;
await sdkInst.selectAnimation();
},
callbackType: "for-each-instance"
}),
new SDK.PluginProperty("text", SpineC3Plugin.PROP_ANIMATION, ""), new SDK.PluginProperty("text", SpineC3Plugin.PROP_ANIMATION, ""),
new SDK.PluginProperty("check", SpineC3Plugin.PROP_DEBUG_SKELETON, false), new SDK.PluginProperty("check", SpineC3Plugin.PROP_DEBUG_SKELETON, false),
new SDK.PluginProperty("check", SpineC3Plugin.PROP_ENABLE_COLLISION, false), new SDK.PluginProperty("check", SpineC3Plugin.PROP_ENABLE_COLLISION, false),