[godot] Clean-up SpineTrackEntry.

This commit is contained in:
Mario Zechner 2022-04-20 13:33:14 +02:00
parent 12d29a8950
commit 0118871bd2
5 changed files with 281 additions and 200 deletions

View File

@ -76,8 +76,8 @@ void SpineConstant::_bind_methods() {
BIND_ENUM_CONSTANT(RotateMode_Chain) BIND_ENUM_CONSTANT(RotateMode_Chain)
BIND_ENUM_CONSTANT(RotateMode_ChainScale) BIND_ENUM_CONSTANT(RotateMode_ChainScale)
BIND_ENUM_CONSTANT(BLENDMODE_NORMAL) BIND_ENUM_CONSTANT(BlendMode_Normal)
BIND_ENUM_CONSTANT(BLENDMODE_ADDITIVE) BIND_ENUM_CONSTANT(BlendMode_Additive)
BIND_ENUM_CONSTANT(BLENDMODE_MULTIPLY) BIND_ENUM_CONSTANT(BlendMode_Multiply)
BIND_ENUM_CONSTANT(BLENDMODE_SCREEN) BIND_ENUM_CONSTANT(BlendMode_Screen)
} }

View File

@ -100,20 +100,20 @@ public:
}; };
enum BlendMode { enum BlendMode {
BLENDMODE_NORMAL = 0, BlendMode_Normal = 0,
BLENDMODE_ADDITIVE, BlendMode_Additive,
BLENDMODE_MULTIPLY, BlendMode_Multiply,
BLENDMODE_SCREEN BlendMode_Screen
}; };
}; };
VARIANT_ENUM_CAST(SpineConstant::MixBlend); VARIANT_ENUM_CAST(SpineConstant::MixBlend)
VARIANT_ENUM_CAST(SpineConstant::MixDirection); VARIANT_ENUM_CAST(SpineConstant::MixDirection)
VARIANT_ENUM_CAST(SpineConstant::PropertyId); VARIANT_ENUM_CAST(SpineConstant::PropertyId)
VARIANT_ENUM_CAST(SpineConstant::TransformMode); VARIANT_ENUM_CAST(SpineConstant::TransformMode)
VARIANT_ENUM_CAST(SpineConstant::PositionMode); VARIANT_ENUM_CAST(SpineConstant::PositionMode)
VARIANT_ENUM_CAST(SpineConstant::SpacingMode); VARIANT_ENUM_CAST(SpineConstant::SpacingMode)
VARIANT_ENUM_CAST(SpineConstant::RotateMode); VARIANT_ENUM_CAST(SpineConstant::RotateMode)
VARIANT_ENUM_CAST(SpineConstant::BlendMode); VARIANT_ENUM_CAST(SpineConstant::BlendMode)
#endif//GODOT_SPINECONSTANT_H #endif//GODOT_SPINECONSTANT_H

View File

