mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[godot| Animation mixes editor property beginnings.
This commit is contained in:
parent
f5fba4ec05
commit
935c7b463b
@ -86,8 +86,9 @@ bool SpineEditorPlugin::handles(Object *object) const {
|
|||||||
return object->is_class("SpineSprite") || object->is_class("SpineSkeletonDataResource");
|
return object->is_class("SpineSprite") || object->is_class("SpineSkeletonDataResource");
|
||||||
}
|
}
|
||||||
|
|
||||||
SpineAnimationMixesInspectorPlugin::SpineAnimationMixesInspectorPlugin() {
|
SpineAnimationMixesInspectorPlugin::SpineAnimationMixesInspectorPlugin(): add_mix_button(nullptr) {
|
||||||
|
add_mix_button = memnew(Button);
|
||||||
|
add_mix_button->set_text("Add mix");
|
||||||
}
|
}
|
||||||
|
|
||||||
SpineAnimationMixesInspectorPlugin::~SpineAnimationMixesInspectorPlugin() {
|
SpineAnimationMixesInspectorPlugin::~SpineAnimationMixesInspectorPlugin() {
|
||||||
@ -99,23 +100,16 @@ bool SpineAnimationMixesInspectorPlugin::can_handle(Object *object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SpineAnimationMixesInspectorPlugin::parse_begin(Object *object) {
|
void SpineAnimationMixesInspectorPlugin::parse_begin(Object *object) {
|
||||||
EditorInspectorPlugin::parse_begin(object);
|
sprite = object->cast_to<SpineSprite>(object);
|
||||||
}
|
|
||||||
|
|
||||||
void SpineAnimationMixesInspectorPlugin::parse_category(Object *object, const String &parse_category) {
|
|
||||||
EditorInspectorPlugin::parse_category(object, parse_category);
|
|
||||||
if (parse_category == "Animation mixes") {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpineAnimationMixesInspectorPlugin::parse_property(Object *object, Variant::Type type, const String &path,
|
bool SpineAnimationMixesInspectorPlugin::parse_property(Object *object, Variant::Type type, const String &path,
|
||||||
PropertyHint hint, const String &hint_text, int usage) {
|
PropertyHint hint, const String &hint_text, int usage) {
|
||||||
|
if (path == "animation_mixes") {
|
||||||
|
add_custom_control(add_mix_button);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpineAnimationMixesInspectorPlugin::parse_end() {
|
|
||||||
EditorInspectorPlugin::parse_end();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
|
#include "SpineSprite.h"
|
||||||
|
#include "editor/editor_properties.h"
|
||||||
|
|
||||||
class SpineAtlasResourceImportPlugin : public EditorImportPlugin {
|
class SpineAtlasResourceImportPlugin : public EditorImportPlugin {
|
||||||
GDCLASS(SpineAtlasResourceImportPlugin, EditorImportPlugin)
|
GDCLASS(SpineAtlasResourceImportPlugin, EditorImportPlugin)
|
||||||
@ -125,15 +127,18 @@ public:
|
|||||||
class SpineAnimationMixesInspectorPlugin: public EditorInspectorPlugin {
|
class SpineAnimationMixesInspectorPlugin: public EditorInspectorPlugin {
|
||||||
GDCLASS(SpineAnimationMixesInspectorPlugin, EditorInspectorPlugin)
|
GDCLASS(SpineAnimationMixesInspectorPlugin, EditorInspectorPlugin)
|
||||||
|
|
||||||
|
SpineSprite *sprite;
|
||||||
|
|
||||||
|
Button *add_mix_button;
|
||||||
|
Vector<Button *> delete_mix;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SpineAnimationMixesInspectorPlugin();
|
SpineAnimationMixesInspectorPlugin();
|
||||||
~SpineAnimationMixesInspectorPlugin() override;
|
~SpineAnimationMixesInspectorPlugin() override;
|
||||||
|
|
||||||
bool can_handle(Object *object) override;
|
bool can_handle(Object *object) override;
|
||||||
void parse_begin(Object *object) override;
|
void parse_begin(Object *object) override;
|
||||||
void parse_category(Object *object, const String &parse_category) override;
|
|
||||||
bool parse_property(Object *object, Variant::Type type, const String &path, PropertyHint hint, const String &hint_text, int usage) override;
|
bool parse_property(Object *object, Variant::Type type, const String &path, PropertyHint hint, const String &hint_text, int usage) override;
|
||||||
void parse_end() override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SpineAnimationMixesProperty: public EditorProperty {
|
class SpineAnimationMixesProperty: public EditorProperty {
|
||||||
@ -143,6 +148,16 @@ public:
|
|||||||
SpineAnimationMixesProperty();
|
SpineAnimationMixesProperty();
|
||||||
~SpineAnimationMixesProperty();
|
~SpineAnimationMixesProperty();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SpineEditorPropertyMix: public EditorProperty {
|
||||||
|
GDCLASS(SpineEditorPropertyMix, EditorProperty)
|
||||||
|
|
||||||
|
EditorPropertyText *from_property;
|
||||||
|
EditorPropertyText *to_property;
|
||||||
|
EditorPropertyFloat *mix_property;
|
||||||
|
public:
|
||||||
|
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif//GODOT_SPINEEDITORPLUGIN_H
|
#endif//GODOT_SPINEEDITORPLUGIN_H
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user