mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-15 11:31:37 +08:00
[godot] Edit rect support.
This commit is contained in:
parent
7e39e59d50
commit
5b8ed48855
@ -41,9 +41,9 @@ public:
|
||||
void set_skeleton_file_res(const Ref<SpineSkeletonFileResource> &skeleton_file);
|
||||
Ref<SpineSkeletonFileResource> get_skeleton_file_res();
|
||||
|
||||
inline spine::SkeletonData *get_skeleton_data() { return skeleton_data; }
|
||||
inline spine::SkeletonData *get_skeleton_data() const { return skeleton_data; }
|
||||
|
||||
inline spine::AnimationStateData *get_animation_state_data() { return animation_state_data; }
|
||||
inline spine::AnimationStateData *get_animation_state_data() const { return animation_state_data; }
|
||||
|
||||
void get_animation_names(Vector<String> &animation_names) const;
|
||||
|
||||
|
||||
@ -593,3 +593,18 @@ bool SpineNewSprite::_set(const StringName &p_property, const Variant &p_value)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
Rect2 SpineNewSprite::_edit_get_rect() const {
|
||||
if (skeleton_data_res.is_valid() && skeleton_data_res->is_skeleton_data_loaded()) {
|
||||
auto data = skeleton_data_res->get_skeleton_data();
|
||||
return Rect2(data->getX(), data->getY() - data->getHeight(), data->getWidth(), data->getHeight());
|
||||
}
|
||||
|
||||
return Node2D::_edit_get_rect();
|
||||
}
|
||||
|
||||
bool SpineNewSprite::_edit_use_rect() const {
|
||||
return skeleton_data_res.is_valid() && skeleton_data_res->is_skeleton_data_loaded();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -111,6 +111,11 @@ public:
|
||||
|
||||
ProcessMode get_process_mode();
|
||||
void set_process_mode(ProcessMode v);
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual Rect2 _edit_get_rect() const;
|
||||
virtual bool _edit_use_rect() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(SpineNewSprite::ProcessMode);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user