@ -112,7 +112,7 @@ void SpineSlotData::set_attachment_name(const String &v) {
} }
SpineConstant::BlendMode SpineSlotData::get_blend_mode() { SpineConstant::BlendMode SpineSlotData::get_blend_mode() {
SPINE_CHECK(slot_data, SpineConstant::BLENDMODE_NORMAL) SPINE_CHECK(slot_data, SpineConstant::BlendMode_Normal)
return (SpineConstant::BlendMode)slot_data->getBlendMode(); return (SpineConstant::BlendMode)slot_data->getBlendMode();
} }
void SpineSlotData::set_blend_mode(SpineConstant::BlendMode v) { void SpineSlotData::set_blend_mode(SpineConstant::BlendMode v) {

View File

@ -28,238 +28,305 @@
*****************************************************************************/ *****************************************************************************/
#include "SpineTrackEntry.h" #include "SpineTrackEntry.h"
#include "SpineCommon.h"
void SpineTrackEntry::_bind_methods() { void SpineTrackEntry::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_track_index"), &SpineTrackEntry::get_track_index); ClassDB::bind_method(D_METHOD("get_track_index"), &SpineTrackEntry::get_track_index);
ClassDB::bind_method(D_METHOD("get_animation"), &SpineTrackEntry::get_animation); ClassDB::bind_method(D_METHOD("get_animation"), &SpineTrackEntry::get_animation);
ClassDB::bind_method(D_METHOD("get_previous"), &SpineTrackEntry::get_previous);
ClassDB::bind_method(D_METHOD("get_loop"), &SpineTrackEntry::get_loop); ClassDB::bind_method(D_METHOD("get_loop"), &SpineTrackEntry::get_loop);
ClassDB::bind_method(D_METHOD("set_loop", "v"), &SpineTrackEntry::set_loop); ClassDB::bind_method(D_METHOD("set_loop", "v"), &SpineTrackEntry::set_loop);
ClassDB::bind_method(D_METHOD("get_hold_previous"), &SpineTrackEntry::get_hold_previous); ClassDB::bind_method(D_METHOD("get_hold_previous"), &SpineTrackEntry::get_hold_previous);
ClassDB::bind_method(D_METHOD("set_hold_previous", "v"), &SpineTrackEntry::set_hold_previous); ClassDB::bind_method(D_METHOD("set_hold_previous", "v"), &SpineTrackEntry::set_hold_previous);
ClassDB::bind_method(D_METHOD("get_reverse"), &SpineTrackEntry::get_reverse); ClassDB::bind_method(D_METHOD("get_reverse"), &SpineTrackEntry::get_reverse);
ClassDB::bind_method(D_METHOD("set_reverse", "v"), &SpineTrackEntry::set_reverse); ClassDB::bind_method(D_METHOD("set_reverse", "v"), &SpineTrackEntry::set_reverse);
ClassDB::bind_method(D_METHOD("get_shortest_rotation"), &SpineTrackEntry::get_shortest_rotation);
ClassDB::bind_method(D_METHOD("set_shortest_rotation", "v"), &SpineTrackEntry::set_shortest_rotation);
ClassDB::bind_method(D_METHOD("get_delay"), &SpineTrackEntry::get_delay); ClassDB::bind_method(D_METHOD("get_delay"), &SpineTrackEntry::get_delay);
ClassDB::bind_method(D_METHOD("set_delay", "v"), &SpineTrackEntry::set_delay); ClassDB::bind_method(D_METHOD("set_delay", "v"), &SpineTrackEntry::set_delay);
ClassDB::bind_method(D_METHOD("get_track_time"), &SpineTrackEntry::get_track_time); ClassDB::bind_method(D_METHOD("get_track_time"), &SpineTrackEntry::get_track_time);
ClassDB::bind_method(D_METHOD("set_track_time", "v"), &SpineTrackEntry::set_track_time); ClassDB::bind_method(D_METHOD("set_track_time", "v"), &SpineTrackEntry::set_track_time);
ClassDB::bind_method(D_METHOD("get_track_end"), &SpineTrackEntry::get_track_end); ClassDB::bind_method(D_METHOD("get_track_end"), &SpineTrackEntry::get_track_end);
ClassDB::bind_method(D_METHOD("set_track_end", "v"), &SpineTrackEntry::set_track_end); ClassDB::bind_method(D_METHOD("set_track_end", "v"), &SpineTrackEntry::set_track_end);
ClassDB::bind_method(D_METHOD("get_animation_start"), &SpineTrackEntry::get_animation_start); ClassDB::bind_method(D_METHOD("get_animation_start"), &SpineTrackEntry::get_animation_start);
ClassDB::bind_method(D_METHOD("set_animation_start", "v"), &SpineTrackEntry::set_animation_start); ClassDB::bind_method(D_METHOD("set_animation_start", "v"), &SpineTrackEntry::set_animation_start);
ClassDB::bind_method(D_METHOD("get_animation_end"), &SpineTrackEntry::get_animation_end);
ClassDB::bind_method(D_METHOD("set_animation_end", "v"), &SpineTrackEntry::set_animation_end);
ClassDB::bind_method(D_METHOD("get_animation_last"), &SpineTrackEntry::get_animation_last); ClassDB::bind_method(D_METHOD("get_animation_last"), &SpineTrackEntry::get_animation_last);
ClassDB::bind_method(D_METHOD("set_animation_last", "v"), &SpineTrackEntry::set_animation_last); ClassDB::bind_method(D_METHOD("set_animation_last", "v"), &SpineTrackEntry::set_animation_last);
ClassDB::bind_method(D_METHOD("get_animation_time"), &SpineTrackEntry::get_animation_time); ClassDB::bind_method(D_METHOD("get_animation_time"), &SpineTrackEntry::get_animation_time);
ClassDB::bind_method(D_METHOD("get_time_scale"), &SpineTrackEntry::get_time_scale); ClassDB::bind_method(D_METHOD("get_time_scale"), &SpineTrackEntry::get_time_scale);
ClassDB::bind_method(D_METHOD("set_time_scale", "v"), &SpineTrackEntry::set_time_scale); ClassDB::bind_method(D_METHOD("set_time_scale", "v"), &SpineTrackEntry::set_time_scale);
ClassDB::bind_method(D_METHOD("get_alpha"), &SpineTrackEntry::get_alpha); ClassDB::bind_method(D_METHOD("get_alpha"), &SpineTrackEntry::get_alpha);
ClassDB::bind_method(D_METHOD("set_alpha", "v"), &SpineTrackEntry::set_alpha); ClassDB::bind_method(D_METHOD("set_alpha", "v"), &SpineTrackEntry::set_alpha);
ClassDB::bind_method(D_METHOD("get_event_threshold"), &SpineTrackEntry::get_event_threshold); ClassDB::bind_method(D_METHOD("get_event_threshold"), &SpineTrackEntry::get_event_threshold);
ClassDB::bind_method(D_METHOD("set_event_threshold", "v"), &SpineTrackEntry::set_event_threshold); ClassDB::bind_method(D_METHOD("set_event_threshold", "v"), &SpineTrackEntry::set_event_threshold);
ClassDB::bind_method(D_METHOD("get_attachment_threshold"), &SpineTrackEntry::get_attachment_threshold); ClassDB::bind_method(D_METHOD("get_attachment_threshold"), &SpineTrackEntry::get_attachment_threshold);
ClassDB::bind_method(D_METHOD("set_attachment_threshold", "v"), &SpineTrackEntry::set_attachment_threshold); ClassDB::bind_method(D_METHOD("set_attachment_threshold", "v"), &SpineTrackEntry::set_attachment_threshold);
ClassDB::bind_method(D_METHOD("get_draw_order_threshold"), &SpineTrackEntry::get_draw_order_threshold); ClassDB::bind_method(D_METHOD("get_draw_order_threshold"), &SpineTrackEntry::get_draw_order_threshold);
ClassDB::bind_method(D_METHOD("set_draw_order_threshold", "v"), &SpineTrackEntry::set_draw_order_threshold); ClassDB::bind_method(D_METHOD("set_draw_order_threshold", "v"), &SpineTrackEntry::set_draw_order_threshold);
ClassDB::bind_method(D_METHOD("get_next"), &SpineTrackEntry::get_next); ClassDB::bind_method(D_METHOD("get_next"), &SpineTrackEntry::get_next);
ClassDB::bind_method(D_METHOD("is_complete"), &SpineTrackEntry::is_complete); ClassDB::bind_method(D_METHOD("is_complete"), &SpineTrackEntry::is_complete);
ClassDB::bind_method(D_METHOD("get_mix_time"), &SpineTrackEntry::get_mix_time); ClassDB::bind_method(D_METHOD("get_mix_time"), &SpineTrackEntry::get_mix_time);
ClassDB::bind_method(D_METHOD("set_mix_time", "v"), &SpineTrackEntry::set_mix_time); ClassDB::bind_method(D_METHOD("set_mix_time", "v"), &SpineTrackEntry::set_mix_time);
ClassDB::bind_method(D_METHOD("get_mix_duration"), &SpineTrackEntry::get_mix_duration); ClassDB::bind_method(D_METHOD("get_mix_duration"), &SpineTrackEntry::get_mix_duration);
ClassDB::bind_method(D_METHOD("set_mix_duration", "v"), &SpineTrackEntry::set_mix_duration); ClassDB::bind_method(D_METHOD("set_mix_duration", "v"), &SpineTrackEntry::set_mix_duration);
ClassDB::bind_method(D_METHOD("get_mix_blend"), &SpineTrackEntry::get_mix_blend); ClassDB::bind_method(D_METHOD("get_mix_blend"), &SpineTrackEntry::get_mix_blend);
ClassDB::bind_method(D_METHOD("set_mix_blend", "v"), &SpineTrackEntry::set_mix_blend); ClassDB::bind_method(D_METHOD("set_mix_blend", "v"), &SpineTrackEntry::set_mix_blend);
ClassDB::bind_method(D_METHOD("get_mixing_from"), &SpineTrackEntry::get_mixing_from); ClassDB::bind_method(D_METHOD("get_mixing_from"), &SpineTrackEntry::get_mixing_from);
ClassDB::bind_method(D_METHOD("get_mixing_to"), &SpineTrackEntry::get_mixing_to); ClassDB::bind_method(D_METHOD("get_mixing_to"), &SpineTrackEntry::get_mixing_to);
ClassDB::bind_method(D_METHOD("reset_rotation_directions"), &SpineTrackEntry::reset_rotation_directions); ClassDB::bind_method(D_METHOD("reset_rotation_directions"), &SpineTrackEntry::reset_rotation_directions);
ClassDB::bind_method(D_METHOD("get_track_complete"), &SpineTrackEntry::get_track_complete);
BIND_ENUM_CONSTANT(MIXBLEND_SETUP);
BIND_ENUM_CONSTANT(MIXBLEND_FIRST);
BIND_ENUM_CONSTANT(MIXBLEND_REPLACE);
BIND_ENUM_CONSTANT(MIXBLEND_ADD);
} }
SpineTrackEntry::SpineTrackEntry() : track_entry(NULL) {} SpineTrackEntry::SpineTrackEntry() : track_entry(nullptr) {
SpineTrackEntry::~SpineTrackEntry() {} }
int SpineTrackEntry::get_track_index() { int SpineTrackEntry::get_track_index() {
SPINE_CHECK(track_entry, 0)
return track_entry->getTrackIndex(); return track_entry->getTrackIndex();
} }
Ref<SpineAnimation> SpineTrackEntry::get_animation() { Ref<SpineAnimation> SpineTrackEntry::get_animation() {
Ref<SpineAnimation> gd_anim(memnew(SpineAnimation)); SPINE_CHECK(track_entry, nullptr)
auto anim = track_entry->getAnimation(); auto animation = track_entry->getAnimation();
if (anim == NULL) return NULL; if (!animation) return nullptr;
gd_anim->set_spine_object(anim); Ref<SpineAnimation> animation_ref(memnew(SpineAnimation));
return gd_anim; animation_ref->set_spine_object(animation);
return animation_ref;
}
Ref<SpineTrackEntry> SpineTrackEntry::get_previous() {
SPINE_CHECK(track_entry, nullptr)
auto previous = track_entry->getPrevious();
if (!previous) return nullptr;
Ref<SpineTrackEntry> previous_ref(memnew(SpineTrackEntry));
previous_ref->set_spine_object(previous);
return previous_ref;
} }
bool SpineTrackEntry::get_loop() { bool SpineTrackEntry::get_loop() {
SPINE_CHECK(track_entry, false)
return track_entry->getLoop(); return track_entry->getLoop();
} }
void SpineTrackEntry::set_loop(bool v) { void SpineTrackEntry::set_loop(bool v) {
SPINE_CHECK(track_entry,)
track_entry->setLoop(v); track_entry->setLoop(v);
} }
bool SpineTrackEntry::get_hold_previous() { bool SpineTrackEntry::get_hold_previous() {
SPINE_CHECK(track_entry, false)
return track_entry->getHoldPrevious(); return track_entry->getHoldPrevious();
} }
void SpineTrackEntry::set_hold_previous(bool v) { void SpineTrackEntry::set_hold_previous(bool v) {
SPINE_CHECK(track_entry,)
track_entry->setHoldPrevious(v); track_entry->setHoldPrevious(v);
} }
float SpineTrackEntry::get_delay() {
return track_entry->getDelay();
}
void SpineTrackEntry::set_delay(float v) {
track_entry->setDelay(v);
}
float SpineTrackEntry::get_track_time() {
return track_entry->getTrackTime();
}
void SpineTrackEntry::set_track_time(float v) {
track_entry->setTrackTime(v);
}
float SpineTrackEntry::get_track_end() {
return track_entry->getTrackEnd();
}
void SpineTrackEntry::set_track_end(float v) {
track_entry->setTrackEnd(v);
}
float SpineTrackEntry::get_animation_start() {
return track_entry->getAnimationStart();
}
void SpineTrackEntry::set_animation_start(float v) {
track_entry->setAnimationStart(v);
}
float SpineTrackEntry::get_animation_last() {
return track_entry->getAnimationLast();
}
void SpineTrackEntry::set_animation_last(float v) {
track_entry->setAnimationLast(v);
}
float SpineTrackEntry::get_animation_time() {
return track_entry->getAnimationTime();
}
float SpineTrackEntry::get_time_scale() {
return track_entry->getTimeScale();
}
void SpineTrackEntry::set_time_scale(float v) {
track_entry->setTimeScale(v);
}
float SpineTrackEntry::get_alpha() {
return track_entry->getAlpha();
}
void SpineTrackEntry::set_alpha(float v) {
track_entry->setAlpha(v);
}
float SpineTrackEntry::get_event_threshold() {
return track_entry->getEventThreshold();
}
void SpineTrackEntry::set_event_threshold(float v) {
track_entry->setEventThreshold(v);
}
float SpineTrackEntry::get_attachment_threshold() {
return track_entry->getAttachmentThreshold();
}
void SpineTrackEntry::set_attachment_threshold(float v) {
track_entry->setAttachmentThreshold(v);
}
float SpineTrackEntry::get_draw_order_threshold() {
return track_entry->getDrawOrderThreshold();
}
void SpineTrackEntry::set_draw_order_threshold(float v) {
track_entry->setDrawOrderThreshold(v);
}
Ref<SpineTrackEntry> SpineTrackEntry::get_next() {
Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
auto entry = track_entry->getNext();
if (entry == NULL) return NULL;
gd_entry->set_spine_object(entry);
return gd_entry;
}
bool SpineTrackEntry::is_complete() {
return track_entry->isComplete();
}
float SpineTrackEntry::get_mix_time() {
return track_entry->getMixTime();
}
void SpineTrackEntry::set_mix_time(float v) {
track_entry->setMixTime(v);
}
float SpineTrackEntry::get_mix_duration() {
return track_entry->getMixDuration();
}
void SpineTrackEntry::set_mix_duration(float v) {
track_entry->setMixDuration(v);
}
SpineTrackEntry::MixBlend SpineTrackEntry::get_mix_blend() {
int mb = track_entry->getMixBlend();
return (MixBlend) mb;
}
void SpineTrackEntry::set_mix_blend(SpineTrackEntry::MixBlend v) {
int mb = (int) v;
track_entry->setMixBlend((spine::MixBlend) mb);
}
Ref<SpineTrackEntry> SpineTrackEntry::get_mixing_from() {
Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
auto entry = track_entry->getMixingFrom();
if (entry == NULL) return NULL;
gd_entry->set_spine_object(entry);
return gd_entry;
}
Ref<SpineTrackEntry> SpineTrackEntry::get_mixing_to() {
Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
auto entry = track_entry->getMixingTo();
if (entry == NULL) return NULL;
gd_entry->set_spine_object(entry);
return gd_entry;
}
void SpineTrackEntry::reset_rotation_directions() {
track_entry->resetRotationDirections();
}
bool SpineTrackEntry::get_reverse() { bool SpineTrackEntry::get_reverse() {
SPINE_CHECK(track_entry, false)
return track_entry->getReverse(); return track_entry->getReverse();
} }
void SpineTrackEntry::set_reverse(bool v) { void SpineTrackEntry::set_reverse(bool v) {
SPINE_CHECK(track_entry,)
track_entry->setReverse(v); track_entry->setReverse(v);
} }
bool SpineTrackEntry::get_shortest_rotation() {
SPINE_CHECK(track_entry, false)
return track_entry->getShortestRotation();
}
void SpineTrackEntry::set_shortest_rotation(bool v) {
SPINE_CHECK(track_entry,)
track_entry->setShortestRotation(v);
}
float SpineTrackEntry::get_delay() {
SPINE_CHECK(track_entry, 0)
return track_entry->getDelay();
}
void SpineTrackEntry::set_delay(float v) {
SPINE_CHECK(track_entry,)
track_entry->setDelay(v);
}
float SpineTrackEntry::get_track_time() {
SPINE_CHECK(track_entry, 0)
return track_entry->getTrackTime();
}
void SpineTrackEntry::set_track_time(float v) {
SPINE_CHECK(track_entry,)
track_entry->setTrackTime(v);
}
float SpineTrackEntry::get_track_end() {
SPINE_CHECK(track_entry, 0)
return track_entry->getTrackEnd();
}
void SpineTrackEntry::set_track_end(float v) {
SPINE_CHECK(track_entry,)
track_entry->setTrackEnd(v);
}
float SpineTrackEntry::get_animation_start() {
SPINE_CHECK(track_entry, 0)
return track_entry->getAnimationStart();
}
void SpineTrackEntry::set_animation_start(float v) {
SPINE_CHECK(track_entry,)
track_entry->setAnimationStart(v);
}
float SpineTrackEntry::get_animation_end() {
SPINE_CHECK(track_entry, 0)
return track_entry->getAnimationEnd();
}
void SpineTrackEntry::set_animation_end(float v) {
SPINE_CHECK(track_entry,)
track_entry->setAnimationEnd(v);
}
float SpineTrackEntry::get_animation_last() {
SPINE_CHECK(track_entry, 0)
return track_entry->getAnimationLast();
}
void SpineTrackEntry::set_animation_last(float v) {
SPINE_CHECK(track_entry,)
track_entry->setAnimationLast(v);
}
float SpineTrackEntry::get_animation_time() {
SPINE_CHECK(track_entry, 0)
return track_entry->getAnimationTime();
}
float SpineTrackEntry::get_time_scale() {
SPINE_CHECK(track_entry, 0)
return track_entry->getTimeScale();
}
void SpineTrackEntry::set_time_scale(float v) {
SPINE_CHECK(track_entry,)
track_entry->setTimeScale(v);
}
float SpineTrackEntry::get_alpha() {
SPINE_CHECK(track_entry, 0)
return track_entry->getAlpha();
}
void SpineTrackEntry::set_alpha(float v) {
SPINE_CHECK(track_entry,)
track_entry->setAlpha(v);
}
float SpineTrackEntry::get_event_threshold() {
SPINE_CHECK(track_entry, 0)
return track_entry->getEventThreshold();
}
void SpineTrackEntry::set_event_threshold(float v) {
SPINE_CHECK(track_entry,)
track_entry->setEventThreshold(v);
}
float SpineTrackEntry::get_attachment_threshold() {
SPINE_CHECK(track_entry, 0)
return track_entry->getAttachmentThreshold();
}
void SpineTrackEntry::set_attachment_threshold(float v) {
SPINE_CHECK(track_entry,)
track_entry->setAttachmentThreshold(v);
}
float SpineTrackEntry::get_draw_order_threshold() {
SPINE_CHECK(track_entry, 0)
return track_entry->getDrawOrderThreshold();
}
void SpineTrackEntry::set_draw_order_threshold(float v) {
SPINE_CHECK(track_entry,)
track_entry->setDrawOrderThreshold(v);
}
Ref<SpineTrackEntry> SpineTrackEntry::get_next() {
SPINE_CHECK(track_entry, nullptr)
auto next = track_entry->getNext();
if (!next) return nullptr;
Ref<SpineTrackEntry> next_ref(memnew(SpineTrackEntry));
next_ref->set_spine_object(next);
return next_ref;
}
bool SpineTrackEntry::is_complete() {
SPINE_CHECK(track_entry, false)
return track_entry->isComplete();
}
float SpineTrackEntry::get_mix_time() {
SPINE_CHECK(track_entry, 0)
return track_entry->getMixTime();
}
void SpineTrackEntry::set_mix_time(float v) {
SPINE_CHECK(track_entry,)
track_entry->setMixTime(v);
}
float SpineTrackEntry::get_mix_duration() {
SPINE_CHECK(track_entry, 0)
return track_entry->getMixDuration();
}
void SpineTrackEntry::set_mix_duration(float v) {
SPINE_CHECK(track_entry,)
track_entry->setMixDuration(v);
}
SpineConstant::MixBlend SpineTrackEntry::get_mix_blend() {
SPINE_CHECK(track_entry, SpineConstant::MixBlend_Setup)
return (SpineConstant::MixBlend)track_entry->getMixBlend();
}
void SpineTrackEntry::set_mix_blend(SpineConstant::MixBlend v) {
SPINE_CHECK(track_entry,)
track_entry->setMixBlend((spine::MixBlend) v);
}
Ref<SpineTrackEntry> SpineTrackEntry::get_mixing_from() {
SPINE_CHECK(track_entry, nullptr)
auto mixing_from = track_entry->getMixingFrom();
if (!mixing_from) return nullptr;
Ref<SpineTrackEntry> mixing_from_ref(memnew(SpineTrackEntry));
mixing_from_ref->set_spine_object(mixing_from);
return mixing_from_ref;
}
Ref<SpineTrackEntry> SpineTrackEntry::get_mixing_to() {
SPINE_CHECK(track_entry, nullptr)
auto mixing_to = track_entry->getMixingTo();
if (!mixing_to) return nullptr;
Ref<SpineTrackEntry> mixing_to_ref(memnew(SpineTrackEntry));
mixing_to_ref->set_spine_object(mixing_to);
return mixing_to_ref;
}
void SpineTrackEntry::reset_rotation_directions() {
SPINE_CHECK(track_entry,)
track_entry->resetRotationDirections();
}
float SpineTrackEntry::get_track_complete() {
SPINE_CHECK(track_entry, 0)
return track_entry->getTrackComplete();
}

View File

@ -30,11 +30,9 @@
#ifndef GODOT_SPINETRACKENTRY_H #ifndef GODOT_SPINETRACKENTRY_H
#define GODOT_SPINETRACKENTRY_H #define GODOT_SPINETRACKENTRY_H
#include "core/variant_parser.h"
#include <spine/spine.h>
#include "SpineAnimation.h" #include "SpineAnimation.h"
#include "SpineConstant.h"
#include <spine/AnimationState.h>
class SpineTrackEntry : public Reference { class SpineTrackEntry : public Reference {
GDCLASS(SpineTrackEntry, Reference); GDCLASS(SpineTrackEntry, Reference);
@ -47,65 +45,76 @@ private:
public: public:
SpineTrackEntry(); SpineTrackEntry();
~SpineTrackEntry();
inline void set_spine_object(spine::TrackEntry *t) { void set_spine_object(spine::TrackEntry *_track_entry) { this->track_entry = _track_entry; }
track_entry = t; spine::TrackEntry *get_spine_object() { return track_entry; }
}
inline spine::TrackEntry *get_spine_object() {
return track_entry;
}
enum MixBlend {
MIXBLEND_SETUP = 0,
MIXBLEND_FIRST,
MIXBLEND_REPLACE,
MIXBLEND_ADD
};
int get_track_index(); int get_track_index();
Ref<SpineAnimation> get_animation(); Ref<SpineAnimation> get_animation();
Ref<SpineTrackEntry> get_previous();
bool get_loop(); bool get_loop();
void set_loop(bool v); void set_loop(bool v);
bool get_hold_previous(); bool get_hold_previous();
void set_hold_previous(bool v); void set_hold_previous(bool v);
bool get_reverse(); bool get_reverse();
void set_reverse(bool v); void set_reverse(bool v);
bool get_shortest_rotation();
void set_shortest_rotation(bool v);
float get_delay(); float get_delay();
void set_delay(float v); void set_delay(float v);
float get_track_time(); float get_track_time();
void set_track_time(float v); void set_track_time(float v);
float get_track_end(); float get_track_end();
void set_track_end(float v); void set_track_end(float v);
float get_animation_start(); float get_animation_start();
void set_animation_start(float v); void set_animation_start(float v);
float get_animation_end();
void set_animation_end(float v);
float get_animation_last(); float get_animation_last();
void set_animation_last(float v); void set_animation_last(float v);
float get_animation_time(); float get_animation_time();
float get_time_scale(); float get_time_scale();
void set_time_scale(float v); void set_time_scale(float v);
float get_alpha(); float get_alpha();
void set_alpha(float v); void set_alpha(float v);
float get_event_threshold(); float get_event_threshold();
void set_event_threshold(float v); void set_event_threshold(float v);
float get_attachment_threshold(); float get_attachment_threshold();
void set_attachment_threshold(float v); void set_attachment_threshold(float v);
float get_draw_order_threshold(); float get_draw_order_threshold();
void set_draw_order_threshold(float v); void set_draw_order_threshold(float v);
Ref<SpineTrackEntry> get_next(); Ref<SpineTrackEntry> get_next();
@ -113,19 +122,24 @@ public:
bool is_complete(); bool is_complete();
float get_mix_time(); float get_mix_time();
void set_mix_time(float v); void set_mix_time(float v);
float get_mix_duration(); float get_mix_duration();
void set_mix_duration(float v); void set_mix_duration(float v);
MixBlend get_mix_blend(); SpineConstant::MixBlend get_mix_blend();
void set_mix_blend(MixBlend v);
void set_mix_blend(SpineConstant::MixBlend v);
Ref<SpineTrackEntry> get_mixing_from(); Ref<SpineTrackEntry> get_mixing_from();
Ref<SpineTrackEntry> get_mixing_to(); Ref<SpineTrackEntry> get_mixing_to();
void reset_rotation_directions(); void reset_rotation_directions();
float get_track_complete();
}; };
VARIANT_ENUM_CAST(SpineTrackEntry::MixBlend);
#endif//GODOT_SPINETRACKENTRY_H #endif//GODOT_SPINETRACKENTRY_H