From b06b06c7c2fe6adecb24adc7434c56e1e5648761 Mon Sep 17 00:00:00 2001 From: badlogic Date: Thu, 21 Apr 2022 16:49:56 +0200 Subject: [PATCH] [godot] Refactored examples, added listener example, fixed listener signal names. --- spine-godot/example/assets/footstep.ogg | Bin 0 -> 9071 bytes .../example/assets/footstep.ogg.import | 15 ++++++ .../assets/spineboy/spinebody-data-res.tres | 1 + .../helloworld.tscn | 6 ++- .../spineboy-helloworld.gd | 0 .../animation-state-listeners.gd | 37 +++++++++++++ .../animation-state-listeners.tscn | 16 ++++++ .../mix-and-match.gd | 0 .../mix-and-match.tscn | 2 +- .../simple-input.tscn | 2 +- .../spineboy-simple-input.gd | 0 spine-godot/example/project.godot | 2 +- spine-godot/spine_godot/SpineSprite.cpp | 50 +++++++++--------- 13 files changed, 101 insertions(+), 30 deletions(-) create mode 100644 spine-godot/example/assets/footstep.ogg create mode 100644 spine-godot/example/assets/footstep.ogg.import rename spine-godot/example/examples/{helloworld => 01-helloworld}/helloworld.tscn (55%) rename spine-godot/example/examples/{helloworld => 01-helloworld}/spineboy-helloworld.gd (100%) create mode 100644 spine-godot/example/examples/02-animation-state-listeners/animation-state-listeners.gd create mode 100644 spine-godot/example/examples/02-animation-state-listeners/animation-state-listeners.tscn rename spine-godot/example/examples/{mix-and-match => 03-mix-and-match}/mix-and-match.gd (100%) rename spine-godot/example/examples/{mix-and-match => 03-mix-and-match}/mix-and-match.tscn (80%) rename spine-godot/example/examples/{simple-input => 04-simple-input}/simple-input.tscn (79%) rename spine-godot/example/examples/{simple-input => 04-simple-input}/spineboy-simple-input.gd (100%) diff --git a/spine-godot/example/assets/footstep.ogg b/spine-godot/example/assets/footstep.ogg new file mode 100644 index 0000000000000000000000000000000000000000..0e1468d8c42bd59e8e77b31eba2fe000e08d3d80 GIT binary patch literal 9071 zcmai42{_bU+y5i`nk0lqA*0X;8CgQe*oO#7jD2hwlq|^-$(DUB+bGKrF+!G-J$u+wm&hLD;Ycjh0G z@sfGExLMlcNCRY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?72A<%9g}S|z50W0Ifl>F|Adk5P6vBHS7;$rT95tY wqE`whVkqI1Fbb_RB|o}HZvX%Q literal 0 HcmV?d00001 diff --git a/spine-godot/example/assets/footstep.ogg.import b/spine-godot/example/assets/footstep.ogg.import new file mode 100644 index 000000000..0f8c88124 --- /dev/null +++ b/spine-godot/example/assets/footstep.ogg.import @@ -0,0 +1,15 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/footstep.ogg-789c3f1e3c4e0ca3bebcb13f1160f623.oggstr" + +[deps] + +source_file="res://assets/footstep.ogg" +dest_files=[ "res://.import/footstep.ogg-789c3f1e3c4e0ca3bebcb13f1160f623.oggstr" ] + +[params] + +loop=true +loop_offset=0 diff --git a/spine-godot/example/assets/spineboy/spinebody-data-res.tres b/spine-godot/example/assets/spineboy/spinebody-data-res.tres index a6566b79c..5ba572eda 100644 --- a/spine-godot/example/assets/spineboy/spinebody-data-res.tres +++ b/spine-godot/example/assets/spineboy/spinebody-data-res.tres @@ -16,4 +16,5 @@ mix = 0.2 [resource] atlas_res = ExtResource( 1 ) skeleton_file_res = ExtResource( 2 ) +default_mix = 0.2 animation_mixes = [ SubResource( 1 ), SubResource( 2 ) ] diff --git a/spine-godot/example/examples/helloworld/helloworld.tscn b/spine-godot/example/examples/01-helloworld/helloworld.tscn similarity index 55% rename from spine-godot/example/examples/helloworld/helloworld.tscn rename to spine-godot/example/examples/01-helloworld/helloworld.tscn index 65eb6e9cd..8df3afcef 100644 --- a/spine-godot/example/examples/helloworld/helloworld.tscn +++ b/spine-godot/example/examples/01-helloworld/helloworld.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] -[ext_resource path="res://examples/helloworld/spineboy-helloworld.gd" type="Script" id=1] +[ext_resource path="res://examples/01-helloworld/spineboy-helloworld.gd" type="Script" id=1] +[ext_resource path="res://examples/02-animation-state-listeners/animation-state-listeners.gd" type="Script" id=2] [ext_resource path="res://assets/spineboy/spinebody-data-res.tres" type="SpineSkeletonDataResource" id=3] [node name="Node2D" type="Node2D"] +script = ExtResource( 2 ) [node name="Spineboy" type="SpineSprite" parent="."] position = Vector2( 496.207, 477.185 ) diff --git a/spine-godot/example/examples/helloworld/spineboy-helloworld.gd b/spine-godot/example/examples/01-helloworld/spineboy-helloworld.gd similarity index 100% rename from spine-godot/example/examples/helloworld/spineboy-helloworld.gd rename to spine-godot/example/examples/01-helloworld/spineboy-helloworld.gd diff --git a/spine-godot/example/examples/02-animation-state-listeners/animation-state-listeners.gd b/spine-godot/example/examples/02-animation-state-listeners/animation-state-listeners.gd new file mode 100644 index 000000000..08ba4da08 --- /dev/null +++ b/spine-godot/example/examples/02-animation-state-listeners/animation-state-listeners.gd @@ -0,0 +1,37 @@ +extends Node2D + +func _animation_started(sprite: SpineSprite, animation_state: SpineAnimationState, track_entry: SpineTrackEntry): + print("Animation started: " + track_entry.get_animation().get_name()) + +func _animation_interrupted(sprite: SpineSprite, animation_state: SpineAnimationState, track_entry: SpineTrackEntry): + print("Animation interrupted: " + track_entry.get_animation().get_name()) + +func _animation_ended(sprite: SpineSprite, animation_state: SpineAnimationState, track_entry: SpineTrackEntry): + print("Animation ended: " + track_entry.get_animation().get_name()) + +func _animation_completed(sprite: SpineSprite, animation_state: SpineAnimationState, track_entry: SpineTrackEntry): + print("Animation completed: " + track_entry.get_animation().get_name()) + +func _animation_disposed(sprite: SpineSprite, animation_state: SpineAnimationState, track_entry: SpineTrackEntry): + print("Animation disposed: " + track_entry.get_animation().get_name()) + +func _animation_event(sprite: SpineSprite, animation_state: SpineAnimationState, track_entry: SpineTrackEntry, event: SpineEvent): + print("Animation event: " + track_entry.get_animation().get_name() + ", " + event.get_data().get_event_name()) + if (event.get_data().get_event_name() == "footstep"): + var audio = $FootstepAudio + audio.play() + +func _ready(): + var spineboy = $Spineboy + var animation_state = spineboy.get_animation_state() + animation_state.set_animation("jump", false, 0) + animation_state.add_animation("walk", 0, true, 0) + animation_state.add_animation("run", 2, true, 0) + + spineboy.connect("animation_started", self, "_animation_started") + spineboy.connect("animation_interrupted", self, "_animation_interrupted") + spineboy.connect("animation_ended", self, "_animation_ended") + spineboy.connect("animation_completed", self, "_animation_completed") + spineboy.connect("animation_disposed", self, "_animation_disposed") + spineboy.connect("animation_event", self, "_animation_event") + pass diff --git a/spine-godot/example/examples/02-animation-state-listeners/animation-state-listeners.tscn b/spine-godot/example/examples/02-animation-state-listeners/animation-state-listeners.tscn new file mode 100644 index 000000000..0db3a0668 --- /dev/null +++ b/spine-godot/example/examples/02-animation-state-listeners/animation-state-listeners.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://examples/02-animation-state-listeners/animation-state-listeners.gd" type="Script" id=1] +[ext_resource path="res://assets/spineboy/spinebody-data-res.tres" type="SpineSkeletonDataResource" id=2] +[ext_resource path="res://assets/footstep.ogg" type="AudioStream" id=3] + +[node name="Node2D" type="Node2D"] +script = ExtResource( 1 ) + +[node name="FootstepAudio" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource( 3 ) + +[node name="Spineboy" type="SpineSprite" parent="."] +position = Vector2( 473, 487 ) +scale = Vector2( 0.575051, 0.575051 ) +skeleton_data_res = ExtResource( 2 ) diff --git a/spine-godot/example/examples/mix-and-match/mix-and-match.gd b/spine-godot/example/examples/03-mix-and-match/mix-and-match.gd similarity index 100% rename from spine-godot/example/examples/mix-and-match/mix-and-match.gd rename to spine-godot/example/examples/03-mix-and-match/mix-and-match.gd diff --git a/spine-godot/example/examples/mix-and-match/mix-and-match.tscn b/spine-godot/example/examples/03-mix-and-match/mix-and-match.tscn similarity index 80% rename from spine-godot/example/examples/mix-and-match/mix-and-match.tscn rename to spine-godot/example/examples/03-mix-and-match/mix-and-match.tscn index a3c6865c3..c3f9d25aa 100644 --- a/spine-godot/example/examples/mix-and-match/mix-and-match.tscn +++ b/spine-godot/example/examples/03-mix-and-match/mix-and-match.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=2] [ext_resource path="res://assets/mix-and-match/mix-and-match-data.tres" type="SpineSkeletonDataResource" id=1] -[ext_resource path="res://examples/mix-and-match/mix-and-match.gd" type="Script" id=2] +[ext_resource path="res://examples/03-mix-and-match/mix-and-match.gd" type="Script" id=2] [node name="Node2D" type="Node2D"] diff --git a/spine-godot/example/examples/simple-input/simple-input.tscn b/spine-godot/example/examples/04-simple-input/simple-input.tscn similarity index 79% rename from spine-godot/example/examples/simple-input/simple-input.tscn rename to spine-godot/example/examples/04-simple-input/simple-input.tscn index 158909975..ad85e9dba 100644 --- a/spine-godot/example/examples/simple-input/simple-input.tscn +++ b/spine-godot/example/examples/04-simple-input/simple-input.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=2] [ext_resource path="res://assets/spineboy/spinebody-data-res.tres" type="SpineSkeletonDataResource" id=1] -[ext_resource path="res://examples/simple-input/spineboy-simple-input.gd" type="Script" id=2] +[ext_resource path="res://examples/04-simple-input/spineboy-simple-input.gd" type="Script" id=2] [node name="Node2D" type="Node2D"] diff --git a/spine-godot/example/examples/simple-input/spineboy-simple-input.gd b/spine-godot/example/examples/04-simple-input/spineboy-simple-input.gd similarity index 100% rename from spine-godot/example/examples/simple-input/spineboy-simple-input.gd rename to spine-godot/example/examples/04-simple-input/spineboy-simple-input.gd diff --git a/spine-godot/example/project.godot b/spine-godot/example/project.godot index 464c70e05..b52e4a317 100644 --- a/spine-godot/example/project.godot +++ b/spine-godot/example/project.godot @@ -11,7 +11,7 @@ config_version=4 [application] config/name="spine-godot-examples" -run/main_scene="res://examples/simple-input/simple-input.tscn" +run/main_scene="res://examples/01-helloworld/helloworld.tscn" run/low_processor_mode=true config/icon="res://icon.png" diff --git a/spine-godot/spine_godot/SpineSprite.cpp b/spine-godot/spine_godot/SpineSprite.cpp index 1d5e381ec..a762a8a4b 100644 --- a/spine-godot/spine_godot/SpineSprite.cpp +++ b/spine-godot/spine_godot/SpineSprite.cpp @@ -53,13 +53,13 @@ void SpineSprite::_bind_methods() { ClassDB::bind_method(D_METHOD("update_skeleton", "delta"), &SpineSprite::update_skeleton); - ADD_SIGNAL(MethodInfo("animation_start", PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_TYPE_STRING, "SpineEvent"))); - ADD_SIGNAL(MethodInfo("animation_interrupt", PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_TYPE_STRING, "SpineEvent"))); - ADD_SIGNAL(MethodInfo("animation_end", PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_TYPE_STRING, "SpineEvent"))); - ADD_SIGNAL(MethodInfo("animation_complete", PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_TYPE_STRING, "SpineEvent"))); - ADD_SIGNAL(MethodInfo("animation_dispose", PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_TYPE_STRING, "SpineEvent"))); - ADD_SIGNAL(MethodInfo("animation_event", PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_TYPE_STRING, "SpineEvent"))); - ADD_SIGNAL(MethodInfo("world_transforms_changed")); + ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::OBJECT, "spine_sprite", PROPERTY_HINT_TYPE_STRING, "SpineSprite"), PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"))); + ADD_SIGNAL(MethodInfo("animation_interrupted", PropertyInfo(Variant::OBJECT, "spine_sprite", PROPERTY_HINT_TYPE_STRING, "SpineSprite"), PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"))); + ADD_SIGNAL(MethodInfo("animation_ended", PropertyInfo(Variant::OBJECT, "spine_sprite", PROPERTY_HINT_TYPE_STRING, "SpineSprite"), PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"))); + ADD_SIGNAL(MethodInfo("animation_completed", PropertyInfo(Variant::OBJECT, "spine_sprite", PROPERTY_HINT_TYPE_STRING, "SpineSprite"), PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"))); + ADD_SIGNAL(MethodInfo("animation_disposed", PropertyInfo(Variant::OBJECT, "spine_sprite", PROPERTY_HINT_TYPE_STRING, "SpineSprite"), PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"))); + ADD_SIGNAL(MethodInfo("animation_event", PropertyInfo(Variant::OBJECT, "spine_sprite", PROPERTY_HINT_TYPE_STRING, "SpineSprite"), PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "track_entry", PROPERTY_HINT_TYPE_STRING, "SpineTrackEntry"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_TYPE_STRING, "SpineEvent"))); + ADD_SIGNAL(MethodInfo("world_transforms_changed", PropertyInfo(Variant::OBJECT, "spine_sprite", PROPERTY_HINT_TYPE_STRING, "SpineSprite"))); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "skeleton_data_res", PropertyHint::PROPERTY_HINT_RESOURCE_TYPE, "SpineSkeletonDataResource"), "set_skeleton_data_res", "get_skeleton_data_res"); ADD_PROPERTY(PropertyInfo(Variant::INT, "update_mode", PROPERTY_HINT_ENUM, "Process,Physics,Manual"), "set_update_mode", "get_update_mode"); @@ -511,24 +511,24 @@ void SpineSprite::callback(spine::AnimationState *state, spine::EventType type, } switch (type) { - case spine::EventType_Start: { - emit_signal("animation_start", animation_state, entry_ref, event_ref); - } break; - case spine::EventType_Interrupt: { - emit_signal("animation_interrupt", animation_state, entry_ref, event_ref); - } break; - case spine::EventType_End: { - emit_signal("animation_end", animation_state, entry_ref, event_ref); - } break; - case spine::EventType_Complete: { - emit_signal("animation_complete", animation_state, entry_ref, event_ref); - } break; - case spine::EventType_Dispose: { - emit_signal("animation_dispose", animation_state, entry_ref, event_ref); - } break; - case spine::EventType_Event: { - emit_signal("animation_event", animation_state, entry_ref, event_ref); - } break; + case spine::EventType_Start: + emit_signal("animation_started", this, animation_state, entry_ref); + break; + case spine::EventType_Interrupt: + emit_signal("animation_interrupted", this, animation_state, entry_ref); + break; + case spine::EventType_End: + emit_signal("animation_ended", this, animation_state, entry_ref); + break; + case spine::EventType_Complete: + emit_signal("animation_completed", this, animation_state, entry_ref); + break; + case spine::EventType_Dispose: + emit_signal("animation_disposed", this, animation_state, entry_ref, event_ref); + break; + case spine::EventType_Event: + emit_signal("animation_event", this, animation_state, entry_ref, event_ref); + break; } }