Formatting

This commit is contained in:
Mario Zechner 2025-11-10 15:43:02 +01:00
parent fba64447bf
commit be2e8ff514
5 changed files with 31 additions and 23 deletions

View File

@ -32,7 +32,7 @@ let package = Package(
.target( .target(
name: "SpineiOSWrapper", name: "SpineiOSWrapper",
dependencies: [ dependencies: [
.target(name: "SpineiOS", condition: .when(platforms: [.iOS, .visionOS, .tvOS, .macCatalyst ])) .target(name: "SpineiOS", condition: .when(platforms: [.iOS, .visionOS, .tvOS, .macCatalyst]))
], ],
path: "spine-ios/Sources/SpineiOSWrapper" path: "spine-ios/Sources/SpineiOSWrapper"
), ),
@ -49,7 +49,7 @@ let package = Package(
path: "spine-ios/Sources/SpineC", path: "spine-ios/Sources/SpineC",
sources: [ sources: [
"src", "src",
"spine" "spine",
], ],
linkerSettings: [ linkerSettings: [
.linkedLibrary("c++") .linkedLibrary("c++")

View File

@ -352,10 +352,10 @@ public class SpineView extends View implements Choreographer.FrameCallback {
this.rendering = rendering; this.rendering = rendering;
} }
/** Load the skeleton from a {@link AndroidSkeletonDrawableLoader}. This method is asynchronous. /** Load the skeleton from a {@link AndroidSkeletonDrawableLoader}. This method is asynchronous. If you want to control the
* If you want to control the loading thread yourself, obtain an {@link AndroidSkeletonDrawable} * loading thread yourself, obtain an {@link AndroidSkeletonDrawable} using
* using {@link AndroidSkeletonDrawable#fromHttp(URL, URL, File)} or another load method, * {@link AndroidSkeletonDrawable#fromHttp(URL, URL, File)} or another load method, then call
* then call {@link SpineView#loadFromDrawable(AndroidSkeletonDrawable)} or * {@link SpineView#loadFromDrawable(AndroidSkeletonDrawable)} or
* {@link SpineView#setSkeletonDrawable(AndroidSkeletonDrawable)}. */ * {@link SpineView#setSkeletonDrawable(AndroidSkeletonDrawable)}. */
public void loadFrom (AndroidSkeletonDrawableLoader loader) { public void loadFrom (AndroidSkeletonDrawableLoader loader) {
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());
@ -365,14 +365,14 @@ public class SpineView extends View implements Choreographer.FrameCallback {
mainHandler.post( () -> { mainHandler.post( () -> {
setSkeletonDrawable(skeletonDrawable); setSkeletonDrawable(skeletonDrawable);
}); });
}catch (Exception e) { } catch (Exception e) {
Log.e("SpineView", "Error loading skeleton", e); Log.e("SpineView", "Error loading skeleton", e);
} }
}); });
backgroundThread.start(); backgroundThread.start();
} }
/** Set the skeleton drawable. Must be called from the main thread.*/ /** Set the skeleton drawable. Must be called from the main thread. */
@MainThread @MainThread
public final void setSkeletonDrawable (@NonNull AndroidSkeletonDrawable skeletonDrawable) { public final void setSkeletonDrawable (@NonNull AndroidSkeletonDrawable skeletonDrawable) {
computedBounds = boundsProvider.computeBounds(skeletonDrawable); computedBounds = boundsProvider.computeBounds(skeletonDrawable);

View File

@ -5,6 +5,5 @@
import FlutterMacOS import FlutterMacOS
import Foundation import Foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
} }

View File

@ -101,6 +101,26 @@ void initialize_spine_godot_module(ModuleInitializationLevel level) {
GDREGISTER_CLASS(SpineEditorPlugin); GDREGISTER_CLASS(SpineEditorPlugin);
EditorPlugins::add_plugin_class(StringName("SpineEditorPlugin")); EditorPlugins::add_plugin_class(StringName("SpineEditorPlugin"));
#endif #endif
return;
}
if (level == MODULE_INITIALIZATION_LEVEL_CORE) {
GDREGISTER_CLASS(SpineAtlasResourceFormatLoader);
GDREGISTER_CLASS(SpineAtlasResourceFormatSaver);
GDREGISTER_CLASS(SpineSkeletonFileResourceFormatLoader);
GDREGISTER_CLASS(SpineSkeletonFileResourceFormatSaver);
atlas_loader = memnew(SpineAtlasResourceFormatLoader);
ResourceLoader::get_singleton()->add_resource_format_loader(atlas_loader);
atlas_saver = memnew(SpineAtlasResourceFormatSaver);
ResourceSaver::get_singleton()->add_resource_format_saver(atlas_saver);
skeleton_file_loader = memnew(SpineSkeletonFileResourceFormatLoader);
ResourceLoader::get_singleton()->add_resource_format_loader(skeleton_file_loader);
skeleton_file_saver = memnew(SpineSkeletonFileResourceFormatSaver);
ResourceSaver::get_singleton()->add_resource_format_saver(skeleton_file_saver);
return;
} }
if (level != MODULE_INITIALIZATION_LEVEL_SCENE) return; if (level != MODULE_INITIALIZATION_LEVEL_SCENE) return;
#else #else
@ -124,10 +144,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);
@ -177,19 +199,7 @@ void register_spine_godot_types() {
GDREGISTER_CLASS(SpineAnimationTrack); GDREGISTER_CLASS(SpineAnimationTrack);
#endif #endif
#ifdef SPINE_GODOT_EXTENSION #ifndef SPINE_GODOT_EXTENSION
atlas_loader = memnew(SpineAtlasResourceFormatLoader);
ResourceLoader::get_singleton()->add_resource_format_loader(atlas_loader);
atlas_saver = memnew(SpineAtlasResourceFormatSaver);
ResourceSaver::get_singleton()->add_resource_format_saver(atlas_saver);
skeleton_file_loader = memnew(SpineSkeletonFileResourceFormatLoader);
ResourceLoader::get_singleton()->add_resource_format_loader(skeleton_file_loader);
skeleton_file_saver = memnew(SpineSkeletonFileResourceFormatSaver);
ResourceSaver::get_singleton()->add_resource_format_saver(skeleton_file_saver);
#else
#if VERSION_MAJOR > 3 #if VERSION_MAJOR > 3
atlas_loader = memnew(SpineAtlasResourceFormatLoader); atlas_loader = memnew(SpineAtlasResourceFormatLoader);
ResourceLoader::add_resource_format_loader(atlas_loader); ResourceLoader::add_resource_format_loader(atlas_loader);

View File

@ -4,4 +4,3 @@
// //
// Created by pbk20191 on 11/7/25. // Created by pbk20191 on 11/7/25.
// //