mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '4.1' into 4.2-beta
This commit is contained in:
commit
5eb9667d38
@ -21,6 +21,10 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if((${SPINE_SFML}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-sfml"))
|
if((${SPINE_SFML}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-sfml"))
|
||||||
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES x86_64)
|
||||||
|
set(ONLY_ACTIVE_ARCH NO)
|
||||||
|
endif()
|
||||||
add_subdirectory(spine-c)
|
add_subdirectory(spine-c)
|
||||||
add_subdirectory(spine-sfml/c)
|
add_subdirectory(spine-sfml/c)
|
||||||
add_subdirectory(spine-cpp)
|
add_subdirectory(spine-cpp)
|
||||||
|
|||||||
@ -148,7 +148,7 @@ void SpineSprite::_bind_methods() {
|
|||||||
// Filled in in _get_property_list()
|
// Filled in in _get_property_list()
|
||||||
}
|
}
|
||||||
|
|
||||||
SpineSprite::SpineSprite() : update_mode(SpineConstant::UpdateMode_Process), preview_animation("-- Empty --"), preview_frame(false), preview_time(0), skeleton_clipper(nullptr), modified_bones(false) {
|
SpineSprite::SpineSprite() : update_mode(SpineConstant::UpdateMode_Process), preview_skin("Default"), preview_animation("-- Empty --"), preview_frame(false), preview_time(0), skeleton_clipper(nullptr), modified_bones(false) {
|
||||||
skeleton_clipper = new spine::SkeletonClipping();
|
skeleton_clipper = new spine::SkeletonClipping();
|
||||||
|
|
||||||
// One material per blend mode, shared across all sprites.
|
// One material per blend mode, shared across all sprites.
|
||||||
@ -346,9 +346,19 @@ void SpineSprite::_notification(int what) {
|
|||||||
void SpineSprite::_get_property_list(List<PropertyInfo> *list) const {
|
void SpineSprite::_get_property_list(List<PropertyInfo> *list) const {
|
||||||
if (!skeleton_data_res.is_valid() || !skeleton_data_res->is_skeleton_data_loaded()) return;
|
if (!skeleton_data_res.is_valid() || !skeleton_data_res->is_skeleton_data_loaded()) return;
|
||||||
Vector<String> animation_names;
|
Vector<String> animation_names;
|
||||||
|
Vector<String> skin_names;
|
||||||
skeleton_data_res->get_animation_names(animation_names);
|
skeleton_data_res->get_animation_names(animation_names);
|
||||||
|
skeleton_data_res->get_skin_names(skin_names);
|
||||||
animation_names.insert(0, "-- Empty --");
|
animation_names.insert(0, "-- Empty --");
|
||||||
|
|
||||||
|
PropertyInfo preview_skin_property;
|
||||||
|
preview_skin_property.name = "preview_skin";
|
||||||
|
preview_skin_property.type = Variant::STRING;
|
||||||
|
preview_skin_property.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE;
|
||||||
|
preview_skin_property.hint_string = String(",").join(skin_names);
|
||||||
|
preview_skin_property.hint = PROPERTY_HINT_ENUM;
|
||||||
|
list->push_back(preview_skin_property);
|
||||||
|
|
||||||
PropertyInfo preview_anim_property;
|
PropertyInfo preview_anim_property;
|
||||||
preview_anim_property.name = "preview_animation";
|
preview_anim_property.name = "preview_animation";
|
||||||
preview_anim_property.type = Variant::STRING;
|
preview_anim_property.type = Variant::STRING;
|
||||||
@ -378,6 +388,11 @@ void SpineSprite::_get_property_list(List<PropertyInfo> *list) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SpineSprite::_get(const StringName &property, Variant &value) const {
|
bool SpineSprite::_get(const StringName &property, Variant &value) const {
|
||||||
|
if (property == "preview_skin") {
|
||||||
|
value = preview_skin;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (property == "preview_animation") {
|
if (property == "preview_animation") {
|
||||||
value = preview_animation;
|
value = preview_animation;
|
||||||
return true;
|
return true;
|
||||||
@ -395,8 +410,14 @@ bool SpineSprite::_get(const StringName &property, Variant &value) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_preview_animation(SpineSprite *sprite, const String &animation, bool frame, float time) {
|
static void update_preview_animation(SpineSprite *sprite, const String &skin, const String &animation, bool frame, float time) {
|
||||||
if (!sprite->get_skeleton().is_valid()) return;
|
if (!sprite->get_skeleton().is_valid()) return;
|
||||||
|
|
||||||
|
if (EMPTY(skin) || skin == "Default") {
|
||||||
|
sprite->get_skeleton()->set_skin(nullptr);
|
||||||
|
} else {
|
||||||
|
sprite->get_skeleton()->set_skin_by_name(skin);
|
||||||
|
}
|
||||||
sprite->get_skeleton()->set_to_setup_pose();
|
sprite->get_skeleton()->set_to_setup_pose();
|
||||||
if (EMPTY(animation) || animation == "-- Empty --") {
|
if (EMPTY(animation) || animation == "-- Empty --") {
|
||||||
sprite->get_animation_state()->set_empty_animation(0, 0);
|
sprite->get_animation_state()->set_empty_animation(0, 0);
|
||||||
@ -412,22 +433,29 @@ static void update_preview_animation(SpineSprite *sprite, const String &animatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SpineSprite::_set(const StringName &property, const Variant &value) {
|
bool SpineSprite::_set(const StringName &property, const Variant &value) {
|
||||||
|
if (property == "preview_skin") {
|
||||||
|
preview_skin = value;
|
||||||
|
update_preview_animation(this, preview_skin, preview_animation, preview_frame, preview_time);
|
||||||
|
NOTIFY_PROPERTY_LIST_CHANGED();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (property == "preview_animation") {
|
if (property == "preview_animation") {
|
||||||
preview_animation = value;
|
preview_animation = value;
|
||||||
update_preview_animation(this, preview_animation, preview_frame, preview_time);
|
update_preview_animation(this, preview_skin, preview_animation, preview_frame, preview_time);
|
||||||
NOTIFY_PROPERTY_LIST_CHANGED();
|
NOTIFY_PROPERTY_LIST_CHANGED();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property == "preview_frame") {
|
if (property == "preview_frame") {
|
||||||
preview_frame = value;
|
preview_frame = value;
|
||||||
update_preview_animation(this, preview_animation, preview_frame, preview_time);
|
update_preview_animation(this, preview_skin, preview_animation, preview_frame, preview_time);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property == "preview_time") {
|
if (property == "preview_time") {
|
||||||
preview_time = value;
|
preview_time = value;
|
||||||
update_preview_animation(this, preview_animation, preview_frame, preview_time);
|
update_preview_animation(this, preview_skin, preview_animation, preview_frame, preview_time);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,7 @@ protected:
|
|||||||
Ref<SpineAnimationState> animation_state;
|
Ref<SpineAnimationState> animation_state;
|
||||||
SpineConstant::UpdateMode update_mode;
|
SpineConstant::UpdateMode update_mode;
|
||||||
|
|
||||||
|
String preview_skin;
|
||||||
String preview_animation;
|
String preview_animation;
|
||||||
bool preview_frame;
|
bool preview_frame;
|
||||||
float preview_time;
|
float preview_time;
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
#
|
#
|
||||||
set(DEPS_DIR "${CMAKE_CURRENT_LIST_DIR}/dependencies/")
|
set(DEPS_DIR "${CMAKE_CURRENT_LIST_DIR}/dependencies/")
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
set(CMAKE_OSX_ARCHITECTURES x86_64)
|
|
||||||
set(ONLY_ACTIVE_ARCH NO)
|
|
||||||
set(SFML_URL "https://www.sfml-dev.org/files/SFML-2.5.1-macOS-clang.tar.gz")
|
set(SFML_URL "https://www.sfml-dev.org/files/SFML-2.5.1-macOS-clang.tar.gz")
|
||||||
set(SFML_DIR ${DEPS_DIR}/SFML-2.5.1-macos-clang)
|
set(SFML_DIR ${DEPS_DIR}/SFML-2.5.1-macos-clang)
|
||||||
if (NOT EXISTS "${SFML_DIR}")
|
if (NOT EXISTS "${SFML_DIR}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user