From ef6e4aa559b64125afa7156c2722226cd384bf08 Mon Sep 17 00:00:00 2001 From: badlogic Date: Fri, 15 Apr 2022 01:51:34 +0200 Subject: [PATCH] [godot] Fix animation mixes layout. --- spine-godot/spine_godot/SpineEditorPlugin.cpp | 18 +++++++++++++----- spine-godot/spine_godot/SpineEditorPlugin.h | 3 ++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/spine-godot/spine_godot/SpineEditorPlugin.cpp b/spine-godot/spine_godot/SpineEditorPlugin.cpp index 507ef89ca..e9d340165 100644 --- a/spine-godot/spine_godot/SpineEditorPlugin.cpp +++ b/spine-godot/spine_godot/SpineEditorPlugin.cpp @@ -99,6 +99,7 @@ bool SpineSkeletonDataResourceInspectorPlugin::parse_property(Object *object, Va } SpineEditorPropertyAnimationMixes::SpineEditorPropertyAnimationMixes(): skeleton_data(nullptr), container(nullptr), updating(false) { + array_object.instance(); } void SpineEditorPropertyAnimationMixes::_bind_methods() { @@ -164,6 +165,7 @@ void SpineEditorPropertyAnimationMixes::update_property() { auto mix_property = memnew(SpineEditorPropertyAnimationMix); mix_property->set_h_size_flags(SIZE_EXPAND_FILL); + mix_property->set_name_split_ratio(0); hbox->add_child(mix_property); mix_property->setup(skeleton_data, mix); mix_property->set_object_and_property(*mix, ""); @@ -171,7 +173,7 @@ void SpineEditorPropertyAnimationMixes::update_property() { auto delete_button = memnew(Button); hbox->add_child(delete_button); - delete_button->set_text("Delete"); + delete_button->set_text("Remove"); delete_button->connect("pressed", this, "delete_mix", varray(i)); } @@ -228,27 +230,33 @@ void SpineEditorPropertyAnimationMix::update_property() { auto from_enum = memnew(EditorPropertyTextEnum); from_enum->set_h_size_flags(SIZE_EXPAND_FILL); - container->add_child(from_enum); + from_enum->set_name_split_ratio(0); + from_enum->set_selectable(false); from_enum->setup(animation_names); from_enum->set_object_and_property(get_edited_object(), "from"); from_enum->update_property(); from_enum->connect("property_changed", this, "data_changed"); + container->add_child(from_enum); auto to_enum = memnew(EditorPropertyTextEnum); to_enum->set_h_size_flags(SIZE_EXPAND_FILL); - container->add_child(to_enum); + to_enum->set_name_split_ratio(0); + to_enum->set_selectable(false); to_enum->setup(animation_names); to_enum->set_object_and_property(get_edited_object(), "to"); to_enum->update_property(); to_enum->connect("property_changed", this, "data_changed"); + container->add_child(to_enum); auto mix_float = memnew(EditorPropertyFloat); mix_float->set_h_size_flags(SIZE_EXPAND_FILL); - container->add_child(mix_float); + mix_float->set_name_split_ratio(0); + mix_float->set_selectable(false); mix_float->setup(0, 9999999, 0.001, true, false, false, false); mix_float->set_object_and_property(get_edited_object(), "mix"); mix_float->update_property(); - mix_float->connect("property_changed", this, "property_changed"); + mix_float->connect("property_changed", this, "data_changed"); + container->add_child(mix_float); updating = false; } diff --git a/spine-godot/spine_godot/SpineEditorPlugin.h b/spine-godot/spine_godot/SpineEditorPlugin.h index d1d853c6d..0a9c39354 100644 --- a/spine-godot/spine_godot/SpineEditorPlugin.h +++ b/spine-godot/spine_godot/SpineEditorPlugin.h @@ -136,6 +136,7 @@ public: class SpineEditorPropertyAnimationMixes: public EditorProperty { GDCLASS(SpineEditorPropertyAnimationMixes, EditorProperty) + Ref array_object; Ref skeleton_data; VBoxContainer *container; bool updating; @@ -154,7 +155,7 @@ class SpineEditorPropertyAnimationMix: public EditorProperty { Ref skeleton_data; Ref mix; - HBoxContainer *container; + Container *container; bool updating; static void _bind_methods();