mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
Merge pull request #2996 from EsotericSoftware/4.2-godot-fixes-2899-2980-2985
[godot] Addresses #2899, #2980, #2985 - [godot] Mismatched registration in Godot bindings causing crash on exit #2899 - [godot] Double-clicking a .json file in the FileSystem dock causes the editor to crash #2985 - [Godot] Engine crash on skeleton data change #2980
This commit is contained in:
commit
de8ae9ef6b
@ -2,7 +2,7 @@ set -euo pipefail
|
|||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
# Download and install the Vulkan SDK.
|
# Download and install the Vulkan SDK.
|
||||||
curl -L "https://sdk.lunarg.com/sdk/download/1.3.268.0/mac/vulkansdk-macos-1.3.268.0.dmg" -o /tmp/vulkan-sdk.dmg
|
curl -L "https://sdk.lunarg.com/sdk/download/1.3.275.0/mac/vulkansdk-macos-1.3.275.0.dmg" -o /tmp/vulkan-sdk.dmg
|
||||||
hdiutil attach /tmp/vulkan-sdk.dmg -mountpoint /Volumes/vulkan-sdk
|
hdiutil attach /tmp/vulkan-sdk.dmg -mountpoint /Volumes/vulkan-sdk
|
||||||
/Volumes/vulkan-sdk/InstallVulkan.app/Contents/MacOS/InstallVulkan \
|
/Volumes/vulkan-sdk/InstallVulkan.app/Contents/MacOS/InstallVulkan \
|
||||||
--accept-licenses --default-answer --confirm-command install
|
--accept-licenses --default-answer --confirm-command install
|
||||||
|
|||||||
@ -233,6 +233,8 @@ SpineSkeletonDataResource::SpineSkeletonDataResource()
|
|||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
EditorFileSystem *efs = get_editor_file_system();
|
EditorFileSystem *efs = get_editor_file_system();
|
||||||
if (efs) {
|
if (efs) {
|
||||||
|
// Store the ObjectID for safe validation in destructor
|
||||||
|
editor_file_system_id = efs->get_instance_id();
|
||||||
efs->connect("resources_reimported", callable_mp(this, &SpineSkeletonDataResource::_on_resources_reimported));
|
efs->connect("resources_reimported", callable_mp(this, &SpineSkeletonDataResource::_on_resources_reimported));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,6 +242,8 @@ SpineSkeletonDataResource::SpineSkeletonDataResource()
|
|||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
EditorFileSystem *efs = EditorFileSystem::get_singleton();
|
EditorFileSystem *efs = EditorFileSystem::get_singleton();
|
||||||
if (efs) {
|
if (efs) {
|
||||||
|
// Store the ObjectID for safe validation in destructor
|
||||||
|
editor_file_system_id = efs->get_instance_id();
|
||||||
efs->connect("resources_reimported", this, "_on_resources_reimported");
|
efs->connect("resources_reimported", this, "_on_resources_reimported");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -251,14 +255,14 @@ SpineSkeletonDataResource::~SpineSkeletonDataResource() {
|
|||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
#if VERSION_MAJOR > 3
|
#if VERSION_MAJOR > 3
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
EditorFileSystem *efs = get_editor_file_system();
|
EditorFileSystem *efs = Object::cast_to<EditorFileSystem>(ObjectDB::get_instance(editor_file_system_id));
|
||||||
if (efs && efs->is_connected("resources_reimported", callable_mp(this, &SpineSkeletonDataResource::_on_resources_reimported))) {
|
if (efs && efs->is_connected("resources_reimported", callable_mp(this, &SpineSkeletonDataResource::_on_resources_reimported))) {
|
||||||
efs->disconnect("resources_reimported", callable_mp(this, &SpineSkeletonDataResource::_on_resources_reimported));
|
efs->disconnect("resources_reimported", callable_mp(this, &SpineSkeletonDataResource::_on_resources_reimported));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
EditorFileSystem *efs = EditorFileSystem::get_singleton();
|
EditorFileSystem *efs = Object::cast_to<EditorFileSystem>(ObjectDB::get_instance(editor_file_system_id));
|
||||||
if (efs && efs->is_connected("resources_reimported", this, "_on_resources_reimported")) {
|
if (efs && efs->is_connected("resources_reimported", this, "_on_resources_reimported")) {
|
||||||
efs->disconnect("resources_reimported", this, "_on_resources_reimported");
|
efs->disconnect("resources_reimported", this, "_on_resources_reimported");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,6 +82,10 @@ private:
|
|||||||
spine::SkeletonData *skeleton_data;
|
spine::SkeletonData *skeleton_data;
|
||||||
spine::AnimationStateData *animation_state_data;
|
spine::AnimationStateData *animation_state_data;
|
||||||
|
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
ObjectID editor_file_system_id;
|
||||||
|
#endif
|
||||||
|
|
||||||
void update_skeleton_data();
|
void update_skeleton_data();
|
||||||
|
|
||||||
#ifdef SPINE_GODOT_EXTENSION
|
#ifdef SPINE_GODOT_EXTENSION
|
||||||
|
|||||||
@ -45,7 +45,9 @@ void SpineSkin::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("get_attachments"), &SpineSkin::get_attachments);
|
ClassDB::bind_method(D_METHOD("get_attachments"), &SpineSkin::get_attachments);
|
||||||
ClassDB::bind_method(D_METHOD("get_bones"), &SpineSkin::get_bones);
|
ClassDB::bind_method(D_METHOD("get_bones"), &SpineSkin::get_bones);
|
||||||
ClassDB::bind_method(D_METHOD("get_constraints"), &SpineSkin::get_constraints);
|
ClassDB::bind_method(D_METHOD("get_constraints"), &SpineSkin::get_constraints);
|
||||||
|
#if VERSION_MAJOR >= 4
|
||||||
ClassDB::bind_method(D_METHOD("init", "name", "sprite"), &SpineSkin::init);
|
ClassDB::bind_method(D_METHOD("init", "name", "sprite"), &SpineSkin::init);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SpineSkin::SpineSkin() : owns_skin(false) {
|
SpineSkin::SpineSkin() : owns_skin(false) {
|
||||||
|
|||||||
@ -88,6 +88,12 @@ void initialize_spine_godot_module(ModuleInitializationLevel level) {
|
|||||||
EditorPlugins::add_plugin_class(StringName("SpineEditorPlugin"));
|
EditorPlugins::add_plugin_class(StringName("SpineEditorPlugin"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if (level == MODULE_INITIALIZATION_LEVEL_CORE) {
|
||||||
|
GDREGISTER_CLASS(SpineAtlasResourceFormatLoader);
|
||||||
|
GDREGISTER_CLASS(SpineAtlasResourceFormatSaver);
|
||||||
|
GDREGISTER_CLASS(SpineSkeletonFileResourceFormatLoader);
|
||||||
|
GDREGISTER_CLASS(SpineSkeletonFileResourceFormatSaver);
|
||||||
|
}
|
||||||
if (level != MODULE_INITIALIZATION_LEVEL_SCENE) return;
|
if (level != MODULE_INITIALIZATION_LEVEL_SCENE) return;
|
||||||
#else
|
#else
|
||||||
#if VERSION_MAJOR > 3
|
#if VERSION_MAJOR > 3
|
||||||
@ -110,10 +116,12 @@ void register_spine_godot_types() {
|
|||||||
#endif
|
#endif
|
||||||
spine::Bone::setYDown(true);
|
spine::Bone::setYDown(true);
|
||||||
|
|
||||||
|
#ifndef SPINE_GODOT_EXTENSION
|
||||||
GDREGISTER_CLASS(SpineAtlasResourceFormatLoader);
|
GDREGISTER_CLASS(SpineAtlasResourceFormatLoader);
|
||||||
GDREGISTER_CLASS(SpineAtlasResourceFormatSaver);
|
GDREGISTER_CLASS(SpineAtlasResourceFormatSaver);
|
||||||
GDREGISTER_CLASS(SpineSkeletonFileResourceFormatLoader);
|
GDREGISTER_CLASS(SpineSkeletonFileResourceFormatLoader);
|
||||||
GDREGISTER_CLASS(SpineSkeletonFileResourceFormatSaver);
|
GDREGISTER_CLASS(SpineSkeletonFileResourceFormatSaver);
|
||||||
|
#endif
|
||||||
|
|
||||||
GDREGISTER_CLASS(SpineObjectWrapper);
|
GDREGISTER_CLASS(SpineObjectWrapper);
|
||||||
GDREGISTER_CLASS(SpineAtlasResource);
|
GDREGISTER_CLASS(SpineAtlasResource);
|
||||||
@ -223,7 +231,7 @@ extern "C" GDExtensionBool GDE_EXPORT spine_godot_library_init(GDExtensionInterf
|
|||||||
GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
|
GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
|
||||||
init_obj.register_initializer(initialize_spine_godot_module);
|
init_obj.register_initializer(initialize_spine_godot_module);
|
||||||
init_obj.register_terminator(uninitialize_spine_godot_module);
|
init_obj.register_terminator(uninitialize_spine_godot_module);
|
||||||
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
|
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_CORE);
|
||||||
return init_obj.init();
|
return init_obj.init();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user