소스 검색

[godot] Replace old classes with SpineNewXX, rework example project.

Mario Zechner 3 년 전
부모
커밋
2ae4851a83
40개의 변경된 파일1286개의 추가작업 그리고 4293개의 파일을 삭제
  1. 0 10
      spine-godot/example/assets/spineboy/spinebody-data-new-res.tres
  2. 0 0
      spine-godot/example/assets/spineboy/spinebody-data-res.tres
  3. 0 80
      spine-godot/example/batch-test.tscn
  4. 34 0
      spine-godot/example/examples/helloworld/helloworld.tscn
  5. 0 0
      spine-godot/example/examples/helloworld/spineboy-helloworld.gd
  6. 0 0
      spine-godot/example/examples/mix-and-match/mix-and-match.gd
  7. 12 0
      spine-godot/example/examples/mix-and-match/mix-and-match.tscn
  8. 1 1
      spine-godot/example/project.godot
  9. 0 40
      spine-godot/example/spineboy.tscn
  10. 4 0
      spine-godot/example/tests/batch-test.gd
  11. 583 0
      spine-godot/example/tests/batch-test.tscn
  12. 6 326
      spine-godot/example/tests/unit-tests.tscn
  13. 20 20
      spine-godot/godot/modules/spine_godot/SpineAnimationState.cpp
  14. 3 4
      spine-godot/godot/modules/spine_godot/SpineAnimationState.h
  15. 0 152
      spine-godot/godot/modules/spine_godot/SpineAnimationStateDataResource.cpp
  16. 0 76
      spine-godot/godot/modules/spine_godot/SpineAnimationStateDataResource.h
  17. 14 110
      spine-godot/godot/modules/spine_godot/SpineBone.cpp
  18. 3 9
      spine-godot/godot/modules/spine_godot/SpineBone.h
  19. 5 5
      spine-godot/godot/modules/spine_godot/SpineEditorPlugin.cpp
  20. 8 8
      spine-godot/godot/modules/spine_godot/SpineEditorPlugin.h
  21. 0 171
      spine-godot/godot/modules/spine_godot/SpineNewAnimationState.cpp
  22. 0 82
      spine-godot/godot/modules/spine_godot/SpineNewAnimationState.h
  23. 0 440
      spine-godot/godot/modules/spine_godot/SpineNewBone.cpp
  24. 0 169
      spine-godot/godot/modules/spine_godot/SpineNewBone.h
  25. 0 343
      spine-godot/godot/modules/spine_godot/SpineNewSkeleton.cpp
  26. 0 125
      spine-godot/godot/modules/spine_godot/SpineNewSkeleton.h
  27. 0 446
      spine-godot/godot/modules/spine_godot/SpineNewSkeletonDataResource.cpp
  28. 0 113
      spine-godot/godot/modules/spine_godot/SpineNewSkeletonDataResource.h
  29. 0 610
      spine-godot/godot/modules/spine_godot/SpineNewSprite.cpp
  30. 0 122
      spine-godot/godot/modules/spine_godot/SpineNewSprite.h
  31. 0 1
      spine-godot/godot/modules/spine_godot/SpineRendererObject.h
  32. 54 124
      spine-godot/godot/modules/spine_godot/SpineSkeleton.cpp
  33. 8 11
      spine-godot/godot/modules/spine_godot/SpineSkeleton.h
  34. 327 338
      spine-godot/godot/modules/spine_godot/SpineSkeletonDataResource.cpp
  35. 55 78
      spine-godot/godot/modules/spine_godot/SpineSkeletonDataResource.h
  36. 123 147
      spine-godot/godot/modules/spine_godot/SpineSprite.cpp
  37. 18 15
      spine-godot/godot/modules/spine_godot/SpineSprite.h
  38. 0 48
      spine-godot/godot/modules/spine_godot/SpineSpriteMeshInstance2D.cpp
  39. 0 57
      spine-godot/godot/modules/spine_godot/SpineSpriteMeshInstance2D.h
  40. 8 12
      spine-godot/godot/modules/spine_godot/register_types.cpp

+ 0 - 10
spine-godot/example/assets/spineboy/spinebody-data-new-res.tres

@@ -1,10 +0,0 @@
-[gd_resource type="SpineNewSkeletonDataResource" load_steps=3 format=2]
-
-[ext_resource path="res://assets/spineboy/spineboy.atlas" type="SpineAtlasResource" id=1]
-[ext_resource path="res://assets/spineboy/spineboy-pro.json" type="SpineSkeletonFileResource" id=2]
-
-[resource]
-atlas_res = ExtResource( 1 )
-skeleton_file_res = ExtResource( 2 )
-animations = null
-skins = null

+ 0 - 0
spine-godot/example/assets/spineboy/spineboy-data.tres → spine-godot/example/assets/spineboy/spinebody-data-res.tres


+ 0 - 80
spine-godot/example/batch-test.tscn

@@ -1,80 +0,0 @@
-[gd_scene load_steps=2 format=2]
-
-[ext_resource path="res://assets/spineboy/spinebody-data-new-res.tres" type="SpineNewSkeletonDataResource" id=1]
-
-[node name="Node2D" type="Node2D"]
-
-[node name="SpineNewSprite" type="SpineNewSprite" parent="."]
-position = Vector2( 291.494, 476.479 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite2" type="SpineNewSprite" parent="."]
-position = Vector2( 699.584, 371.093 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite3" type="SpineNewSprite" parent="."]
-position = Vector2( 418.181, 256.739 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite4" type="SpineNewSprite" parent="."]
-position = Vector2( 588.592, 489.933 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite5" type="SpineNewSprite" parent="."]
-position = Vector2( 788.152, 515.719 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite6" type="SpineNewSprite" parent="."]
-position = Vector2( 433.553, 554.793 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite7" type="SpineNewSprite" parent="."]
-position = Vector2( 622.086, 573.354 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite8" type="SpineNewSprite" parent="."]
-position = Vector2( 946.403, 559.678 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite9" type="SpineNewSprite" parent="."]
-position = Vector2( 867.277, 378.471 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite10" type="SpineNewSprite" parent="."]
-position = Vector2( 971.801, 339.885 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite11" type="SpineNewSprite" parent="."]
-position = Vector2( 468.72, 379.936 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite12" type="SpineNewSprite" parent="."]
-position = Vector2( 614.272, 317.418 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite13" type="SpineNewSprite" parent="."]
-position = Vector2( 540.031, 309.114 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite14" type="SpineNewSprite" parent="."]
-position = Vector2( 355.405, 362.353 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )
-
-[node name="SpineNewSprite15" type="SpineNewSprite" parent="."]
-position = Vector2( 520.982, 532.326 )
-scale = Vector2( 0.2, 0.2 )
-skeleton_data_res = ExtResource( 1 )

+ 34 - 0
spine-godot/example/examples/helloworld/helloworld.tscn

@@ -0,0 +1,34 @@
+[gd_scene load_steps=7 format=2]
+
+[ext_resource path="res://examples/helloworld/spineboy-helloworld.gd" type="Script" id=1]
+[ext_resource path="res://examples/mix-and-match/mix-and-match.gd" type="Script" id=2]
+[ext_resource path="res://assets/spineboy/spinebody-data-res.tres" type="SpineSkeletonDataResource" id=3]
+[ext_resource path="res://assets/mix-and-match/mix-and-match-data.tres" type="SpineSkeletonDataResource" id=4]
+[ext_resource path="res://assets/raptor/raprot-data.tres" type="SpineSkeletonDataResource" id=5]
+
+[sub_resource type="GDScript" id=1]
+script/source = "extends SpineSprite
+
+func _ready():
+	get_animation_state().set_animation(\"walk\", true)
+"
+
+[node name="Node2D" type="Node2D"]
+
+[node name="Spineboy" type="SpineSprite" parent="."]
+position = Vector2( 137.107, 540.132 )
+scale = Vector2( 0.466832, 0.466832 )
+skeleton_data_res = ExtResource( 3 )
+script = ExtResource( 1 )
+
+[node name="MixAndMatch" type="SpineSprite" parent="."]
+position = Vector2( 402.469, 534.677 )
+scale = Vector2( 0.366163, 0.366163 )
+skeleton_data_res = ExtResource( 4 )
+script = ExtResource( 2 )
+
+[node name="Raptor" type="SpineSprite" parent="."]
+position = Vector2( 793.667, 527.026 )
+scale = Vector2( 0.343143, 0.343143 )
+skeleton_data_res = ExtResource( 5 )
+script = SubResource( 1 )

+ 0 - 0
spine-godot/example/Spineboy.gd → spine-godot/example/examples/helloworld/spineboy-helloworld.gd


+ 0 - 0
spine-godot/example/mix-and-match.gd → spine-godot/example/examples/mix-and-match/mix-and-match.gd


+ 12 - 0
spine-godot/example/examples/mix-and-match/mix-and-match.tscn

@@ -0,0 +1,12 @@
+[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]
+
+[node name="Node2D" type="Node2D"]
+
+[node name="MixAndMatch" type="SpineSprite" parent="."]
+position = Vector2( 775.779, 516.856 )
+scale = Vector2( 0.441932, 0.441932 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )

+ 1 - 1
spine-godot/example/project.godot

@@ -11,7 +11,7 @@ config_version=4
 [application]
 
 config/name="spine-godot-examples"
-run/main_scene="res://batch-test.tscn"
+run/main_scene="res://tests/batch-test.tscn"
 run/low_processor_mode=true
 config/icon="res://icon.png"
 

+ 0 - 40
spine-godot/example/spineboy.tscn

@@ -1,40 +0,0 @@
-[gd_scene load_steps=10 format=2]
-
-[ext_resource path="res://Spineboy.gd" type="Script" id=1]
-[ext_resource path="res://assets/spineboy/spineboy-data.tres" type="SpineSkeletonDataResource" id=2]
-[ext_resource path="res://assets/mix-and-match/mix-and-match-data.tres" type="SpineSkeletonDataResource" id=3]
-[ext_resource path="res://assets/spineboy/spinebody-data-new-res.tres" type="SpineNewSkeletonDataResource" id=4]
-[ext_resource path="res://mix-and-match.gd" type="Script" id=5]
-[ext_resource path="res://assets/raptor/raprot-data.tres" type="SpineSkeletonDataResource" id=6]
-
-[sub_resource type="SpineAnimationStateDataResource" id=2]
-skeleton = ExtResource( 2 )
-
-[sub_resource type="SpineAnimationStateDataResource" id=3]
-skeleton = ExtResource( 3 )
-
-[sub_resource type="SpineAnimationStateDataResource" id=5]
-skeleton = ExtResource( 6 )
-
-[node name="Node2D" type="Node2D"]
-
-[node name="Spineboy" type="SpineSprite" parent="."]
-position = Vector2( 862.76, 472.89 )
-scale = Vector2( 0.5, 0.5 )
-animation_state_data_res = SubResource( 2 )
-script = ExtResource( 1 )
-
-[node name="MixAndMatch" type="SpineSprite" parent="."]
-position = Vector2( 639.042, 497.78 )
-scale = Vector2( 0.5, 0.5 )
-animation_state_data_res = SubResource( 3 )
-script = ExtResource( 5 )
-
-[node name="Raptor" type="SpineSprite" parent="."]
-position = Vector2( 261.223, 541.504 )
-scale = Vector2( 0.5, 0.5 )
-animation_state_data_res = SubResource( 5 )
-
-[node name="SpineNewSprite" type="SpineNewSprite" parent="."]
-position = Vector2( 631.194, 1005.65 )
-skeleton_data_res = ExtResource( 4 )

+ 4 - 0
spine-godot/example/tests/batch-test.gd

@@ -0,0 +1,4 @@
+extends SpineSprite
+
+func _ready():
+	get_animation_state().set_animation("walk", true)

+ 583 - 0
spine-godot/example/tests/batch-test.tscn

@@ -0,0 +1,583 @@
+[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://tests/batch-test.gd" type="Script" id=2]
+
+[node name="Node2D" type="Node2D"]
+rotation = -3.67884e-05
+
+[node name="SpineSprite" type="SpineSprite" parent="."]
+position = Vector2( 53.8037, 119.483 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite2" type="SpineSprite" parent="."]
+position = Vector2( 111.488, 119.485 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite3" type="SpineSprite" parent="."]
+position = Vector2( 164.678, 119.487 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite4" type="SpineSprite" parent="."]
+position = Vector2( 217.119, 121.736 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite5" type="SpineSprite" parent="."]
+position = Vector2( 277.051, 120.989 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite6" type="SpineSprite" parent="."]
+position = Vector2( 337.733, 118.744 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite7" type="SpineSprite" parent="."]
+position = Vector2( 403.658, 120.994 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite8" type="SpineSprite" parent="."]
+position = Vector2( 464.34, 120.996 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite9" type="SpineSprite" parent="."]
+position = Vector2( 525.021, 120.998 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite10" type="SpineSprite" parent="."]
+position = Vector2( 589.448, 121.001 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite11" type="SpineSprite" parent="."]
+position = Vector2( 649.381, 121.752 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite12" type="SpineSprite" parent="."]
+position = Vector2( 709.313, 123.253 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite13" type="SpineSprite" parent="."]
+position = Vector2( 769.245, 119.509 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite14" type="SpineSprite" parent="."]
+position = Vector2( 830.676, 119.511 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite15" type="SpineSprite" parent="."]
+position = Vector2( 892.106, 121.761 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite16" type="SpineSprite" parent="."]
+position = Vector2( 953.537, 121.763 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite17" type="SpineSprite" parent="."]
+position = Vector2( 56.0478, 207.883 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite18" type="SpineSprite" parent="."]
+position = Vector2( 113.733, 207.885 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite19" type="SpineSprite" parent="."]
+position = Vector2( 166.923, 207.887 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite20" type="SpineSprite" parent="."]
+position = Vector2( 219.363, 210.136 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite21" type="SpineSprite" parent="."]
+position = Vector2( 279.295, 209.389 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite22" type="SpineSprite" parent="."]
+position = Vector2( 339.977, 207.144 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite23" type="SpineSprite" parent="."]
+position = Vector2( 405.902, 209.394 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite24" type="SpineSprite" parent="."]
+position = Vector2( 466.584, 209.396 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite25" type="SpineSprite" parent="."]
+position = Vector2( 527.265, 209.399 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite26" type="SpineSprite" parent="."]
+position = Vector2( 591.692, 209.401 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite27" type="SpineSprite" parent="."]
+position = Vector2( 651.625, 210.152 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite28" type="SpineSprite" parent="."]
+position = Vector2( 711.557, 211.653 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite29" type="SpineSprite" parent="."]
+position = Vector2( 771.489, 207.909 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite30" type="SpineSprite" parent="."]
+position = Vector2( 832.92, 207.911 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite31" type="SpineSprite" parent="."]
+position = Vector2( 894.351, 210.161 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite32" type="SpineSprite" parent="."]
+position = Vector2( 955.781, 210.163 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite33" type="SpineSprite" parent="."]
+position = Vector2( 60.5394, 300.778 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite34" type="SpineSprite" parent="."]
+position = Vector2( 118.224, 300.78 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite35" type="SpineSprite" parent="."]
+position = Vector2( 171.414, 300.782 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite36" type="SpineSprite" parent="."]
+position = Vector2( 223.855, 303.032 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite37" type="SpineSprite" parent="."]
+position = Vector2( 283.787, 302.285 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite38" type="SpineSprite" parent="."]
+position = Vector2( 344.468, 300.039 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite39" type="SpineSprite" parent="."]
+position = Vector2( 410.394, 302.289 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite40" type="SpineSprite" parent="."]
+position = Vector2( 471.075, 302.292 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite41" type="SpineSprite" parent="."]
+position = Vector2( 531.757, 302.294 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite42" type="SpineSprite" parent="."]
+position = Vector2( 596.184, 302.296 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite43" type="SpineSprite" parent="."]
+position = Vector2( 656.116, 303.047 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite44" type="SpineSprite" parent="."]
+position = Vector2( 716.048, 304.548 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite45" type="SpineSprite" parent="."]
+position = Vector2( 775.981, 300.804 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite46" type="SpineSprite" parent="."]
+position = Vector2( 837.411, 300.807 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite47" type="SpineSprite" parent="."]
+position = Vector2( 898.842, 303.056 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite48" type="SpineSprite" parent="."]
+position = Vector2( 960.273, 303.059 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite49" type="SpineSprite" parent="."]
+position = Vector2( 60.5361, 389.178 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite50" type="SpineSprite" parent="."]
+position = Vector2( 118.221, 389.18 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite51" type="SpineSprite" parent="."]
+position = Vector2( 171.411, 389.182 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite52" type="SpineSprite" parent="."]
+position = Vector2( 223.851, 391.432 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite53" type="SpineSprite" parent="."]
+position = Vector2( 283.784, 390.685 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite54" type="SpineSprite" parent="."]
+position = Vector2( 344.465, 388.44 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite55" type="SpineSprite" parent="."]
+position = Vector2( 410.391, 390.689 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite56" type="SpineSprite" parent="."]
+position = Vector2( 471.072, 390.692 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite57" type="SpineSprite" parent="."]
+position = Vector2( 531.753, 390.694 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite58" type="SpineSprite" parent="."]
+position = Vector2( 596.181, 390.696 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite59" type="SpineSprite" parent="."]
+position = Vector2( 656.113, 391.448 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite60" type="SpineSprite" parent="."]
+position = Vector2( 716.045, 392.948 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite61" type="SpineSprite" parent="."]
+position = Vector2( 775.978, 389.204 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite62" type="SpineSprite" parent="."]
+position = Vector2( 837.408, 389.207 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite63" type="SpineSprite" parent="."]
+position = Vector2( 898.839, 391.456 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite64" type="SpineSprite" parent="."]
+position = Vector2( 960.269, 391.459 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite65" type="SpineSprite" parent="."]
+position = Vector2( 62.0311, 477.578 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite66" type="SpineSprite" parent="."]
+position = Vector2( 119.716, 477.581 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite67" type="SpineSprite" parent="."]
+position = Vector2( 172.906, 477.583 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite68" type="SpineSprite" parent="."]
+position = Vector2( 225.346, 479.832 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite69" type="SpineSprite" parent="."]
+position = Vector2( 285.279, 479.085 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite70" type="SpineSprite" parent="."]
+position = Vector2( 345.96, 476.84 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite71" type="SpineSprite" parent="."]
+position = Vector2( 411.886, 479.09 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite72" type="SpineSprite" parent="."]
+position = Vector2( 472.567, 479.092 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite73" type="SpineSprite" parent="."]
+position = Vector2( 533.248, 479.094 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite74" type="SpineSprite" parent="."]
+position = Vector2( 597.676, 479.096 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite75" type="SpineSprite" parent="."]
+position = Vector2( 657.608, 479.848 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite76" type="SpineSprite" parent="."]
+position = Vector2( 717.54, 481.348 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite77" type="SpineSprite" parent="."]
+position = Vector2( 777.473, 477.605 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite78" type="SpineSprite" parent="."]
+position = Vector2( 838.903, 477.607 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite79" type="SpineSprite" parent="."]
+position = Vector2( 900.334, 479.857 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite80" type="SpineSprite" parent="."]
+position = Vector2( 961.765, 479.859 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite81" type="SpineSprite" parent="."]
+position = Vector2( 66.5229, 562.233 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite82" type="SpineSprite" parent="."]
+position = Vector2( 124.208, 562.235 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite83" type="SpineSprite" parent="."]
+position = Vector2( 177.398, 562.237 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite84" type="SpineSprite" parent="."]
+position = Vector2( 229.838, 564.486 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite85" type="SpineSprite" parent="."]
+position = Vector2( 289.77, 563.74 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite86" type="SpineSprite" parent="."]
+position = Vector2( 350.452, 561.494 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite87" type="SpineSprite" parent="."]
+position = Vector2( 416.377, 563.744 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite88" type="SpineSprite" parent="."]
+position = Vector2( 477.059, 563.746 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite89" type="SpineSprite" parent="."]
+position = Vector2( 537.74, 563.749 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite90" type="SpineSprite" parent="."]
+position = Vector2( 602.167, 563.751 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite91" type="SpineSprite" parent="."]
+position = Vector2( 662.1, 564.502 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite92" type="SpineSprite" parent="."]
+position = Vector2( 722.032, 566.003 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite93" type="SpineSprite" parent="."]
+position = Vector2( 781.964, 562.259 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite94" type="SpineSprite" parent="."]
+position = Vector2( 843.395, 562.261 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite95" type="SpineSprite" parent="."]
+position = Vector2( 904.826, 564.511 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )
+
+[node name="SpineSprite96" type="SpineSprite" parent="."]
+position = Vector2( 966.256, 564.513 )
+scale = Vector2( 0.1, 0.1 )
+skeleton_data_res = ExtResource( 1 )
+script = ExtResource( 2 )

+ 6 - 326
spine-godot/example/tests/unit-tests.tscn

@@ -1,332 +1,12 @@
-[gd_scene load_steps=56 format=2]
+[gd_scene load_steps=3 format=2]
 
 [ext_resource path="res://tests/unit-tests.gd" type="Script" id=1]
-[ext_resource path="res://assets/spineboy/spineboy-data.tres" type="SpineSkeletonDataResource" id=2]
+[ext_resource path="res://assets/spineboy/spinebody-data-res.tres" type="SpineSkeletonDataResource" id=2]
 
-[sub_resource type="SpineAnimationStateDataResource" id=1]
-skeleton = ExtResource( 2 )
-
-[sub_resource type="CanvasItemMaterial" id=2]
-
-[sub_resource type="CanvasItemMaterial" id=3]
-
-[sub_resource type="CanvasItemMaterial" id=4]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=5]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=6]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=7]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=8]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=9]
-
-[sub_resource type="CanvasItemMaterial" id=10]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=11]
-
-[sub_resource type="CanvasItemMaterial" id=12]
-
-[sub_resource type="CanvasItemMaterial" id=13]
-
-[sub_resource type="CanvasItemMaterial" id=14]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=15]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=16]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=17]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=18]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=19]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=20]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=21]
-
-[sub_resource type="CanvasItemMaterial" id=22]
-
-[sub_resource type="CanvasItemMaterial" id=23]
-
-[sub_resource type="CanvasItemMaterial" id=24]
-
-[sub_resource type="CanvasItemMaterial" id=25]
-
-[sub_resource type="CanvasItemMaterial" id=26]
-
-[sub_resource type="CanvasItemMaterial" id=27]
-
-[sub_resource type="CanvasItemMaterial" id=28]
-
-[sub_resource type="CanvasItemMaterial" id=29]
-
-[sub_resource type="CanvasItemMaterial" id=30]
-
-[sub_resource type="CanvasItemMaterial" id=31]
-
-[sub_resource type="CanvasItemMaterial" id=32]
-
-[sub_resource type="CanvasItemMaterial" id=33]
-
-[sub_resource type="CanvasItemMaterial" id=34]
-
-[sub_resource type="CanvasItemMaterial" id=35]
-
-[sub_resource type="CanvasItemMaterial" id=36]
-
-[sub_resource type="CanvasItemMaterial" id=37]
-
-[sub_resource type="CanvasItemMaterial" id=38]
-
-[sub_resource type="CanvasItemMaterial" id=39]
-
-[sub_resource type="CanvasItemMaterial" id=40]
-
-[sub_resource type="CanvasItemMaterial" id=41]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=42]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=43]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=44]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=45]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=46]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=47]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=48]
-
-[sub_resource type="CanvasItemMaterial" id=49]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=50]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=51]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=52]
-blend_mode = 1
-
-[sub_resource type="CanvasItemMaterial" id=53]
-blend_mode = 1
-
-[node name="SpineSprite" type="SpineSprite"]
+[node name="Node2D" type="Node2D"]
 position = Vector2( 496.659, 431.634 )
 scale = Vector2( 0.7, 0.7 )
-animation_state_data_res = SubResource( 1 )
-script = ExtResource( 1 )
-
-[node name="portal-bg" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 2 )
-
-[node name="portal-shade" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 3 )
-
-[node name="portal-streaks2" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 4 )
-
-[node name="portal-streaks1" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 5 )
-
-[node name="portal-flare8" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 6 )
-
-[node name="portal-flare9" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 7 )
-
-[node name="portal-flare10" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 8 )
-
-[node name="clipping" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 9 )
-
-[node name="exhaust3" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 10 )
-
-[node name="hoverboard-thruster-rear" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 11 )
-
-[node name="hoverboard-thruster-front" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 12 )
-
-[node name="hoverboard-board" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 13 )
-
-[node name="side-glow1" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 14 )
-
-[node name="side-glow3" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 15 )
-
-[node name="side-glow2" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 16 )
-
-[node name="hoverglow-front" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 17 )
-
-[node name="hoverglow-rear" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 18 )
-
-[node name="exhaust1" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 19 )
-
-[node name="exhaust2" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 20 )
-
-[node name="rear-upper-arm" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 21 )
-
-[node name="rear-bracer" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 22 )
-
-[node name="gun" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 23 )
-
-[node name="rear-foot" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 24 )
-
-[node name="rear-thigh" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 25 )
-
-[node name="rear-shin" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 26 )
-
-[node name="neck" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 27 )
 
-[node name="torso" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 28 )
-
-[node name="front-upper-arm" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 29 )
-
-[node name="head" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 30 )
-
-[node name="eye" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 31 )
-
-[node name="front-thigh" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 32 )
-
-[node name="front-foot" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 33 )
-
-[node name="front-shin" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 34 )
-
-[node name="mouth" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 35 )
-
-[node name="goggles" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 36 )
-
-[node name="front-bracer" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 37 )
-
-[node name="front-fist" type="SpineSpriteMeshInstance2D" parent="."]
-material = SubResource( 38 )
-
-[node name="muzzle" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 39 )
-
-[node name="head-bb" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 40 )
-
-[node name="portal-flare1" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 41 )
-
-[node name="portal-flare2" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 42 )
-
-[node name="portal-flare3" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 43 )
-
-[node name="portal-flare4" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 44 )
-
-[node name="portal-flare5" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 45 )
-
-[node name="portal-flare6" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 46 )
-
-[node name="portal-flare7" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 47 )
-
-[node name="crosshair" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 48 )
-
-[node name="muzzle-glow" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 49 )
-
-[node name="muzzle-ring" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 50 )
-
-[node name="muzzle-ring2" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 51 )
-
-[node name="muzzle-ring3" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 52 )
-
-[node name="muzzle-ring4" type="SpineSpriteMeshInstance2D" parent="."]
-visible = false
-material = SubResource( 53 )
+[node name="SpineSprite" type="SpineSprite" parent="."]
+skeleton_data_res = ExtResource( 2 )
+script = ExtResource( 1 )

+ 20 - 20
spine-godot/godot/modules/spine_godot/SpineAnimationState.cpp

@@ -46,22 +46,23 @@ void SpineAnimationState::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("get_current", "track_id"), &SpineAnimationState::get_current);
 }
 
-SpineAnimationState::SpineAnimationState() : animation_state(NULL) {
+SpineAnimationState::SpineAnimationState() : animation_state(nullptr), skeleton_data_res(nullptr) {
 }
 
 SpineAnimationState::~SpineAnimationState() {
-	if (animation_state) {
-		delete animation_state;
-		animation_state = NULL;
-	}
+	delete animation_state;
 }
 
-void SpineAnimationState::create_animation_state(spine::AnimationStateData *animation_state_data) {
-	if (animation_state) {
-		delete animation_state;
-		animation_state = NULL;
-	}
-	animation_state = new spine::AnimationState(animation_state_data);
+void SpineAnimationState::set_skeleton_data_res(Ref<SpineSkeletonDataResource> data_res) {
+	delete animation_state;
+	animation_state = nullptr;
+	skeleton_data_res = data_res;
+	if (!skeleton_data_res.is_valid() || !skeleton_data_res->is_skeleton_data_loaded()) return;
+	animation_state = new spine::AnimationState(skeleton_data_res->get_animation_state_data());
+}
+
+Ref<SpineSkeletonDataResource> SpineAnimationState::get_skeleton_data_res() const {
+	return skeleton_data_res;
 }
 
 #define CHECK_V                                              \
@@ -76,12 +77,12 @@ void SpineAnimationState::create_animation_state(spine::AnimationStateData *anim
 	}
 #define S_T(x) (spine::String(x.utf8()))
 Ref<SpineTrackEntry> SpineAnimationState::set_animation(const String &anim_name, bool loop, uint64_t track) {
-	CHECK_X(NULL);
+	CHECK_X(nullptr);
 	auto skeleton_data = animation_state->getData()->getSkeletonData();
 	auto anim = skeleton_data->findAnimation(anim_name.utf8().ptr());
 	if (!anim) {
 		ERR_PRINT(String("Can not find animation: ") + anim_name);
-		return NULL;
+		return nullptr;
 	}
 	auto entry = animation_state->setAnimation(track, anim, loop);
 	Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
@@ -89,12 +90,12 @@ Ref<SpineTrackEntry> SpineAnimationState::set_animation(const String &anim_name,
 	return gd_entry;
 }
 Ref<SpineTrackEntry> SpineAnimationState::add_animation(const String &anim_name, float delay, bool loop, uint64_t track) {
-	CHECK_X(NULL);
+	CHECK_X(nullptr);
 	auto skeleton_data = animation_state->getData()->getSkeletonData();
 	auto anim = skeleton_data->findAnimation(anim_name.utf8().ptr());
 	if (!anim) {
 		ERR_PRINT(String("Can not find animation: ") + anim_name);
-		return NULL;
+		return nullptr;
 	}
 	auto entry = animation_state->addAnimation(track, anim, loop, delay);
 	Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
@@ -103,14 +104,14 @@ Ref<SpineTrackEntry> SpineAnimationState::add_animation(const String &anim_name,
 }
 
 Ref<SpineTrackEntry> SpineAnimationState::set_empty_animation(uint64_t track_id, float mix_duration) {
-	CHECK_X(NULL);
+	CHECK_X(nullptr);
 	auto entry = animation_state->setEmptyAnimation(track_id, mix_duration);
 	Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
 	gd_entry->set_spine_object(entry);
 	return gd_entry;
 }
 Ref<SpineTrackEntry> SpineAnimationState::add_empty_animation(uint64_t track_id, float mix_duration, float delay) {
-	CHECK_X(NULL);
+	CHECK_X(nullptr);
 	auto entry = animation_state->addEmptyAnimation(track_id, mix_duration, delay);
 	Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
 	gd_entry->set_spine_object(entry);
@@ -130,7 +131,6 @@ bool SpineAnimationState::apply(Ref<SpineSkeleton> skeleton) {
 	return animation_state->apply(*(skeleton->get_spine_object()));
 }
 
-
 void SpineAnimationState::clear_tracks() {
 	CHECK_V;
 	animation_state->clearTracks();
@@ -159,10 +159,10 @@ void SpineAnimationState::enable_queue() {
 }
 
 Ref<SpineTrackEntry> SpineAnimationState::get_current(uint64_t track_index) {
-	CHECK_X(NULL);
+	CHECK_X(nullptr);
 	Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
 	auto entry = animation_state->getCurrent(track_index);
-	if (entry == NULL) return NULL;
+	if (entry == nullptr) return nullptr;
 	gd_entry->set_spine_object(entry);
 	return gd_entry;
 }

+ 3 - 4
spine-godot/godot/modules/spine_godot/SpineAnimationState.h

@@ -30,7 +30,6 @@
 #ifndef GODOT_SPINEANIMATIONSTATE_H
 #define GODOT_SPINEANIMATIONSTATE_H
 
-#include "SpineAnimationStateDataResource.h"
 #include "SpineSkeleton.h"
 #include "SpineTrackEntry.h"
 
@@ -42,12 +41,14 @@ protected:
 
 private:
 	spine::AnimationState *animation_state;
+	Ref<SpineSkeletonDataResource> skeleton_data_res;
 
 public:
 	SpineAnimationState();
 	~SpineAnimationState();
 
-	void create_animation_state(spine::AnimationStateData *animation_state_data);
+	void set_skeleton_data_res(Ref<SpineSkeletonDataResource> skeleton_data_res);
+	Ref<SpineSkeletonDataResource> get_skeleton_data_res() const;
 
 	inline void set_spine_object(spine::AnimationState *animation_state) { this->animation_state = animation_state; }
 	inline spine::AnimationState *get_spine_object() { return animation_state; }
@@ -61,8 +62,6 @@ public:
 	Ref<SpineTrackEntry> add_empty_animation(uint64_t track_id, float mix_duration, float delay);
 	void set_empty_animations(float mix_duration);
 
-	Ref<SpineAnimationStateDataResource> get_data();
-
 	float get_time_scale();
 	void set_time_scale(float time_scale);
 

+ 0 - 152
spine-godot/godot/modules/spine_godot/SpineAnimationStateDataResource.cpp

@@ -1,152 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#include "SpineAnimationStateDataResource.h"
-
-SpineAnimationStateDataResource::SpineAnimationStateDataResource() : animation_state_data(NULL), animation_state_data_created(false), default_mix(0.5f) {
-}
-SpineAnimationStateDataResource::~SpineAnimationStateDataResource() {
-	if (animation_state_data) {
-		delete animation_state_data;
-		animation_state_data = NULL;
-	}
-}
-
-void SpineAnimationStateDataResource::_bind_methods() {
-	ClassDB::bind_method(D_METHOD("set_skeleton", "skeleton"), &SpineAnimationStateDataResource::set_skeleton);
-	ClassDB::bind_method(D_METHOD("get_spine_object"), &SpineAnimationStateDataResource::get_skeleton);
-	ClassDB::bind_method(D_METHOD("_on_skeleton_data_loaded"), &SpineAnimationStateDataResource::_on_skeleton_data_loaded);
-	ClassDB::bind_method(D_METHOD("is_animation_state_data_created"), &SpineAnimationStateDataResource::is_animation_state_data_created);
-	ClassDB::bind_method(D_METHOD("_on_skeleton_data_changed"), &SpineAnimationStateDataResource::_on_skeleton_data_changed);
-	ClassDB::bind_method(D_METHOD("set_default_mix", "mix"), &SpineAnimationStateDataResource::set_default_mix);
-	ClassDB::bind_method(D_METHOD("get_default_mix"), &SpineAnimationStateDataResource::get_default_mix);
-	ClassDB::bind_method(D_METHOD("get_mix", "from", "to"), &SpineAnimationStateDataResource::get_mix);
-	ClassDB::bind_method(D_METHOD("set_mix", "from", "to", "mix"), &SpineAnimationStateDataResource::set_mix);
-
-	ADD_SIGNAL(MethodInfo("animation_state_data_created"));
-	ADD_SIGNAL(MethodInfo("skeleton_data_res_changed"));
-	ADD_SIGNAL(MethodInfo("animation_state_data_changed"));
-
-	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "skeleton", PropertyHint::PROPERTY_HINT_RESOURCE_TYPE, "SpineSkeletonDataResource"), "set_skeleton", "get_spine_object");
-	ADD_PROPERTY(PropertyInfo(Variant::REAL, "default_mix", PropertyHint::PROPERTY_HINT_EXP_RANGE, "0,1,0.01"), "set_default_mix", "get_default_mix");
-}
-
-void SpineAnimationStateDataResource::set_skeleton(const Ref<SpineSkeletonDataResource> &s) {
-	skeleton = s;
-
-	_on_skeleton_data_changed();
-	if (skeleton.is_valid()) {
-		skeleton->connect("skeleton_data_loaded", this, "_on_skeleton_data_loaded");
-		skeleton->connect("atlas_res_changed", this, "_on_skeleton_data_changed");
-		skeleton->connect("skeleton_file_res_changed", this, "_on_skeleton_data_changed");
-
-		if (skeleton->is_skeleton_data_loaded()) {
-			_on_skeleton_data_loaded();
-		}
-	} else {
-		if (animation_state_data) {
-			delete animation_state_data;
-			animation_state_data = NULL;
-			animation_state_data_created = false;
-		}
-	}
-}
-Ref<SpineSkeletonDataResource> SpineAnimationStateDataResource::get_skeleton() const {
-	return skeleton;
-}
-
-void SpineAnimationStateDataResource::set_default_mix(float m) {
-	default_mix = m;
-	if (!is_animation_state_data_created()) return;
-	animation_state_data->setDefaultMix(m);
-}
-float SpineAnimationStateDataResource::get_default_mix() {
-	return default_mix;
-}
-
-void SpineAnimationStateDataResource::set_mix(const String &from, const String &to, float mix_duration) {
-	if (!is_animation_state_data_created()) {
-		ERR_PRINT("'set_mix' fail. Animation state data is not created!");
-		return;
-	}
-	auto anim_from = get_skeleton()->find_animation(from);
-	auto anim_to = get_skeleton()->find_animation(to);
-	if (!anim_from.is_valid()) {
-		ERR_PRINT("'set_mix' fail. From animation animation not found!");
-		return;
-	}
-	if (!anim_to.is_valid()) {
-		ERR_PRINT("'set_mix' fail. To animation animation not found!");
-		return;
-	}
-	animation_state_data->setMix(anim_from->get_spine_object(), anim_to->get_spine_object(), mix_duration);
-}
-float SpineAnimationStateDataResource::get_mix(const String &from, const String &to) {
-	if (!is_animation_state_data_created()) {
-		ERR_PRINT("'set_mix' fail. Animation state data is not created!");
-		return 0;
-	}
-	auto anim_from = get_skeleton()->find_animation(from);
-	auto anim_to = get_skeleton()->find_animation(to);
-	if (!anim_from.is_valid()) {
-		ERR_PRINT("'set_mix' fail. From animation animation not found!");
-		return 0;
-	}
-	if (!anim_to.is_valid()) {
-		ERR_PRINT("'set_mix' fail. To animation animation not found!");
-		return 0;
-	}
-	return animation_state_data->getMix(anim_from->get_spine_object(), anim_to->get_spine_object());
-}
-
-void SpineAnimationStateDataResource::_on_skeleton_data_loaded() {
-	animation_state_data = new spine::AnimationStateData(skeleton->get_skeleton_data());
-	//	print_line("Animation state data created.");
-
-
-	emit_signal("animation_state_data_created");
-	animation_state_data->setDefaultMix(default_mix);
-	animation_state_data_created = true;
-}
-
-void SpineAnimationStateDataResource::_on_skeleton_data_changed() {
-	animation_state_data_created = false;
-	if (animation_state_data) {
-		delete animation_state_data;
-		animation_state_data = NULL;
-		//		print_line("Animation state data deleted.");
-	}
-
-	//	print_line("skeleton_data_res_changed emitted");
-	emit_signal("skeleton_data_res_changed");
-}
-
-bool SpineAnimationStateDataResource::is_animation_state_data_created() {
-	return animation_state_data_created;
-}

+ 0 - 76
spine-godot/godot/modules/spine_godot/SpineAnimationStateDataResource.h

@@ -1,76 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#ifndef GODOT_SPINEANIMATIONSTATEDATARESOURCE_H
-#define GODOT_SPINEANIMATIONSTATEDATARESOURCE_H
-
-#include "core/variant_parser.h"
-
-#include "SpineSkeletonDataResource.h"
-
-class SpineAnimationStateDataResource : public Resource {
-	GDCLASS(SpineAnimationStateDataResource, Resource);
-
-protected:
-	static void _bind_methods();
-
-private:
-	Ref<SpineSkeletonDataResource> skeleton;
-
-	spine::AnimationStateData *animation_state_data;
-
-	bool animation_state_data_created;
-
-	float default_mix;
-
-public:
-	void set_skeleton(const Ref<SpineSkeletonDataResource> &s);
-	Ref<SpineSkeletonDataResource> get_skeleton() const;
-
-	inline spine::AnimationStateData *get_animation_state_data() {
-		return animation_state_data;
-	}
-
-	void set_default_mix(float m);
-	float get_default_mix();
-
-	void set_mix(const String &from, const String &to, float mix_duration);
-	float get_mix(const String &from, const String &to);
-
-
-	void _on_skeleton_data_loaded();
-	void _on_skeleton_data_changed();
-
-	bool is_animation_state_data_created();
-
-	SpineAnimationStateDataResource();
-	~SpineAnimationStateDataResource();
-};
-
-#endif//GODOT_SPINEANIMATIONSTATEDATARESOURCE_H

+ 14 - 110
spine-godot/godot/modules/spine_godot/SpineBone.cpp

@@ -28,58 +28,23 @@
  *****************************************************************************/
 
 #include "SpineBone.h"
-
 #include "SpineSprite.h"
 #include "SpineSkeleton.h"
 
 void SpineBone::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("update_world_transform"), &SpineBone::update_world_transform);
-	//	void set_to_setup_pose();
-	//
-	//	Vector2 world_to_local(Vector2 world_position);
-	//
-	//	Vector2 local_to_world(Vector2 local_position);
-	//
-	//	float world_to_local_rotation(float world_rotation);
-	//
-	//	float local_to_world_rotation(float local_rotation);
-	//
-	//	void rotate_world(float degrees);
 	ClassDB::bind_method(D_METHOD("set_to_setup_pose"), &SpineBone::set_to_setup_pose);
 	ClassDB::bind_method(D_METHOD("world_to_local", "world_position"), &SpineBone::world_to_local);
 	ClassDB::bind_method(D_METHOD("local_to_world", "local_position"), &SpineBone::local_to_world);
 	ClassDB::bind_method(D_METHOD("world_to_local_rotation", "world_rotation"), &SpineBone::world_to_local_rotation);
 	ClassDB::bind_method(D_METHOD("local_to_world_rotation", "local_rotation"), &SpineBone::local_to_world_rotation);
 	ClassDB::bind_method(D_METHOD("rotate_world"), &SpineBone::rotate_world);
-	//
-	//	float get_world_to_local_rotation_x();
-	//	float get_world_to_local_rotation_y();
-	//
-	//	Ref<SpineBoneData> get_data();
-	//
-	//	Ref<SpineSkeleton> get_skeleton();
-	//
-	//	Ref<SpineBone> get_parent();
-	//
-	//	Array get_children();
 	ClassDB::bind_method(D_METHOD("get_world_to_local_rotation_x"), &SpineBone::get_world_to_local_rotation_x);
 	ClassDB::bind_method(D_METHOD("get_world_to_local_rotation_y"), &SpineBone::get_world_to_local_rotation_y);
 	ClassDB::bind_method(D_METHOD("get_data"), &SpineBone::get_data);
 	ClassDB::bind_method(D_METHOD("get_skeleton"), &SpineBone::get_skeleton);
 	ClassDB::bind_method(D_METHOD("get_parent"), &SpineBone::get_parent);
 	ClassDB::bind_method(D_METHOD("get_children"), &SpineBone::get_children);
-	//
-	//	float get_x();
-	//	void set_x(float v);
-	//
-	//	float get_y();
-	//	void set_y(float v);
-	//
-	//	float get_rotation();
-	//	void set_rotation(float v);
-	//
-	//	float get_scale_x();
-	//	void set_scale_x(float v);
 	ClassDB::bind_method(D_METHOD("get_x"), &SpineBone::get_x);
 	ClassDB::bind_method(D_METHOD("set_x", "v"), &SpineBone::set_x);
 	ClassDB::bind_method(D_METHOD("get_y"), &SpineBone::get_y);
@@ -88,18 +53,6 @@ void SpineBone::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_rotation", "v"), &SpineBone::set_rotation);
 	ClassDB::bind_method(D_METHOD("get_scale_x"), &SpineBone::get_scale_x);
 	ClassDB::bind_method(D_METHOD("set_scale_x", "v"), &SpineBone::set_scale_x);
-	//
-	//	float get_scale_y();
-	//	void set_scale_y(float v);
-	//
-	//	float get_shear_x();
-	//	void set_shear_x(float v);
-	//
-	//	float get_shear_y();
-	//	void set_shear_y(float v);
-	//
-	//	float get_applied_rotation();
-	//	void set_applied_rotation(float v);
 	ClassDB::bind_method(D_METHOD("get_scale_y"), &SpineBone::get_scale_y);
 	ClassDB::bind_method(D_METHOD("set_scale_y", "v"), &SpineBone::set_scale_y);
 	ClassDB::bind_method(D_METHOD("get_shear_x"), &SpineBone::get_shear_x);
@@ -108,18 +61,6 @@ void SpineBone::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_shear_y", "v"), &SpineBone::set_shear_y);
 	ClassDB::bind_method(D_METHOD("get_applied_rotation"), &SpineBone::get_applied_rotation);
 	ClassDB::bind_method(D_METHOD("set_applied_rotation", "v"), &SpineBone::set_applied_rotation);
-	//
-	//	float get_a_x();
-	//	void set_a_x(float v);
-	//
-	//	float get_a_y();
-	//	void set_a_y(float v);
-	//
-	//	float get_a_scale_x();
-	//	void set_a_scale_x(float v);
-	//
-	//	float get_a_scale_y();
-	//	void set_a_scale_y(float v);
 	ClassDB::bind_method(D_METHOD("get_a_x"), &SpineBone::get_a_x);
 	ClassDB::bind_method(D_METHOD("set_a_x", "v"), &SpineBone::set_a_x);
 	ClassDB::bind_method(D_METHOD("get_a_y"), &SpineBone::get_a_y);
@@ -128,18 +69,6 @@ void SpineBone::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_a_scale_x", "v"), &SpineBone::set_a_scale_x);
 	ClassDB::bind_method(D_METHOD("get_a_scale_y"), &SpineBone::get_a_scale_y);
 	ClassDB::bind_method(D_METHOD("set_a_scale_y", "v"), &SpineBone::set_a_scale_y);
-	//
-	//	float get_a_shear_x();
-	//	void set_a_shear_x(float v);
-	//
-	//	float get_a_shear_y();
-	//	void set_a_shear_y(float v);
-	//
-	//	float get_a();
-	//	void set_a(float v);
-	//
-	//	float get_b();
-	//	void set_b(float v);
 	ClassDB::bind_method(D_METHOD("get_a_shear_x"), &SpineBone::get_a_shear_x);
 	ClassDB::bind_method(D_METHOD("set_a_shear_x", "v"), &SpineBone::set_a_shear_x);
 	ClassDB::bind_method(D_METHOD("get_a_shear_y"), &SpineBone::get_a_shear_y);
@@ -148,18 +77,6 @@ void SpineBone::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_a", "v"), &SpineBone::set_a);
 	ClassDB::bind_method(D_METHOD("get_b"), &SpineBone::get_b);
 	ClassDB::bind_method(D_METHOD("set_b", "v"), &SpineBone::set_b);
-	//
-	//	float get_c();
-	//	void set_c(float v);
-	//
-	//	float get_d();
-	//	void set_d(float v);
-	//
-	//	float get_world_x();
-	//	void set_world_x(float v);
-	//
-	//	float get_world_y();
-	//	void set_world_y(float v);
 	ClassDB::bind_method(D_METHOD("get_c"), &SpineBone::get_c);
 	ClassDB::bind_method(D_METHOD("set_c", "v"), &SpineBone::set_c);
 	ClassDB::bind_method(D_METHOD("get_d"), &SpineBone::get_d);
@@ -168,36 +85,27 @@ void SpineBone::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_world_x", "v"), &SpineBone::set_world_x);
 	ClassDB::bind_method(D_METHOD("get_world_y"), &SpineBone::get_world_y);
 	ClassDB::bind_method(D_METHOD("set_world_y", "v"), &SpineBone::set_world_y);
-	//
-	//	float get_world_rotation_x();
-	//	float get_world_rotation_y();
-	//
-	//	float get_world_scale_x();
-	//	float get_world_scale_y();
-	//
-	//	bool is_applied_valid();
-	//	void set_applied_valid(bool v);
-	//
-	//	bool is_active();
-	//	void set_active(bool v);
 	ClassDB::bind_method(D_METHOD("get_world_rotation_x"), &SpineBone::get_world_rotation_x);
 	ClassDB::bind_method(D_METHOD("get_world_rotation_y"), &SpineBone::get_world_rotation_y);
 	ClassDB::bind_method(D_METHOD("get_world_scale_x"), &SpineBone::get_world_scale_x);
 	ClassDB::bind_method(D_METHOD("get_world_scale_y"), &SpineBone::get_world_scale_y);
 	ClassDB::bind_method(D_METHOD("is_active"), &SpineBone::is_active);
 	ClassDB::bind_method(D_METHOD("set_active", "v"), &SpineBone::set_active);
-
 	ClassDB::bind_method(D_METHOD("get_godot_transform"), &SpineBone::get_godot_transform);
 	ClassDB::bind_method(D_METHOD("set_godot_transform", "local_transform"), &SpineBone::set_godot_transform);
 	ClassDB::bind_method(D_METHOD("get_godot_global_transform"), &SpineBone::get_godot_global_transform);
 	ClassDB::bind_method(D_METHOD("set_godot_global_transform", "global_transform"), &SpineBone::set_godot_global_transform);
-
 	ClassDB::bind_method(D_METHOD("apply_world_transform_2d", "node2d"), &SpineBone::apply_world_transform_2d);
 }
 
-SpineBone::SpineBone() : bone(NULL), the_sprite(nullptr) {}
+SpineBone::SpineBone() : bone(nullptr), sprite(nullptr) {}
+
 SpineBone::~SpineBone() {}
 
+void SpineBone::set_spine_sprite(SpineSprite* sprite) {
+	this->sprite = sprite;
+}
+
 void SpineBone::update_world_transform() {
 	bone->updateWorldTransform();
 }
@@ -248,7 +156,7 @@ Ref<SpineSkeleton> SpineBone::get_skeleton() {
 	auto &s = bone->getSkeleton();
 	Ref<SpineSkeleton> gd_s(memnew(SpineSkeleton));
 	gd_s->set_spine_object(&s);
-	gd_s->set_spine_sprite(the_sprite);
+	gd_s->set_spine_sprite(sprite);
 	return gd_s;
 }
 
@@ -257,7 +165,7 @@ Ref<SpineBone> SpineBone::get_parent() {
 	if (b == NULL) return NULL;
 	Ref<SpineBone> gd_b(memnew(SpineBone));
 	gd_b->set_spine_object(b);
-	gd_b->set_spine_sprite(the_sprite);
+	gd_b->set_spine_sprite(sprite);
 	return gd_b;
 }
 
@@ -270,7 +178,7 @@ Array SpineBone::get_children() {
 		if (b == NULL) gd_bs[i] = Ref<SpineBone>(NULL);
 		Ref<SpineBone> gd_b(memnew(SpineBone));
 		gd_b->set_spine_object(b);
-		gd_b->set_spine_sprite(the_sprite);
+		gd_b->set_spine_sprite(sprite);
 		gd_bs[i] = gd_b;
 	}
 	return gd_bs;
@@ -487,13 +395,13 @@ void SpineBone::set_godot_transform(Transform2D trans) {
 Transform2D SpineBone::get_godot_global_transform() {
 	if (get_spine_object() == nullptr)
 		return Transform2D();
-	if (the_sprite == nullptr)
+	if (sprite == nullptr)
 		return get_godot_transform();
-	Transform2D res = the_sprite->get_transform();
+	Transform2D res = sprite->get_transform();
 	res.translate(get_world_x(), -get_world_y());
 	res.rotate(Math::deg2rad(-get_world_rotation_x()));
 	res.scale(Vector2(get_world_scale_x(), get_world_scale_y()));
-	auto p = the_sprite->get_parent() ? Object::cast_to<CanvasItem>(the_sprite->get_parent()) : nullptr;
+	auto p = sprite->get_parent() ? Object::cast_to<CanvasItem>(sprite->get_parent()) : nullptr;
 	if (p) {
 		return p->get_global_transform() * res;
 	}
@@ -503,9 +411,9 @@ Transform2D SpineBone::get_godot_global_transform() {
 void SpineBone::set_godot_global_transform(Transform2D transform) {
 	if (get_spine_object() == nullptr)
 		return;
-	if (the_sprite == nullptr)
+	if (sprite == nullptr)
 		set_godot_transform(transform);
-	transform = the_sprite->get_global_transform().affine_inverse() * transform;
+	transform = sprite->get_global_transform().affine_inverse() * transform;
 	Vector2 position = transform.get_origin();
 	real_t rotation = transform.get_rotation();
 	Vector2 scale = transform.get_scale();
@@ -530,7 +438,3 @@ void SpineBone::set_godot_global_transform(Transform2D transform) {
 	set_scale_x(scale.x);
 	set_scale_y(scale.y);
 }
-
-void SpineBone::set_spine_sprite(SpineSprite *s) {
-	the_sprite = s;
-}

+ 3 - 9
spine-godot/godot/modules/spine_godot/SpineBone.h

@@ -30,16 +30,10 @@
 #ifndef GODOT_SPINEBONE_H
 #define GODOT_SPINEBONE_H
 
-#include "core/variant_parser.h"
-#include <scene/2d/node_2d.h>
-
 #include <scene/2d/node_2d.h>
 #include <spine/spine.h>
 
 #include "SpineBoneData.h"
-#include "SpineIkConstraint.h"
-#include "SpinePathConstraint.h"
-#include "SpineTransformConstraint.h"
 
 class SpineSkeleton;
 class SpineSprite;
@@ -52,8 +46,7 @@ protected:
 
 private:
 	spine::Bone *bone;
-
-	SpineSprite *the_sprite;
+	SpineSprite* sprite;
 
 public:
 	SpineBone();
@@ -62,11 +55,12 @@ public:
 	inline void set_spine_object(spine::Bone *b) {
 		bone = b;
 	}
+
 	inline spine::Bone *get_spine_object() {
 		return bone;
 	}
 
-	void set_spine_sprite(SpineSprite *s);
+	void set_spine_sprite(SpineSprite* sprite);
 
 	void update_world_transform();
 

+ 5 - 5
spine-godot/godot/modules/spine_godot/SpineRuntimeEditorPlugin.cpp → spine-godot/godot/modules/spine_godot/SpineEditorPlugin.cpp

@@ -28,7 +28,7 @@
  *****************************************************************************/
 
 #ifdef TOOLS_ENABLED
-#include "SpineRuntimeEditorPlugin.h"
+#include "SpineEditorPlugin.h"
 
 #include "SpineAtlasResource.h"
 #include "SpineSkeletonFileResource.h"
@@ -72,17 +72,17 @@ Error SpineBinaryResourceImportPlugin::import(const String &p_source_file, const
 	return err;
 }
 
-//=======================| SpineRuntimeEditorPlugin |============================
-SpineRuntimeEditorPlugin::SpineRuntimeEditorPlugin(EditorNode *p_node) {
+//=======================| SpineEditorPlugin |============================
+SpineEditorPlugin::SpineEditorPlugin(EditorNode *p_node) {
 	add_import_plugin(memnew(SpineAtlasResourceImportPlugin));
 	add_import_plugin(memnew(SpineJsonResourceImportPlugin));
 	add_import_plugin(memnew(SpineBinaryResourceImportPlugin));
 }
 
-SpineRuntimeEditorPlugin::~SpineRuntimeEditorPlugin() {
+SpineEditorPlugin::~SpineEditorPlugin() {
 }
 
-bool SpineRuntimeEditorPlugin::handles(Object *p_object) const {
+bool SpineEditorPlugin::handles(Object *p_object) const {
 	return p_object->is_class("SpineSprite");
 }
 

+ 8 - 8
spine-godot/godot/modules/spine_godot/SpineRuntimeEditorPlugin.h → spine-godot/godot/modules/spine_godot/SpineEditorPlugin.h

@@ -27,8 +27,8 @@
  * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *****************************************************************************/
 
-#ifndef GODOT_SPINERUNTIMEEDITORPLUGIN_H
-#define GODOT_SPINERUNTIMEEDITORPLUGIN_H
+#ifndef GODOT_SPINEEDITORPLUGIN_H
+#define GODOT_SPINEEDITORPLUGIN_H
 
 #ifdef TOOLS_ENABLED
 #include "editor/editor_node.h"
@@ -93,17 +93,17 @@ public:
 	Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) override;
 };
 
-class SpineRuntimeEditorPlugin : public EditorPlugin {
-	GDCLASS(SpineRuntimeEditorPlugin, EditorPlugin);
+class SpineEditorPlugin : public EditorPlugin {
+	GDCLASS(SpineEditorPlugin, EditorPlugin);
 
 public:
-	SpineRuntimeEditorPlugin(EditorNode *p_node);
-	~SpineRuntimeEditorPlugin();
+	SpineEditorPlugin(EditorNode *p_node);
+	~SpineEditorPlugin();
 
-	String get_name() const override { return "SpineRuntimeEditorPlugin"; }
+	String get_name() const override { return "SpineEditorPlugin"; }
 	bool has_main_screen() const { return false; }
 	bool handles(Object *p_object) const override;
 };
 #endif
 
-#endif//GODOT_SPINERUNTIMEEDITORPLUGIN_H
+#endif//GODOT_SPINEEDITORPLUGIN_H

+ 0 - 171
spine-godot/godot/modules/spine_godot/SpineNewAnimationState.cpp

@@ -1,171 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#include "SpineNewAnimationState.h"
-
-void SpineNewAnimationState::_bind_methods() {
-	ClassDB::bind_method(D_METHOD("set_animation", "anim_name", "loop", "track_id"), &SpineNewAnimationState::set_animation, DEFVAL(true), DEFVAL(0));
-	ClassDB::bind_method(D_METHOD("update", "delta"), &SpineNewAnimationState::update, DEFVAL(0));
-	ClassDB::bind_method(D_METHOD("apply", "skeleton"), &SpineNewAnimationState::apply);
-	ClassDB::bind_method(D_METHOD("clear_tracks"), &SpineNewAnimationState::clear_tracks);
-	ClassDB::bind_method(D_METHOD("clear_track"), &SpineNewAnimationState::clear_track);
-	ClassDB::bind_method(D_METHOD("add_animation", "anim_name", "delay", "loop", "track_id"), &SpineNewAnimationState::add_animation, DEFVAL(0), DEFVAL(true), DEFVAL(0));
-	ClassDB::bind_method(D_METHOD("set_empty_animation", "track_id", "mix_duration"), &SpineNewAnimationState::set_empty_animation);
-	ClassDB::bind_method(D_METHOD("add_empty_animation", "track_id", "mix_duration", "delay"), &SpineNewAnimationState::add_empty_animation);
-	ClassDB::bind_method(D_METHOD("set_empty_animations", "mix_duration"), &SpineNewAnimationState::set_empty_animations);
-	ClassDB::bind_method(D_METHOD("get_time_scale"), &SpineNewAnimationState::get_time_scale);
-	ClassDB::bind_method(D_METHOD("set_time_scale", "time_scale"), &SpineNewAnimationState::set_time_scale);
-	ClassDB::bind_method(D_METHOD("disable_queue"), &SpineNewAnimationState::disable_queue);
-	ClassDB::bind_method(D_METHOD("enable_queue"), &SpineNewAnimationState::enable_queue);
-	ClassDB::bind_method(D_METHOD("get_current", "track_id"), &SpineNewAnimationState::get_current);
-}
-
-SpineNewAnimationState::SpineNewAnimationState() : animation_state(nullptr), skeleton_data_res(nullptr) {
-}
-
-SpineNewAnimationState::~SpineNewAnimationState() {
-	delete animation_state;
-}
-
-void SpineNewAnimationState::set_skeleton_data_res(Ref<SpineNewSkeletonDataResource> data_res) {
-	delete animation_state;
-	animation_state = nullptr;
-	skeleton_data_res = data_res;
-	if (!skeleton_data_res.is_valid() || !skeleton_data_res->is_skeleton_data_loaded()) return;
-	animation_state = new spine::AnimationState(skeleton_data_res->get_animation_state_data());
-}
-
-Ref<SpineNewSkeletonDataResource> SpineNewAnimationState::get_skeleton_data_res() const {
-	return skeleton_data_res;
-}
-
-#define CHECK_V                                              \
-	if (!animation_state) {                                  \
-		ERR_PRINT("The animation state is not loaded yet!"); \
-		return;                                              \
-	}
-#define CHECK_X(x)                                           \
-	if (!animation_state) {                                  \
-		ERR_PRINT("The animation state is not loaded yet!"); \
-		return x;                                            \
-	}
-#define S_T(x) (spine::String(x.utf8()))
-Ref<SpineTrackEntry> SpineNewAnimationState::set_animation(const String &anim_name, bool loop, uint64_t track) {
-	CHECK_X(nullptr);
-	auto skeleton_data = animation_state->getData()->getSkeletonData();
-	auto anim = skeleton_data->findAnimation(anim_name.utf8().ptr());
-	if (!anim) {
-		ERR_PRINT(String("Can not find animation: ") + anim_name);
-		return nullptr;
-	}
-	auto entry = animation_state->setAnimation(track, anim, loop);
-	Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
-	gd_entry->set_spine_object(entry);
-	return gd_entry;
-}
-Ref<SpineTrackEntry> SpineNewAnimationState::add_animation(const String &anim_name, float delay, bool loop, uint64_t track) {
-	CHECK_X(nullptr);
-	auto skeleton_data = animation_state->getData()->getSkeletonData();
-	auto anim = skeleton_data->findAnimation(anim_name.utf8().ptr());
-	if (!anim) {
-		ERR_PRINT(String("Can not find animation: ") + anim_name);
-		return nullptr;
-	}
-	auto entry = animation_state->addAnimation(track, anim, loop, delay);
-	Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
-	gd_entry->set_spine_object(entry);
-	return gd_entry;
-}
-
-Ref<SpineTrackEntry> SpineNewAnimationState::set_empty_animation(uint64_t track_id, float mix_duration) {
-	CHECK_X(nullptr);
-	auto entry = animation_state->setEmptyAnimation(track_id, mix_duration);
-	Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
-	gd_entry->set_spine_object(entry);
-	return gd_entry;
-}
-Ref<SpineTrackEntry> SpineNewAnimationState::add_empty_animation(uint64_t track_id, float mix_duration, float delay) {
-	CHECK_X(nullptr);
-	auto entry = animation_state->addEmptyAnimation(track_id, mix_duration, delay);
-	Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
-	gd_entry->set_spine_object(entry);
-	return gd_entry;
-}
-void SpineNewAnimationState::set_empty_animations(float mix_duration) {
-	CHECK_V;
-	animation_state->setEmptyAnimations(mix_duration);
-}
-
-void SpineNewAnimationState::update(float delta) {
-	CHECK_V;
-	animation_state->update(delta);
-}
-bool SpineNewAnimationState::apply(Ref<SpineNewSkeleton> skeleton) {
-	CHECK_X(false);
-	return animation_state->apply(*(skeleton->get_spine_object()));
-}
-
-void SpineNewAnimationState::clear_tracks() {
-	CHECK_V;
-	animation_state->clearTracks();
-}
-void SpineNewAnimationState::clear_track(uint64_t track_id) {
-	CHECK_V;
-	animation_state->clearTrack(track_id);
-}
-
-float SpineNewAnimationState::get_time_scale() {
-	CHECK_X(0);
-	return animation_state->getTimeScale();
-}
-void SpineNewAnimationState::set_time_scale(float time_scale) {
-	CHECK_V;
-	animation_state->setTimeScale(time_scale);
-}
-
-void SpineNewAnimationState::disable_queue() {
-	CHECK_V;
-	animation_state->disableQueue();
-}
-void SpineNewAnimationState::enable_queue() {
-	CHECK_V;
-	animation_state->enableQueue();
-}
-
-Ref<SpineTrackEntry> SpineNewAnimationState::get_current(uint64_t track_index) {
-	CHECK_X(nullptr);
-	Ref<SpineTrackEntry> gd_entry(memnew(SpineTrackEntry));
-	auto entry = animation_state->getCurrent(track_index);
-	if (entry == nullptr) return nullptr;
-	gd_entry->set_spine_object(entry);
-	return gd_entry;
-}
-
-#undef CHECK_V
-#undef CHECK_X

+ 0 - 82
spine-godot/godot/modules/spine_godot/SpineNewAnimationState.h

@@ -1,82 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#ifndef GODOT_SPINENEWANIMATIONSTATE_H
-#define GODOT_SPINENEWANIMATIONSTATE_H
-
-#include "SpineNewSkeleton.h"
-#include "SpineTrackEntry.h"
-
-class SpineNewAnimationState : public Reference {
-	GDCLASS(SpineNewAnimationState, Reference);
-
-protected:
-	static void _bind_methods();
-
-private:
-	spine::AnimationState *animation_state;
-	Ref<SpineNewSkeletonDataResource> skeleton_data_res;
-
-public:
-	SpineNewAnimationState();
-	~SpineNewAnimationState();
-
-	void set_skeleton_data_res(Ref<SpineNewSkeletonDataResource> skeleton_data_res);
-	Ref<SpineNewSkeletonDataResource> get_skeleton_data_res() const;
-
-	inline void set_spine_object(spine::AnimationState *animation_state) { this->animation_state = animation_state; }
-	inline spine::AnimationState *get_spine_object() { return animation_state; }
-
-	Ref<SpineTrackEntry> set_animation(const String &anim_name, bool loop, uint64_t track_id);
-
-	Ref<SpineTrackEntry> add_animation(const String &anim_name, float delay, bool loop, uint64_t track_id);
-
-	Ref<SpineTrackEntry> set_empty_animation(uint64_t track_id, float mix_duration);
-
-	Ref<SpineTrackEntry> add_empty_animation(uint64_t track_id, float mix_duration, float delay);
-	void set_empty_animations(float mix_duration);
-
-	float get_time_scale();
-	void set_time_scale(float time_scale);
-
-	void disable_queue();
-	void enable_queue();
-
-	void update(float delta);
-
-	bool apply(Ref<SpineNewSkeleton> skeleton);
-
-	void clear_tracks();
-
-	void clear_track(uint64_t track_id);
-
-	Ref<SpineTrackEntry> get_current(uint64_t track_index);
-};
-
-#endif//GODOT_SPINENEWANIMATIONSTATE_H

+ 0 - 440
spine-godot/godot/modules/spine_godot/SpineNewBone.cpp

@@ -1,440 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#include "SpineNewBone.h"
-#include "SpineNewSprite.h"
-#include "SpineNewSkeleton.h"
-
-void SpineNewBone::_bind_methods() {
-	ClassDB::bind_method(D_METHOD("update_world_transform"), &SpineNewBone::update_world_transform);
-	ClassDB::bind_method(D_METHOD("set_to_setup_pose"), &SpineNewBone::set_to_setup_pose);
-	ClassDB::bind_method(D_METHOD("world_to_local", "world_position"), &SpineNewBone::world_to_local);
-	ClassDB::bind_method(D_METHOD("local_to_world", "local_position"), &SpineNewBone::local_to_world);
-	ClassDB::bind_method(D_METHOD("world_to_local_rotation", "world_rotation"), &SpineNewBone::world_to_local_rotation);
-	ClassDB::bind_method(D_METHOD("local_to_world_rotation", "local_rotation"), &SpineNewBone::local_to_world_rotation);
-	ClassDB::bind_method(D_METHOD("rotate_world"), &SpineNewBone::rotate_world);
-	ClassDB::bind_method(D_METHOD("get_world_to_local_rotation_x"), &SpineNewBone::get_world_to_local_rotation_x);
-	ClassDB::bind_method(D_METHOD("get_world_to_local_rotation_y"), &SpineNewBone::get_world_to_local_rotation_y);
-	ClassDB::bind_method(D_METHOD("get_data"), &SpineNewBone::get_data);
-	ClassDB::bind_method(D_METHOD("get_skeleton"), &SpineNewBone::get_skeleton);
-	ClassDB::bind_method(D_METHOD("get_parent"), &SpineNewBone::get_parent);
-	ClassDB::bind_method(D_METHOD("get_children"), &SpineNewBone::get_children);
-	ClassDB::bind_method(D_METHOD("get_x"), &SpineNewBone::get_x);
-	ClassDB::bind_method(D_METHOD("set_x", "v"), &SpineNewBone::set_x);
-	ClassDB::bind_method(D_METHOD("get_y"), &SpineNewBone::get_y);
-	ClassDB::bind_method(D_METHOD("set_y", "v"), &SpineNewBone::set_y);
-	ClassDB::bind_method(D_METHOD("get_rotation"), &SpineNewBone::get_rotation);
-	ClassDB::bind_method(D_METHOD("set_rotation", "v"), &SpineNewBone::set_rotation);
-	ClassDB::bind_method(D_METHOD("get_scale_x"), &SpineNewBone::get_scale_x);
-	ClassDB::bind_method(D_METHOD("set_scale_x", "v"), &SpineNewBone::set_scale_x);
-	ClassDB::bind_method(D_METHOD("get_scale_y"), &SpineNewBone::get_scale_y);
-	ClassDB::bind_method(D_METHOD("set_scale_y", "v"), &SpineNewBone::set_scale_y);
-	ClassDB::bind_method(D_METHOD("get_shear_x"), &SpineNewBone::get_shear_x);
-	ClassDB::bind_method(D_METHOD("set_shear_x", "v"), &SpineNewBone::set_shear_x);
-	ClassDB::bind_method(D_METHOD("get_shear_y"), &SpineNewBone::get_shear_y);
-	ClassDB::bind_method(D_METHOD("set_shear_y", "v"), &SpineNewBone::set_shear_y);
-	ClassDB::bind_method(D_METHOD("get_applied_rotation"), &SpineNewBone::get_applied_rotation);
-	ClassDB::bind_method(D_METHOD("set_applied_rotation", "v"), &SpineNewBone::set_applied_rotation);
-	ClassDB::bind_method(D_METHOD("get_a_x"), &SpineNewBone::get_a_x);
-	ClassDB::bind_method(D_METHOD("set_a_x", "v"), &SpineNewBone::set_a_x);
-	ClassDB::bind_method(D_METHOD("get_a_y"), &SpineNewBone::get_a_y);
-	ClassDB::bind_method(D_METHOD("set_a_y", "v"), &SpineNewBone::set_a_y);
-	ClassDB::bind_method(D_METHOD("get_a_scale_x"), &SpineNewBone::get_a_scale_x);
-	ClassDB::bind_method(D_METHOD("set_a_scale_x", "v"), &SpineNewBone::set_a_scale_x);
-	ClassDB::bind_method(D_METHOD("get_a_scale_y"), &SpineNewBone::get_a_scale_y);
-	ClassDB::bind_method(D_METHOD("set_a_scale_y", "v"), &SpineNewBone::set_a_scale_y);
-	ClassDB::bind_method(D_METHOD("get_a_shear_x"), &SpineNewBone::get_a_shear_x);
-	ClassDB::bind_method(D_METHOD("set_a_shear_x", "v"), &SpineNewBone::set_a_shear_x);
-	ClassDB::bind_method(D_METHOD("get_a_shear_y"), &SpineNewBone::get_a_shear_y);
-	ClassDB::bind_method(D_METHOD("set_a_shear_y", "v"), &SpineNewBone::set_a_shear_y);
-	ClassDB::bind_method(D_METHOD("get_a"), &SpineNewBone::get_a);
-	ClassDB::bind_method(D_METHOD("set_a", "v"), &SpineNewBone::set_a);
-	ClassDB::bind_method(D_METHOD("get_b"), &SpineNewBone::get_b);
-	ClassDB::bind_method(D_METHOD("set_b", "v"), &SpineNewBone::set_b);
-	ClassDB::bind_method(D_METHOD("get_c"), &SpineNewBone::get_c);
-	ClassDB::bind_method(D_METHOD("set_c", "v"), &SpineNewBone::set_c);
-	ClassDB::bind_method(D_METHOD("get_d"), &SpineNewBone::get_d);
-	ClassDB::bind_method(D_METHOD("set_d", "v"), &SpineNewBone::set_d);
-	ClassDB::bind_method(D_METHOD("get_world_x"), &SpineNewBone::get_world_x);
-	ClassDB::bind_method(D_METHOD("set_world_x", "v"), &SpineNewBone::set_world_x);
-	ClassDB::bind_method(D_METHOD("get_world_y"), &SpineNewBone::get_world_y);
-	ClassDB::bind_method(D_METHOD("set_world_y", "v"), &SpineNewBone::set_world_y);
-	ClassDB::bind_method(D_METHOD("get_world_rotation_x"), &SpineNewBone::get_world_rotation_x);
-	ClassDB::bind_method(D_METHOD("get_world_rotation_y"), &SpineNewBone::get_world_rotation_y);
-	ClassDB::bind_method(D_METHOD("get_world_scale_x"), &SpineNewBone::get_world_scale_x);
-	ClassDB::bind_method(D_METHOD("get_world_scale_y"), &SpineNewBone::get_world_scale_y);
-	ClassDB::bind_method(D_METHOD("is_active"), &SpineNewBone::is_active);
-	ClassDB::bind_method(D_METHOD("set_active", "v"), &SpineNewBone::set_active);
-	ClassDB::bind_method(D_METHOD("get_godot_transform"), &SpineNewBone::get_godot_transform);
-	ClassDB::bind_method(D_METHOD("set_godot_transform", "local_transform"), &SpineNewBone::set_godot_transform);
-	ClassDB::bind_method(D_METHOD("get_godot_global_transform"), &SpineNewBone::get_godot_global_transform);
-	ClassDB::bind_method(D_METHOD("set_godot_global_transform", "global_transform"), &SpineNewBone::set_godot_global_transform);
-	ClassDB::bind_method(D_METHOD("apply_world_transform_2d", "node2d"), &SpineNewBone::apply_world_transform_2d);
-}
-
-SpineNewBone::SpineNewBone() : bone(nullptr), sprite(nullptr) {}
-
-SpineNewBone::~SpineNewBone() {}
-
-void SpineNewBone::set_spine_sprite(SpineNewSprite* sprite) {
-	this->sprite = sprite;
-}
-
-void SpineNewBone::update_world_transform() {
-	bone->updateWorldTransform();
-}
-
-void SpineNewBone::set_to_setup_pose() {
-	bone->setToSetupPose();
-}
-
-Vector2 SpineNewBone::world_to_local(Vector2 world_position) {
-	float x, y;
-	bone->worldToLocal(world_position.x, world_position.y, x, y);
-	return Vector2(x, y);
-}
-
-Vector2 SpineNewBone::local_to_world(Vector2 local_position) {
-	float x, y;
-	bone->localToWorld(local_position.x, local_position.y, x, y);
-	return Vector2(x, y);
-}
-
-float SpineNewBone::world_to_local_rotation(float world_rotation) {
-	return bone->worldToLocalRotation(world_rotation);
-}
-
-float SpineNewBone::local_to_world_rotation(float local_rotation) {
-	return bone->localToWorldRotation(local_rotation);
-}
-
-void SpineNewBone::rotate_world(float degrees) {
-	bone->rotateWorld(degrees);
-}
-
-float SpineNewBone::get_world_to_local_rotation_x() {
-	return bone->getWorldToLocalRotationX();
-}
-float SpineNewBone::get_world_to_local_rotation_y() {
-	return bone->getWorldToLocalRotationY();
-}
-
-Ref<SpineBoneData> SpineNewBone::get_data() {
-	auto &bd = bone->getData();
-	Ref<SpineBoneData> gd_bd(memnew(SpineBoneData));
-	gd_bd->set_spine_object(&bd);
-	return gd_bd;
-}
-
-Ref<SpineNewSkeleton> SpineNewBone::get_skeleton() {
-	auto &s = bone->getSkeleton();
-	Ref<SpineNewSkeleton> gd_s(memnew(SpineNewSkeleton));
-	gd_s->set_spine_object(&s);
-	gd_s->set_spine_sprite(sprite);
-	return gd_s;
-}
-
-Ref<SpineNewBone> SpineNewBone::get_parent() {
-	auto b = bone->getParent();
-	if (b == NULL) return NULL;
-	Ref<SpineNewBone> gd_b(memnew(SpineNewBone));
-	gd_b->set_spine_object(b);
-	gd_b->set_spine_sprite(sprite);
-	return gd_b;
-}
-
-Array SpineNewBone::get_children() {
-	auto bs = bone->getChildren();
-	Array gd_bs;
-	gd_bs.resize(bs.size());
-	for (size_t i = 0; i < bs.size(); ++i) {
-		auto b = bs[i];
-		if (b == NULL) gd_bs[i] = Ref<SpineNewBone>(NULL);
-		Ref<SpineNewBone> gd_b(memnew(SpineNewBone));
-		gd_b->set_spine_object(b);
-		gd_b->set_spine_sprite(sprite);
-		gd_bs[i] = gd_b;
-	}
-	return gd_bs;
-}
-
-float SpineNewBone::get_x() {
-	return bone->getX();
-}
-void SpineNewBone::set_x(float v) {
-	bone->setX(v);
-}
-
-float SpineNewBone::get_y() {
-	return bone->getY();
-}
-void SpineNewBone::set_y(float v) {
-	bone->setY(v);
-}
-
-float SpineNewBone::get_rotation() {
-	return bone->getRotation();
-}
-void SpineNewBone::set_rotation(float v) {
-	bone->setRotation(v);
-}
-
-float SpineNewBone::get_scale_x() {
-	return bone->getScaleX();
-}
-void SpineNewBone::set_scale_x(float v) {
-	bone->setScaleX(v);
-}
-
-float SpineNewBone::get_scale_y() {
-	return bone->getScaleY();
-}
-void SpineNewBone::set_scale_y(float v) {
-	bone->setScaleY(v);
-}
-
-float SpineNewBone::get_shear_x() {
-	return bone->getShearX();
-}
-void SpineNewBone::set_shear_x(float v) {
-	bone->setShearX(v);
-}
-
-float SpineNewBone::get_shear_y() {
-	return bone->getShearY();
-}
-void SpineNewBone::set_shear_y(float v) {
-	bone->setShearY(v);
-}
-
-float SpineNewBone::get_applied_rotation() {
-	return bone->getAppliedRotation();
-}
-void SpineNewBone::set_applied_rotation(float v) {
-	bone->setAppliedRotation(v);
-}
-
-float SpineNewBone::get_a_x() {
-	return bone->getAX();
-}
-void SpineNewBone::set_a_x(float v) {
-	bone->setAX(v);
-}
-
-float SpineNewBone::get_a_y() {
-	return bone->getAY();
-}
-void SpineNewBone::set_a_y(float v) {
-	bone->setAY(v);
-}
-
-float SpineNewBone::get_a_scale_x() {
-	return bone->getAScaleX();
-}
-void SpineNewBone::set_a_scale_x(float v) {
-	bone->setAScaleX(v);
-}
-
-float SpineNewBone::get_a_scale_y() {
-	return bone->getAScaleY();
-}
-void SpineNewBone::set_a_scale_y(float v) {
-	bone->setAScaleY(v);
-}
-
-float SpineNewBone::get_a_shear_x() {
-	return bone->getAShearX();
-}
-void SpineNewBone::set_a_shear_x(float v) {
-	bone->setAShearX(v);
-}
-
-float SpineNewBone::get_a_shear_y() {
-	return bone->getAShearY();
-}
-void SpineNewBone::set_a_shear_y(float v) {
-	bone->setAShearY(v);
-}
-
-float SpineNewBone::get_a() {
-	return bone->getA();
-}
-void SpineNewBone::set_a(float v) {
-	bone->setA(v);
-}
-
-float SpineNewBone::get_b() {
-	return bone->getB();
-}
-void SpineNewBone::set_b(float v) {
-	bone->setB(v);
-}
-
-float SpineNewBone::get_c() {
-	return bone->getC();
-}
-void SpineNewBone::set_c(float v) {
-	bone->setC(v);
-}
-
-float SpineNewBone::get_d() {
-	return bone->getD();
-}
-void SpineNewBone::set_d(float v) {
-	bone->setD(v);
-}
-
-float SpineNewBone::get_world_x() {
-	return bone->getWorldX();
-}
-void SpineNewBone::set_world_x(float v) {
-	bone->setWorldX(v);
-}
-
-float SpineNewBone::get_world_y() {
-	return bone->getWorldY();
-}
-void SpineNewBone::set_world_y(float v) {
-	bone->setWorldY(v);
-}
-
-float SpineNewBone::get_world_rotation_x() {
-	return bone->getWorldRotationX();
-}
-float SpineNewBone::get_world_rotation_y() {
-	return bone->getWorldRotationY();
-}
-
-float SpineNewBone::get_world_scale_x() {
-	return bone->getWorldScaleX();
-}
-float SpineNewBone::get_world_scale_y() {
-	return bone->getWorldScaleY();
-}
-
-bool SpineNewBone::is_active() {
-	return bone->isActive();
-}
-void SpineNewBone::set_active(bool v) {
-	bone->setActive(v);
-}
-
-// External feature functions
-void SpineNewBone::apply_world_transform_2d(Variant o) {
-	if (o.get_type() == Variant::OBJECT) {
-		auto node = (Node *) o;
-		if (node->is_class("Node2D")) {
-			auto node2d = (Node2D *) node;
-			// In godot the y-axis is nag to spine
-			node2d->set_transform(Transform2D(
-					get_a(), get_c(),
-					get_b(), get_d(),
-					get_world_x(), -get_world_y()));
-			// Fix the rotation
-			auto pos = node2d->get_position();
-			node2d->translate(-pos);
-			node2d->set_rotation(-node2d->get_rotation());
-			node2d->translate(pos);
-		}
-	}
-}
-
-Transform2D SpineNewBone::get_godot_transform() {
-	if (get_spine_object() == nullptr)
-		return Transform2D();
-	Transform2D trans;
-	trans.translate(get_x(), -get_y());
-	// It seems that spine uses degree for rotation
-	trans.rotate(Math::deg2rad(-get_rotation()));
-	trans.scale(Size2(get_scale_x(), get_scale_y()));
-	return trans;
-}
-
-void SpineNewBone::set_godot_transform(Transform2D trans) {
-	if (get_spine_object() == nullptr)
-		return;
-	Vector2 position = trans.get_origin();
-	position.y *= -1;
-	real_t rotation = trans.get_rotation();
-	rotation = Math::rad2deg(-rotation);
-	Vector2 scale = trans.get_scale();
-
-	set_x(position.x);
-	set_y(position.y);
-	set_rotation(rotation);
-	set_scale_x(scale.x);
-	set_scale_y(scale.y);
-}
-
-Transform2D SpineNewBone::get_godot_global_transform() {
-	if (get_spine_object() == nullptr)
-		return Transform2D();
-	if (sprite == nullptr)
-		return get_godot_transform();
-	Transform2D res = sprite->get_transform();
-	res.translate(get_world_x(), -get_world_y());
-	res.rotate(Math::deg2rad(-get_world_rotation_x()));
-	res.scale(Vector2(get_world_scale_x(), get_world_scale_y()));
-	auto p = sprite->get_parent() ? Object::cast_to<CanvasItem>(sprite->get_parent()) : nullptr;
-	if (p) {
-		return p->get_global_transform() * res;
-	}
-	return res;
-}
-
-void SpineNewBone::set_godot_global_transform(Transform2D transform) {
-	if (get_spine_object() == nullptr)
-		return;
-	if (sprite == nullptr)
-		set_godot_transform(transform);
-	transform = sprite->get_global_transform().affine_inverse() * transform;
-	Vector2 position = transform.get_origin();
-	real_t rotation = transform.get_rotation();
-	Vector2 scale = transform.get_scale();
-	position.y *= -1;
-	auto parent = get_parent();
-	if (parent.is_valid()) {
-		position = parent->world_to_local(position);
-		if (parent->get_world_scale_x() != 0)
-			scale.x /= parent->get_world_scale_x();
-		else
-			print_error("The parent scale.x is zero.");
-		if (parent->get_world_scale_y() != 0)
-			scale.y /= parent->get_world_scale_y();
-		else
-			print_error("The parent scale.y is zero.");
-	}
-	rotation = world_to_local_rotation(Math::rad2deg(-rotation));
-
-	set_x(position.x);
-	set_y(position.y);
-	set_rotation(rotation);
-	set_scale_x(scale.x);
-	set_scale_y(scale.y);
-}

+ 0 - 169
spine-godot/godot/modules/spine_godot/SpineNewBone.h

@@ -1,169 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#ifndef GODOT_SPINENEWBONE_H
-#define GODOT_SPINENEWBONE_H
-
-#include <scene/2d/node_2d.h>
-#include <spine/spine.h>
-
-#include "SpineBoneData.h"
-
-class SpineNewSkeleton;
-class SpineNewSprite;
-
-class SpineNewBone : public Reference {
-	GDCLASS(SpineNewBone, Reference);
-
-protected:
-	static void _bind_methods();
-
-private:
-	spine::Bone *bone;
-	SpineNewSprite* sprite;
-
-public:
-	SpineNewBone();
-	~SpineNewBone();
-
-	inline void set_spine_object(spine::Bone *b) {
-		bone = b;
-	}
-
-	inline spine::Bone *get_spine_object() {
-		return bone;
-	}
-
-	void set_spine_sprite(SpineNewSprite* sprite);
-
-	void update_world_transform();
-
-	void set_to_setup_pose();
-
-	Vector2 world_to_local(Vector2 world_position);
-
-	Vector2 local_to_world(Vector2 local_position);
-
-	float world_to_local_rotation(float world_rotation);
-
-	float local_to_world_rotation(float local_rotation);
-
-	void rotate_world(float degrees);
-
-	float get_world_to_local_rotation_x();
-	float get_world_to_local_rotation_y();
-
-	Ref<SpineBoneData> get_data();
-
-	Ref<SpineNewSkeleton> get_skeleton();
-
-	Ref<SpineNewBone> get_parent();
-
-	Array get_children();
-
-	float get_x();
-	void set_x(float v);
-
-	float get_y();
-	void set_y(float v);
-
-	float get_rotation();
-	void set_rotation(float v);
-
-	float get_scale_x();
-	void set_scale_x(float v);
-
-	float get_scale_y();
-	void set_scale_y(float v);
-
-	float get_shear_x();
-	void set_shear_x(float v);
-
-	float get_shear_y();
-	void set_shear_y(float v);
-
-	float get_applied_rotation();
-	void set_applied_rotation(float v);
-
-	float get_a_x();
-	void set_a_x(float v);
-
-	float get_a_y();
-	void set_a_y(float v);
-
-	float get_a_scale_x();
-	void set_a_scale_x(float v);
-
-	float get_a_scale_y();
-	void set_a_scale_y(float v);
-
-	float get_a_shear_x();
-	void set_a_shear_x(float v);
-
-	float get_a_shear_y();
-	void set_a_shear_y(float v);
-
-	float get_a();
-	void set_a(float v);
-
-	float get_b();
-	void set_b(float v);
-
-	float get_c();
-	void set_c(float v);
-
-	float get_d();
-	void set_d(float v);
-
-	float get_world_x();
-	void set_world_x(float v);
-
-	float get_world_y();
-	void set_world_y(float v);
-
-	float get_world_rotation_x();
-	float get_world_rotation_y();
-
-	float get_world_scale_x();
-	float get_world_scale_y();
-
-	bool is_active();
-	void set_active(bool v);
-
-	// External feature functions
-	void apply_world_transform_2d(Variant o);
-
-	Transform2D get_godot_transform();
-	void set_godot_transform(Transform2D trans);
-
-	Transform2D get_godot_global_transform();
-	void set_godot_global_transform(Transform2D trans);
-};
-
-#endif//GODOT_SPINEBONE_H

+ 0 - 343
spine-godot/godot/modules/spine_godot/SpineNewSkeleton.cpp

@@ -1,343 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#include "SpineNewSkeleton.h"
-
-void SpineNewSkeleton::_bind_methods() {
-	ClassDB::bind_method(D_METHOD("update_world_transform"), &SpineNewSkeleton::update_world_transform);
-	ClassDB::bind_method(D_METHOD("set_to_setup_pose"), &SpineNewSkeleton::set_to_setup_pose);
-	ClassDB::bind_method(D_METHOD("set_bones_to_setup_pose"), &SpineNewSkeleton::set_bones_to_setup_pose);
-	ClassDB::bind_method(D_METHOD("set_slots_to_setup_pose"), &SpineNewSkeleton::set_slots_to_setup_pose);
-	ClassDB::bind_method(D_METHOD("find_bone", "bone_name"), &SpineNewSkeleton::find_bone);
-	ClassDB::bind_method(D_METHOD("find_slot", "slot_name"), &SpineNewSkeleton::find_slot);
-	ClassDB::bind_method(D_METHOD("set_skin_by_name", "skin_name"), &SpineNewSkeleton::set_skin_by_name);
-	ClassDB::bind_method(D_METHOD("set_skin", "new_skin"), &SpineNewSkeleton::set_skin);
-	ClassDB::bind_method(D_METHOD("get_attachment_by_slot_name", "slot_name", "attachment_name"), &SpineNewSkeleton::get_attachment_by_slot_name);
-	ClassDB::bind_method(D_METHOD("get_attachment_by_slot_index", "slot_index", "attachment_name"), &SpineNewSkeleton::get_attachment_by_slot_index);
-	ClassDB::bind_method(D_METHOD("set_attachment", "slot_name", "attachment_name"), &SpineNewSkeleton::set_attachment);
-	ClassDB::bind_method(D_METHOD("find_ik_constraint", "constraint_name"), &SpineNewSkeleton::find_ik_constraint);
-	ClassDB::bind_method(D_METHOD("find_transform_constraint", "constraint_name"), &SpineNewSkeleton::find_transform_constraint);
-	ClassDB::bind_method(D_METHOD("find_path_constraint", "constraint_name"), &SpineNewSkeleton::find_path_constraint);
-	ClassDB::bind_method(D_METHOD("get_bounds"), &SpineNewSkeleton::get_bounds);
-	ClassDB::bind_method(D_METHOD("get_root_bone"), &SpineNewSkeleton::get_root_bone);
-	ClassDB::bind_method(D_METHOD("get_data"), &SpineNewSkeleton::get_skeleton_data_res);
-	ClassDB::bind_method(D_METHOD("get_bones"), &SpineNewSkeleton::get_bones);
-	ClassDB::bind_method(D_METHOD("get_slots"), &SpineNewSkeleton::get_slots);
-	ClassDB::bind_method(D_METHOD("get_draw_orders"), &SpineNewSkeleton::get_draw_orders);
-	ClassDB::bind_method(D_METHOD("get_ik_constraints"), &SpineNewSkeleton::get_ik_constraints);
-	ClassDB::bind_method(D_METHOD("get_path_constraints"), &SpineNewSkeleton::get_path_constraints);
-	ClassDB::bind_method(D_METHOD("get_transform_constraints"), &SpineNewSkeleton::get_transform_constraints);
-	ClassDB::bind_method(D_METHOD("get_skin"), &SpineNewSkeleton::get_skin);
-	ClassDB::bind_method(D_METHOD("get_color"), &SpineNewSkeleton::get_color);
-	ClassDB::bind_method(D_METHOD("set_color", "v"), &SpineNewSkeleton::set_color);
-	ClassDB::bind_method(D_METHOD("set_position", "pos"), &SpineNewSkeleton::set_position);
-	ClassDB::bind_method(D_METHOD("get_x"), &SpineNewSkeleton::get_x);
-	ClassDB::bind_method(D_METHOD("set_x", "v"), &SpineNewSkeleton::set_x);
-	ClassDB::bind_method(D_METHOD("get_y"), &SpineNewSkeleton::get_y);
-	ClassDB::bind_method(D_METHOD("set_y", "v"), &SpineNewSkeleton::set_y);
-	ClassDB::bind_method(D_METHOD("get_scale_x"), &SpineNewSkeleton::get_scale_x);
-	ClassDB::bind_method(D_METHOD("set_scale_x", "v"), &SpineNewSkeleton::set_scale_x);
-	ClassDB::bind_method(D_METHOD("get_scale_y"), &SpineNewSkeleton::get_scale_y);
-	ClassDB::bind_method(D_METHOD("set_scale_y", "v"), &SpineNewSkeleton::set_scale_y);
-}
-
-SpineNewSkeleton::SpineNewSkeleton() : skeleton(nullptr), sprite(nullptr), skeleton_data_res(nullptr) {
-}
-
-SpineNewSkeleton::~SpineNewSkeleton() {
-	delete skeleton;
-}
-
-void SpineNewSkeleton::set_skeleton_data_res(Ref<SpineNewSkeletonDataResource> data_res) {
-	delete skeleton;
-	skeleton = nullptr;
-	skeleton_data_res = data_res;
-	if (!data_res.is_valid() || !data_res->is_skeleton_data_loaded()) return;
-	skeleton = new spine::Skeleton(data_res->get_skeleton_data());
-}
-
-Ref<SpineNewSkeletonDataResource> SpineNewSkeleton::get_skeleton_data_res() const {
-	return skeleton_data_res;
-}
-
-void SpineNewSkeleton::set_spine_sprite(SpineNewSprite* sprite) {
-	this->sprite = sprite;
-}
-
-#define S_T(x) (spine::String((x).utf8()))
-void SpineNewSkeleton::update_world_transform() {
-	skeleton->updateWorldTransform();
-}
-
-void SpineNewSkeleton::set_to_setup_pose() {
-	skeleton->setToSetupPose();
-}
-
-void SpineNewSkeleton::set_bones_to_setup_pose() {
-	skeleton->setBonesToSetupPose();
-}
-
-void SpineNewSkeleton::set_slots_to_setup_pose() {
-	skeleton->setSlotsToSetupPose();
-}
-
-Ref<SpineNewBone> SpineNewSkeleton::find_bone(const String &name) {
-	if (name.empty()) return nullptr;
-	auto bone = skeleton->findBone(S_T(name));
-	if (!bone) return nullptr;
-	Ref<SpineNewBone> bone_ref(memnew(SpineNewBone));
-	bone_ref->set_spine_object(bone);
-	bone_ref->set_spine_sprite(sprite);
-	return bone_ref;
-}
-
-Ref<SpineSlot> SpineNewSkeleton::find_slot(const String &name) {
-	if (name.empty()) return nullptr;
-	auto slot = skeleton->findSlot(S_T(name));
-	if (!slot) return nullptr;
-	Ref<SpineSlot> slot_ref(memnew(SpineSlot));
-	slot_ref->set_spine_object(slot);
-	return slot_ref;
-}
-
-void SpineNewSkeleton::set_skin_by_name(const String &skin_name) {
-	skeleton->setSkin(S_T(skin_name));
-}
-void SpineNewSkeleton::set_skin(Ref<SpineSkin> new_skin) {
-	if (new_skin.is_valid())
-		skeleton->setSkin(new_skin->get_spine_object());
-	else
-		skeleton->setSkin(nullptr);
-}
-
-Ref<SpineAttachment> SpineNewSkeleton::get_attachment_by_slot_name(const String &slot_name, const String &attachment_name) {
-	auto a = skeleton->getAttachment(S_T(slot_name), S_T(attachment_name));
-	if (a == nullptr) return nullptr;
-	Ref<SpineAttachment> gd_a(memnew(SpineAttachment));
-	gd_a->set_spine_object(a);
-	return gd_a;
-}
-
-Ref<SpineAttachment> SpineNewSkeleton::get_attachment_by_slot_index(int slot_index, const String &attachment_name) {
-	auto a = skeleton->getAttachment(slot_index, S_T(attachment_name));
-	if (a == nullptr) return nullptr;
-	Ref<SpineAttachment> gd_a(memnew(SpineAttachment));
-	gd_a->set_spine_object(a);
-	return gd_a;
-}
-
-void SpineNewSkeleton::set_attachment(const String &slot_name, const String &attachment_name) {
-	ERR_FAIL_COND(slot_name.empty());
-	ERR_FAIL_COND(get_attachment_by_slot_name(slot_name, attachment_name) == nullptr);
-	skeleton->setAttachment(S_T(slot_name), S_T(attachment_name));
-}
-
-Ref<SpineIkConstraint> SpineNewSkeleton::find_ik_constraint(const String &constraint_name) {
-	if (constraint_name.empty()) return nullptr;
-	auto c = skeleton->findIkConstraint(S_T(constraint_name));
-	if (c == nullptr) return nullptr;
-	Ref<SpineIkConstraint> gd_c(memnew(SpineIkConstraint));
-	gd_c->set_spine_object(c);
-	return gd_c;
-}
-Ref<SpineTransformConstraint> SpineNewSkeleton::find_transform_constraint(const String &constraint_name) {
-	if (constraint_name.empty()) return nullptr;
-	auto c = skeleton->findTransformConstraint(S_T(constraint_name));
-	if (c == nullptr) return nullptr;
-	Ref<SpineTransformConstraint> gd_c(memnew(SpineTransformConstraint));
-	gd_c->set_spine_object(c);
-	return gd_c;
-}
-Ref<SpinePathConstraint> SpineNewSkeleton::find_path_constraint(const String &constraint_name) {
-	if (constraint_name.empty()) return nullptr;
-	auto c = skeleton->findPathConstraint(S_T(constraint_name));
-	if (c == nullptr) return nullptr;
-	Ref<SpinePathConstraint> gd_c(memnew(SpinePathConstraint));
-	gd_c->set_spine_object(c);
-	return gd_c;
-}
-
-Dictionary SpineNewSkeleton::get_bounds() {
-	float x, y, w, h;
-	spine::Vector<float> vertex_buffer;
-	skeleton->getBounds(x, y, w, h, vertex_buffer);
-
-	Dictionary res;
-	res["x"] = x;
-	res["y"] = y;
-	res["w"] = w;
-	res["h"] = h;
-
-	Array gd_a;
-	gd_a.resize(vertex_buffer.size());
-	for (size_t i = 0; i < gd_a.size(); ++i) {
-		gd_a[i] = vertex_buffer[i];
-	}
-	res["vertex_buffer"] = gd_a;
-
-	return res;
-}
-
-Ref<SpineNewBone> SpineNewSkeleton::get_root_bone() {
-	auto b = skeleton->getRootBone();
-	if (b == nullptr) return nullptr;
-	Ref<SpineNewBone> gd_b(memnew(SpineNewBone));
-	gd_b->set_spine_object(b);
-	gd_b->set_spine_sprite(sprite);
-	return gd_b;
-}
-
-Array SpineNewSkeleton::get_bones() {
-	auto &as = skeleton->getBones();
-	Array gd_as;
-	gd_as.resize(as.size());
-	for (size_t i = 0; i < gd_as.size(); ++i) {
-		auto b = as[i];
-		if (b == nullptr) gd_as[i] = Ref<SpineNewBone>(nullptr);
-		Ref<SpineNewBone> gd_a(memnew(SpineNewBone));
-		gd_a->set_spine_object(b);
-		gd_a->set_spine_sprite(sprite);
-		gd_as[i] = gd_a;
-	}
-	return gd_as;
-}
-Array SpineNewSkeleton::get_slots() {
-	auto &as = skeleton->getSlots();
-	Array gd_as;
-	gd_as.resize(as.size());
-	for (size_t i = 0; i < gd_as.size(); ++i) {
-		auto b = as[i];
-		if (b == nullptr) gd_as[i] = Ref<SpineSlot>(nullptr);
-		Ref<SpineSlot> gd_a(memnew(SpineSlot));
-		gd_a->set_spine_object(b);
-		gd_as[i] = gd_a;
-	}
-	return gd_as;
-}
-Array SpineNewSkeleton::get_draw_orders() {
-	auto &as = skeleton->getDrawOrder();
-	Array gd_as;
-	gd_as.resize(as.size());
-	for (size_t i = 0; i < gd_as.size(); ++i) {
-		auto b = as[i];
-		if (b == nullptr) gd_as[i] = Ref<SpineSlot>(nullptr);
-		Ref<SpineSlot> gd_a(memnew(SpineSlot));
-		gd_a->set_spine_object(b);
-		gd_as[i] = gd_a;
-	}
-	return gd_as;
-}
-Array SpineNewSkeleton::get_ik_constraints() {
-	auto &as = skeleton->getIkConstraints();
-	Array gd_as;
-	gd_as.resize(as.size());
-	for (size_t i = 0; i < gd_as.size(); ++i) {
-		auto b = as[i];
-		if (b == nullptr) gd_as[i] = Ref<SpineIkConstraint>(nullptr);
-		Ref<SpineIkConstraint> gd_a(memnew(SpineIkConstraint));
-		gd_a->set_spine_object(b);
-		gd_as[i] = gd_a;
-	}
-	return gd_as;
-}
-Array SpineNewSkeleton::get_path_constraints() {
-	auto &as = skeleton->getPathConstraints();
-	Array gd_as;
-	gd_as.resize(as.size());
-	for (size_t i = 0; i < gd_as.size(); ++i) {
-		auto b = as[i];
-		if (b == nullptr) gd_as[i] = Ref<SpinePathConstraint>(nullptr);
-		Ref<SpinePathConstraint> gd_a(memnew(SpinePathConstraint));
-		gd_a->set_spine_object(b);
-		gd_as[i] = gd_a;
-	}
-	return gd_as;
-}
-Array SpineNewSkeleton::get_transform_constraints() {
-	auto &as = skeleton->getTransformConstraints();
-	Array gd_as;
-	gd_as.resize(as.size());
-	for (size_t i = 0; i < gd_as.size(); ++i) {
-		auto b = as[i];
-		if (b == nullptr) gd_as[i] = Ref<SpineTransformConstraint>(nullptr);
-		Ref<SpineTransformConstraint> gd_a(memnew(SpineTransformConstraint));
-		gd_a->set_spine_object(b);
-		gd_as[i] = gd_a;
-	}
-	return gd_as;
-}
-
-Ref<SpineSkin> SpineNewSkeleton::get_skin() {
-	auto s = skeleton->getSkin();
-	if (s == nullptr) return nullptr;
-	Ref<SpineSkin> gd_s(memnew(SpineSkin));
-	gd_s->set_spine_object(s);
-	return gd_s;
-}
-
-Color SpineNewSkeleton::get_color() {
-	auto &c = skeleton->getColor();
-	return Color(c.r, c.g, c.b, c.a);
-}
-void SpineNewSkeleton::set_color(Color v) {
-	auto &c = skeleton->getColor();
-	c.set(v.r, v.g, v.b, v.a);
-}
-
-void SpineNewSkeleton::set_position(Vector2 pos) {
-	skeleton->setPosition(pos.x, pos.y);
-}
-
-float SpineNewSkeleton::get_x() {
-	return skeleton->getX();
-}
-void SpineNewSkeleton::set_x(float v) {
-	skeleton->setX(v);
-}
-
-float SpineNewSkeleton::get_y() {
-	return skeleton->getY();
-}
-void SpineNewSkeleton::set_y(float v) {
-	skeleton->setY(v);
-}
-
-float SpineNewSkeleton::get_scale_x() {
-	return skeleton->getScaleX();
-}
-void SpineNewSkeleton::set_scale_x(float v) {
-	skeleton->setScaleX(v);
-}
-
-float SpineNewSkeleton::get_scale_y() {
-	return skeleton->getScaleY();
-}
-void SpineNewSkeleton::set_scale_y(float v) {
-	skeleton->setScaleY(v);
-}

+ 0 - 125
spine-godot/godot/modules/spine_godot/SpineNewSkeleton.h

@@ -1,125 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#ifndef GODOT_SPINENEWSKELETON_H
-#define GODOT_SPINENEWSKELETON_H
-
-#include <spine/spine.h>
-
-#include "SpineNewSkeletonDataResource.h"
-#include "SpineNewBone.h"
-#include "SpineSlot.h"
-#include "SpineIkConstraint.h"
-#include "SpineTransformConstraint.h"
-
-class SpineNewSprite;
-
-class SpineNewSkeleton : public Reference {
-	GDCLASS(SpineNewSkeleton, Reference);
-
-protected:
-	static void _bind_methods();
-
-private:
-	spine::Skeleton *skeleton;
-	SpineNewSprite *sprite;
-	Ref<SpineNewSkeletonDataResource> skeleton_data_res;
-
-public:
-	SpineNewSkeleton();
-	~SpineNewSkeleton();
-
-	void set_skeleton_data_res(Ref<SpineNewSkeletonDataResource> data_res);
-	Ref<SpineNewSkeletonDataResource> get_skeleton_data_res() const;
-
-	inline void set_spine_object(spine::Skeleton *s) {
-		skeleton = s;
-	}
-	inline spine::Skeleton *get_spine_object() {
-		return skeleton;
-	}
-
-	void set_spine_sprite(SpineNewSprite *sprite);
-
-	void update_world_transform();
-
-	void set_to_setup_pose();
-
-	void set_bones_to_setup_pose();
-
-	void set_slots_to_setup_pose();
-
-	Ref<SpineNewBone> find_bone(const String &name);
-
-	Ref<SpineSlot> find_slot(const String &name);
-
-	void set_skin_by_name(const String &skin_name);
-	void set_skin(Ref<SpineSkin> new_skin);
-
-	Ref<SpineAttachment> get_attachment_by_slot_name(const String &slot_name, const String &attachment_name);
-	Ref<SpineAttachment> get_attachment_by_slot_index(int slot_index, const String &attachment_name);
-
-	void set_attachment(const String &slot_name, const String &attachment_name);
-
-	Ref<SpineIkConstraint> find_ik_constraint(const String &constraint_name);
-	Ref<SpineTransformConstraint> find_transform_constraint(const String &constraint_name);
-	Ref<SpinePathConstraint> find_path_constraint(const String &constraint_name);
-
-	Dictionary get_bounds();
-
-	Ref<SpineNewBone> get_root_bone();
-
-	Array get_bones();
-	Array get_slots();
-	Array get_draw_orders();
-	Array get_ik_constraints();
-	Array get_path_constraints();
-	Array get_transform_constraints();
-
-	Ref<SpineSkin> get_skin();
-
-	Color get_color();
-	void set_color(Color v);
-
-	void set_position(Vector2 pos);
-
-	float get_x();
-	void set_x(float v);
-
-	float get_y();
-	void set_y(float v);
-
-	float get_scale_x();
-	void set_scale_x(float v);
-
-	float get_scale_y();
-	void set_scale_y(float v);
-};
-
-#endif//GODOT_SPINENEWSKELETON_H

+ 0 - 446
spine-godot/godot/modules/spine_godot/SpineNewSkeletonDataResource.cpp

@@ -1,446 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#include "SpineNewSkeletonDataResource.h"
-
-#ifdef TOOLS_ENABLED
-#include "editor/editor_node.h"
-#include "editor/editor_inspector.h"
-#endif
-
-void SpineNewSkeletonDataResource::_bind_methods() {
-	ClassDB::bind_method(D_METHOD("is_skeleton_data_loaded"), &SpineNewSkeletonDataResource::is_skeleton_data_loaded);
-	ClassDB::bind_method(D_METHOD("set_atlas_res", "atlas_res"), &SpineNewSkeletonDataResource::set_atlas_res);
-	ClassDB::bind_method(D_METHOD("get_atlas_res"), &SpineNewSkeletonDataResource::get_atlas_res);
-	ClassDB::bind_method(D_METHOD("set_skeleton_file_res", "skeleton_file_res"), &SpineNewSkeletonDataResource::set_skeleton_file_res);
-	ClassDB::bind_method(D_METHOD("get_skeleton_file_res"), &SpineNewSkeletonDataResource::get_skeleton_file_res);
-
-	// Spine API
-	ClassDB::bind_method(D_METHOD("find_bone", "bone_name"), &SpineNewSkeletonDataResource::find_bone);
-	ClassDB::bind_method(D_METHOD("find_slot", "slot_name"), &SpineNewSkeletonDataResource::find_slot);
-	ClassDB::bind_method(D_METHOD("find_skin", "skin_name"), &SpineNewSkeletonDataResource::find_skin);
-	ClassDB::bind_method(D_METHOD("find_event", "event_data_name"), &SpineNewSkeletonDataResource::find_event);
-	ClassDB::bind_method(D_METHOD("find_animation", "animation_name"), &SpineNewSkeletonDataResource::find_animation);
-	ClassDB::bind_method(D_METHOD("find_ik_constraint_data", "constraint_name"), &SpineNewSkeletonDataResource::find_ik_constraint);
-	ClassDB::bind_method(D_METHOD("find_transform_constraint_data", "constraint_name"), &SpineNewSkeletonDataResource::find_transform_constraint);
-	ClassDB::bind_method(D_METHOD("find_path_constraint_data", "constraint_name"), &SpineNewSkeletonDataResource::find_path_constraint);
-	ClassDB::bind_method(D_METHOD("get_skeleton_name"), &SpineNewSkeletonDataResource::get_skeleton_name);
-	ClassDB::bind_method(D_METHOD("get_bones"), &SpineNewSkeletonDataResource::get_bones);
-	ClassDB::bind_method(D_METHOD("get_slots"), &SpineNewSkeletonDataResource::get_slots);
-	ClassDB::bind_method(D_METHOD("get_skins"), &SpineNewSkeletonDataResource::get_skins);
-	ClassDB::bind_method(D_METHOD("get_default_skin"), &SpineNewSkeletonDataResource::get_default_skin);
-	ClassDB::bind_method(D_METHOD("set_default_skin", "skin"), &SpineNewSkeletonDataResource::set_default_skin);
-	ClassDB::bind_method(D_METHOD("get_events"), &SpineNewSkeletonDataResource::get_events);
-	ClassDB::bind_method(D_METHOD("get_animations"), &SpineNewSkeletonDataResource::get_animations);
-	ClassDB::bind_method(D_METHOD("get_ik_constraints"), &SpineNewSkeletonDataResource::get_ik_constraints);
-	ClassDB::bind_method(D_METHOD("get_transform_constraints"), &SpineNewSkeletonDataResource::get_transform_constraints);
-	ClassDB::bind_method(D_METHOD("get_path_constraints"), &SpineNewSkeletonDataResource::get_path_constraints);
-	ClassDB::bind_method(D_METHOD("get_x"), &SpineNewSkeletonDataResource::get_x);
-	ClassDB::bind_method(D_METHOD("get_y"), &SpineNewSkeletonDataResource::get_y);
-	ClassDB::bind_method(D_METHOD("get_width"), &SpineNewSkeletonDataResource::get_width);
-	ClassDB::bind_method(D_METHOD("get_height"), &SpineNewSkeletonDataResource::get_height);
-	ClassDB::bind_method(D_METHOD("get_version"), &SpineNewSkeletonDataResource::get_version);
-	ClassDB::bind_method(D_METHOD("get_hash"), &SpineNewSkeletonDataResource::get_hash);
-	ClassDB::bind_method(D_METHOD("get_images_path"), &SpineNewSkeletonDataResource::get_images_path);
-	ClassDB::bind_method(D_METHOD("get_audio_path"), &SpineNewSkeletonDataResource::get_audio_path);
-	ClassDB::bind_method(D_METHOD("get_fps"), &SpineNewSkeletonDataResource::get_fps);
-
-	ADD_SIGNAL(MethodInfo("skeleton_data_changed"));
-
-	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "atlas_res", PropertyHint::PROPERTY_HINT_RESOURCE_TYPE, "SpineAtlasResource"), "set_atlas_res", "get_atlas_res");
-	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "skeleton_file_res", PropertyHint::PROPERTY_HINT_RESOURCE_TYPE, "SpineSkeletonFileResource"), "set_skeleton_file_res", "get_skeleton_file_res");
-}
-
-SpineNewSkeletonDataResource::SpineNewSkeletonDataResource() : skeleton_data(nullptr), animation_state_data(nullptr) {
-}
-
-SpineNewSkeletonDataResource::~SpineNewSkeletonDataResource() {
-	delete skeleton_data;
-	delete animation_state_data;
-}
-
-void SpineNewSkeletonDataResource::update_skeleton_data() {
-	if (skeleton_data) {
-		delete skeleton_data;
-		skeleton_data = nullptr;
-	}
-	if (animation_state_data) {
-		delete animation_state_data;
-		animation_state_data = nullptr;
-	}
-
-	if (atlas_res.is_valid() && skeleton_file_res.is_valid()) {
-		load_res(atlas_res->get_spine_atlas(), skeleton_file_res->get_json(), skeleton_file_res->get_binary());
-	}
-	emit_signal("skeleton_data_changed");
-#ifdef TOOLS_ENABLED
-	property_list_changed_notify();
-#endif
-}
-
-void SpineNewSkeletonDataResource::load_res(spine::Atlas *atlas, const String &json, const Vector<uint8_t> &binary) {
-	if ((json.empty() && binary.empty()) || atlas == nullptr) return;
-
-	spine::SkeletonData *data;
-	if (!json.empty()) {
-		spine::SkeletonJson skeletonJson(atlas);
-		data = skeletonJson.readSkeletonData(json.utf8());
-		if (!data) {
-			print_error(String("Error while loading skeleton data: ") + get_path());
-			print_error(String("Error message: ") + skeletonJson.getError().buffer());
-			return;
-		}
-	} else {
-		spine::SkeletonBinary skeletonBinary(atlas);
-		data = skeletonBinary.readSkeletonData(binary.ptr(), binary.size());
-		if (!data) {
-			print_error(String("Error while loading skeleton data: ") + get_path());
-			print_error(String("Error message: ") + skeletonBinary.getError().buffer());
-			return;
-		}
-	}
-	skeleton_data = data;
-	animation_state_data = new spine::AnimationStateData(data);
-}
-
-bool SpineNewSkeletonDataResource::is_skeleton_data_loaded() const {
-	return skeleton_data != nullptr;
-}
-
-void SpineNewSkeletonDataResource::set_atlas_res(const Ref<SpineAtlasResource> &atlas) {
-	atlas_res = atlas;
-	update_skeleton_data();
-}
-Ref<SpineAtlasResource> SpineNewSkeletonDataResource::get_atlas_res() {
-	return atlas_res;
-}
-
-void SpineNewSkeletonDataResource::set_skeleton_file_res(const Ref<SpineSkeletonFileResource> &skeleton_file) {
-	skeleton_file_res = skeleton_file;
-	update_skeleton_data();
-}
-Ref<SpineSkeletonFileResource> SpineNewSkeletonDataResource::get_skeleton_file_res() {
-	return skeleton_file_res;
-}
-
-void SpineNewSkeletonDataResource::get_animation_names(Vector<String> &animation_names) const {
-	animation_names.clear();
-	if (!is_skeleton_data_loaded()) return;
-	auto animations = skeleton_data->getAnimations();
-	for (size_t i = 0; i < animations.size(); ++i) {
-		auto animation = animations[i];
-		animation_names.push_back(animation->getName().buffer());
-	}
-}
-
-void SpineNewSkeletonDataResource::get_skin_names(Vector<String> &skin_names) const {
-	skin_names.clear();
-	if (!is_skeleton_data_loaded()) return;
-	auto skins = skeleton_data->getSkins();
-	for (size_t i = 0; i < skins.size(); ++i) {
-		auto skin = skins[i];
-		skin_names.push_back(skin->getName().buffer());
-	}
-}
-
-void SpineNewSkeletonDataResource::_get_property_list(List<PropertyInfo> *p_list) const {
-	PropertyInfo property;
-	Vector<String> animation_names;
-
-	property.name = "animations";
-	property.type = Variant::STRING;
-	get_animation_names(animation_names);
-	property.hint_string = String(",").join(animation_names);
-	property.hint = PROPERTY_HINT_ENUM;
-	p_list->push_back(property);
-
-	property.name = "skins";
-	property.type = Variant::STRING;
-	get_skin_names(animation_names);
-	property.hint_string = String(",").join(animation_names);
-	property.hint = PROPERTY_HINT_ENUM;
-	p_list->push_back(property);
-}
-
-#define CHECK(x)                                      \
-	if (!is_skeleton_data_loaded()) {                   \
-		ERR_PRINT("skeleton data has not loaded yet!"); \
-		return x;                                       \
-	}
-
-#define S_T(x) (spine::String((x).utf8()))
-Ref<SpineAnimation> SpineNewSkeletonDataResource::find_animation(const String &animation_name) const {
-	CHECK(nullptr)
-	if (animation_name.empty()) return nullptr;
-	auto animation = skeleton_data->findAnimation(S_T(animation_name));
-	if (!animation) return nullptr;
-	Ref<SpineAnimation> animation_ref(memnew(SpineAnimation));
-	animation_ref->set_spine_object(animation);
-	return animation_ref;
-}
-
-Ref<SpineBoneData> SpineNewSkeletonDataResource::find_bone(const String &bone_name) const {
-	CHECK(nullptr)
-	if (bone_name.empty()) return nullptr;
-	auto bone = skeleton_data->findBone(S_T(bone_name));
-	if (bone == nullptr) return nullptr;
-	Ref<SpineBoneData> bone_ref(memnew(SpineBoneData));
-	bone_ref->set_spine_object(bone);
-	return bone_ref;
-}
-
-Ref<SpineSlotData> SpineNewSkeletonDataResource::find_slot(const String &slot_name) const {
-	CHECK(nullptr)
-	if (slot_name.empty()) return nullptr;
-	auto slot = skeleton_data->findSlot(S_T(slot_name));
-	if (slot == nullptr) return nullptr;
-	Ref<SpineSlotData> slot_ref(memnew(SpineSlotData));
-	slot_ref->set_spine_object(slot);
-	return slot_ref;
-}
-
-Ref<SpineSkin> SpineNewSkeletonDataResource::find_skin(const String &skin_name) const {
-	CHECK(nullptr)
-	if (skin_name.empty()) return nullptr;
-	auto skin = skeleton_data->findSkin(S_T(skin_name));
-	if (skin == nullptr) return nullptr;
-	Ref<SpineSkin> skin_ref(memnew(SpineSkin));
-	skin_ref->set_spine_object(skin);
-	return skin_ref;
-}
-
-Ref<SpineEventData> SpineNewSkeletonDataResource::find_event(const String &event_data_name) const {
-	CHECK(nullptr)
-	if (event_data_name.empty()) return nullptr;
-	auto event = skeleton_data->findEvent(S_T(event_data_name));
-	if (event == nullptr) return nullptr;
-	Ref<SpineEventData> event_ref(memnew(SpineEventData));
-	event_ref->set_spine_object(event);
-	return event_ref;
-}
-
-Ref<SpineIkConstraintData> SpineNewSkeletonDataResource::find_ik_constraint(const String &constraint_name) const {
-	CHECK(nullptr)
-	if (constraint_name.empty()) return nullptr;
-	auto constraint = skeleton_data->findIkConstraint(S_T(constraint_name));
-	if (constraint == nullptr) return nullptr;
-	Ref<SpineIkConstraintData> constraint_ref(memnew(SpineIkConstraintData));
-	constraint_ref->set_spine_object(constraint);
-	return constraint_ref;
-}
-Ref<SpineTransformConstraintData> SpineNewSkeletonDataResource::find_transform_constraint(const String &constraint_name) const {
-	CHECK(nullptr)
-	if (constraint_name.empty()) return nullptr;
-	auto constraint = skeleton_data->findTransformConstraint(S_T(constraint_name));
-	if (constraint == nullptr) return nullptr;
-	Ref<SpineTransformConstraintData> constraint_ref(memnew(SpineTransformConstraintData));
-	constraint_ref->set_spine_object(constraint);
-	return constraint_ref;
-}
-Ref<SpinePathConstraintData> SpineNewSkeletonDataResource::find_path_constraint(const String &constraint_name) const {
-	CHECK(nullptr)
-	if (constraint_name.empty()) return nullptr;
-	auto constraint = skeleton_data->findPathConstraint(S_T(constraint_name));
-	if (constraint == nullptr) return nullptr;
-	Ref<SpinePathConstraintData> constraint_ref(memnew(SpinePathConstraintData));
-	constraint_ref->set_spine_object(constraint);
-	return constraint_ref;
-}
-
-String SpineNewSkeletonDataResource::get_skeleton_name() const{
-	CHECK("")
-	return skeleton_data->getName().buffer();
-}
-
-Array SpineNewSkeletonDataResource::get_bones() const {
-	Array bone_refs;
-	CHECK(bone_refs)
-	auto bones = skeleton_data->getBones();
-	bone_refs.resize((int)bones.size());
-	for (int i = 0; i < bones.size(); ++i) {
-		Ref<SpineBoneData> bone_ref(memnew(SpineBoneData));
-		bone_ref->set_spine_object(bones[i]);
-		bone_refs[i] = bone_ref;
-	}
-	return bone_refs;
-}
-
-Array SpineNewSkeletonDataResource::get_slots() const {
-	Array slot_refs;
-	CHECK(slot_refs)
-	auto slots = skeleton_data->getSlots();
-	slot_refs.resize((int)slots.size());
-	for (int i = 0; i < slots.size(); ++i) {
-		Ref<SpineSlotData> slot_ref(memnew(SpineSlotData));
-		slot_ref->set_spine_object(slots[i]);
-		slot_refs[i] = slot_ref;
-	}
-	return slot_refs;
-}
-
-Array SpineNewSkeletonDataResource::get_skins() const {
-	Array skin_refs;
-	CHECK(skin_refs)
-	auto skins = skeleton_data->getSkins();
-	skin_refs.resize((int)skins.size());
-	for (int i = 0; i < skins.size(); ++i) {
-		Ref<SpineSkin> skin_ref(memnew(SpineSkin));
-		skin_ref->set_spine_object(skins[i]);
-		skin_refs[i] = skin_ref;
-	}
-	return skin_refs;
-}
-
-Ref<SpineSkin> SpineNewSkeletonDataResource::get_default_skin() const {
-	CHECK(nullptr)
-	auto skin = skeleton_data->getDefaultSkin();
-	if (skin == nullptr) return nullptr;
-	Ref<SpineSkin> skin_ref(memnew(SpineSkin));
-	skin_ref->set_spine_object(skin);
-	return skin_ref;
-}
-
-void SpineNewSkeletonDataResource::set_default_skin(Ref<SpineSkin> skin) {
-	CHECK()
-	if (skin.is_valid())
-		skeleton_data->setDefaultSkin(skin->get_spine_object());
-	else
-		skeleton_data->setDefaultSkin(nullptr);
-}
-
-Array SpineNewSkeletonDataResource::get_events() const {
-	Array event_refs;
-	CHECK(event_refs)
-	auto events = skeleton_data->getEvents();
-	event_refs.resize((int)events.size());
-	for (int i = 0; i < events.size(); ++i) {
-		Ref<SpineEventData> event_ref(memnew(SpineEventData));
-		event_ref->set_spine_object(events[i]);
-		event_refs[i] = event_ref;
-	}
-	return event_refs;
-}
-
-Array SpineNewSkeletonDataResource::get_animations() const {
-	Array animation_refs;
-	CHECK(animation_refs)
-	auto animations = skeleton_data->getAnimations();
-	animation_refs.resize((int)animations.size());
-	for (int i = 0; i < animations.size(); ++i) {
-		Ref<SpineAnimation> animation_ref(memnew(SpineAnimation));
-		animation_ref->set_spine_object(animations[i]);
-		animation_refs[i] = animation_ref;
-	}
-	return animation_refs;
-}
-
-Array SpineNewSkeletonDataResource::get_ik_constraints() const {
-	Array constraint_refs;
-	CHECK(constraint_refs)
-	auto constraints = skeleton_data->getIkConstraints();
-	constraint_refs.resize((int)constraints.size());
-	for (int i = 0; i < constraints.size(); ++i) {
-		Ref<SpineIkConstraintData> constraint_ref(memnew(SpineIkConstraintData));
-		constraint_ref->set_spine_object(constraints[i]);
-		constraint_refs[i] = constraint_ref;
-	}
-	return constraint_refs;
-}
-
-Array SpineNewSkeletonDataResource::get_transform_constraints() const {
-	Array constraint_refs;
-	CHECK(constraint_refs)
-	auto constraints = skeleton_data->getTransformConstraints();
-	constraint_refs.resize((int)constraints.size());
-	for (int i = 0; i < constraints.size(); ++i) {
-		Ref<SpineTransformConstraintData> constraint_ref(memnew(SpineTransformConstraintData));
-		constraint_ref->set_spine_object(constraints[i]);
-		constraint_refs[i] = constraint_ref;
-	}
-	return constraint_refs;
-}
-
-Array SpineNewSkeletonDataResource::get_path_constraints() const {
-	Array constraint_refs;
-	CHECK(constraint_refs)
-	auto constraints = skeleton_data->getPathConstraints();
-	constraint_refs.resize((int)constraints.size());
-	for (int i = 0; i < constraints.size(); ++i) {
-		Ref<SpinePathConstraintData> constraint_ref(memnew(SpinePathConstraintData));
-		constraint_ref->set_spine_object(constraints[i]);
-		constraint_refs[i] = constraint_ref;
-	}
-	return constraint_refs;
-}
-
-float SpineNewSkeletonDataResource::get_x() const{
-	CHECK(0)
-	return skeleton_data->getX();
-}
-
-float SpineNewSkeletonDataResource::get_y() const {
-	CHECK(0)
-	return skeleton_data->getY();
-}
-
-float SpineNewSkeletonDataResource::get_width() const{
-	CHECK(0)
-	return skeleton_data->getWidth();
-}
-
-float SpineNewSkeletonDataResource::get_height() const {
-	CHECK(0)
-	return skeleton_data->getHeight();
-}
-
-String SpineNewSkeletonDataResource::get_version() const {
-	CHECK("")
-	return skeleton_data->getVersion().buffer();
-}
-
-String SpineNewSkeletonDataResource::get_hash() const {
-	CHECK("")
-	return skeleton_data->getHash().buffer();
-}
-
-
-String SpineNewSkeletonDataResource::get_images_path() const {
-	CHECK("")
-	return skeleton_data->getImagesPath().buffer();
-}
-
-String SpineNewSkeletonDataResource::get_audio_path() const {
-	CHECK("")
-	return skeleton_data->getAudioPath().buffer();
-}
-
-float SpineNewSkeletonDataResource::get_fps() const {
-	CHECK(0)
-	return skeleton_data->getFps();
-}

+ 0 - 113
spine-godot/godot/modules/spine_godot/SpineNewSkeletonDataResource.h

@@ -1,113 +0,0 @@
-#ifndef GODOT_SPINENEWSKELETONDATARESOURCE_H
-#define GODOT_SPINENEWSKELETONDATARESOURCE_H
-
-#include "SpineAtlasResource.h"
-#include "SpineSkeletonFileResource.h"
-#include "SpineAnimation.h"
-#include "SpineBoneData.h"
-#include "SpineSlotData.h"
-#include "SpineSkin.h"
-#include "SpineIkConstraintData.h"
-#include "SpineTransformConstraintData.h"
-#include "SpinePathConstraintData.h"
-#include "SpineEventData.h"
-
-class SpineNewSkeletonDataResource : public Resource {
-	GDCLASS(SpineNewSkeletonDataResource, Resource);
-
-protected:
-	static void _bind_methods();
-
-private:
-	Ref<SpineAtlasResource> atlas_res;
-	Ref<SpineSkeletonFileResource> skeleton_file_res;
-
-	spine::SkeletonData *skeleton_data;
-	spine::AnimationStateData *animation_state_data;
-
-	void update_skeleton_data();
-
-	void load_res(spine::Atlas *atlas, const String &json, const Vector<uint8_t> &binary);
-
-public:
-	SpineNewSkeletonDataResource();
-	virtual ~SpineNewSkeletonDataResource();
-
-	bool is_skeleton_data_loaded() const;
-
-	void set_atlas_res(const Ref<SpineAtlasResource> &atlas);
-	Ref<SpineAtlasResource> get_atlas_res();
-
-	void set_skeleton_file_res(const Ref<SpineSkeletonFileResource> &skeleton_file);
-	Ref<SpineSkeletonFileResource> get_skeleton_file_res();
-
-	inline spine::SkeletonData *get_skeleton_data() const { return skeleton_data; }
-
-	inline spine::AnimationStateData *get_animation_state_data() const { return animation_state_data; }
-
-	void get_animation_names(Vector<String> &animation_names) const;
-
-	void get_skin_names(Vector<String> &l) const;
-
-	void _get_property_list(List<PropertyInfo> *p_list) const;
-
-	// Spine API
-	Ref<SpineBoneData> find_bone(const String &bone_name) const;
-
-	Ref<SpineSlotData> find_slot(const String &slot_name) const;
-
-	Ref<SpineSkin> find_skin(const String &skin_name) const;
-
-	Ref<SpineEventData> find_event(const String &event_data_name) const;
-
-	Ref<SpineAnimation> find_animation(const String &animation_name) const;
-
-	Ref<SpineIkConstraintData> find_ik_constraint(const String &constraint_name) const;
-
-	Ref<SpineTransformConstraintData> find_transform_constraint(const String &constraint_name) const;
-
-	Ref<SpinePathConstraintData> find_path_constraint(const String &constraint_name) const;
-
-	String get_skeleton_name() const;
-
-	Array get_bones() const;
-
-	Array get_slots() const;
-
-	Array get_skins() const;
-
-	Ref<SpineSkin> get_default_skin() const;
-
-	void set_default_skin(Ref<SpineSkin> skin);
-
-	Array get_events() const;
-
-	Array get_animations() const;
-
-	Array get_ik_constraints() const;
-
-	Array get_transform_constraints() const;
-
-	Array get_path_constraints() const;
-
-	float get_x() const;
-
-	float get_y() const;
-
-	float get_width() const;
-
-	float get_height() const;
-
-	String get_version() const;
-
-	String get_hash() const;
-
-	String get_images_path() const;
-
-	String get_audio_path() const;
-
-	float get_fps() const;
-};
-
-
-#endif //GODOT_SPINENEWSKELETONDATARESOURCE_H

+ 0 - 610
spine-godot/godot/modules/spine_godot/SpineNewSprite.cpp

@@ -1,610 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#include "SpineNewSprite.h"
-
-#include "SpineEvent.h"
-#include "SpineTrackEntry.h"
-#include "SpineNewSkeleton.h"
-
-Ref<CanvasItemMaterial> SpineNewSprite::materials[4] = {};
-static int sprite_count = 0;
-
-void SpineNewSprite::_bind_methods() {
-	ClassDB::bind_method(D_METHOD("set_skeleton_data_res", "skeleton_data_res"), &SpineNewSprite::set_skeleton_data_res);
-	ClassDB::bind_method(D_METHOD("get_skeleton_data_res"), &SpineNewSprite::get_skeleton_data_res);
-	ClassDB::bind_method(D_METHOD("get_skeleton"), &SpineNewSprite::get_skeleton);
-	ClassDB::bind_method(D_METHOD("get_animation_state"), &SpineNewSprite::get_animation_state);
-	ClassDB::bind_method(D_METHOD("_on_skeleton_data_changed"), &SpineNewSprite::_on_skeleton_data_changed);
-
-	ClassDB::bind_method(D_METHOD("get_bind_slot_nodes"), &SpineNewSprite::get_bind_slot_nodes);
-	ClassDB::bind_method(D_METHOD("set_bind_slot_nodes", "v"), &SpineNewSprite::set_bind_slot_nodes);
-
-	ClassDB::bind_method(D_METHOD("get_overlap"), &SpineNewSprite::get_overlap);
-	ClassDB::bind_method(D_METHOD("set_overlap", "v"), &SpineNewSprite::set_overlap);
-
-	ClassDB::bind_method(D_METHOD("bone_get_global_transform", "bone_name"), &SpineNewSprite::bone_get_global_transform);
-	ClassDB::bind_method(D_METHOD("bone_set_global_transform", "bone_name", "global_transform"), &SpineNewSprite::bone_set_global_transform);
-
-	ClassDB::bind_method(D_METHOD("set_process_mode", "v"), &SpineNewSprite::set_process_mode);
-	ClassDB::bind_method(D_METHOD("get_process_mode"), &SpineNewSprite::get_process_mode);
-
-	ClassDB::bind_method(D_METHOD("update_all", "delta"), &SpineNewSprite::_update_all);
-
-	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_PROPERTY(PropertyInfo(Variant::OBJECT, "skeleton_data_res", PropertyHint::PROPERTY_HINT_RESOURCE_TYPE, "SpineNewSkeletonDataResource"), "set_skeleton_data_res", "get_skeleton_data_res");
-	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "overlap"), "set_overlap", "get_overlap");
-	ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "bind_slot_nodes"), "set_bind_slot_nodes", "get_bind_slot_nodes");
-
-	ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Process,Physics,Manual"), "set_process_mode", "get_process_mode");
-
-	BIND_ENUM_CONSTANT(ProcessMode::ProcessMode_Process);
-	BIND_ENUM_CONSTANT(ProcessMode::ProcessMode_Physics);
-	BIND_ENUM_CONSTANT(ProcessMode::ProcessMode_Manual);
-}
-
-SpineNewSprite::SpineNewSprite() : overlap(false), process_mode(ProcessMode_Process), skeleton_clipper(nullptr) {
-	skeleton_clipper = new spine::SkeletonClipping();
-
-	// One material per blend mode, shared across all sprites.
-	if (!materials[0].is_valid()) {
-		Ref<CanvasItemMaterial> material_normal(memnew(CanvasItemMaterial));
-		material_normal->set_blend_mode(CanvasItemMaterial::BLEND_MODE_MIX);
-		materials[spine::BlendMode_Normal] = material_normal;
-
-		Ref<CanvasItemMaterial> material_additive(memnew(CanvasItemMaterial));
-		material_additive->set_blend_mode(CanvasItemMaterial::BLEND_MODE_ADD);
-		materials[spine::BlendMode_Additive] = material_additive;
-
-		Ref<CanvasItemMaterial> material_multiply(memnew(CanvasItemMaterial));
-		material_multiply->set_blend_mode(CanvasItemMaterial::BLEND_MODE_MUL);
-		materials[spine::BlendMode_Multiply] = material_multiply;
-
-		Ref<CanvasItemMaterial> material_screen(memnew(CanvasItemMaterial));
-		material_screen->set_blend_mode(CanvasItemMaterial::BLEND_MODE_MIX);
-		materials[spine::BlendMode_Screen] = material_screen;
-	}
-	sprite_count++;
-}
-
-SpineNewSprite::~SpineNewSprite() {
-	delete skeleton_clipper;
-	sprite_count--;
-	if (!sprite_count) {
-		for (int i = 0; i < 4; i++) materials[i].unref();
-	}
-}
-
-void SpineNewSprite::set_skeleton_data_res(const Ref<SpineNewSkeletonDataResource> &s) {
-	skeleton_data_res = s;
-	_on_skeleton_data_changed();
-}
-Ref<SpineNewSkeletonDataResource> SpineNewSprite::get_skeleton_data_res() {
-	return skeleton_data_res;
-}
-
-void SpineNewSprite::_on_skeleton_data_changed() {
-	remove_meshes();
-	skeleton.unref();
-	animation_state.unref();
-
-	if (skeleton_data_res.is_valid()) {
-		if (!skeleton_data_res->is_connected("skeleton_data_changed", this, "_on_skeleton_data_changed"))
-			skeleton_data_res->connect("skeleton_data_changed", this, "_on_skeleton_data_changed");
-	}
-
-	if (skeleton_data_res.is_valid() && skeleton_data_res->is_skeleton_data_loaded()) {
-		skeleton = Ref<SpineNewSkeleton>(memnew(SpineNewSkeleton));
-		skeleton->set_skeleton_data_res(skeleton_data_res);
-		skeleton->set_spine_sprite(this);
-
-		animation_state = Ref<SpineNewAnimationState>(memnew(SpineNewAnimationState));
-		animation_state->set_skeleton_data_res(skeleton_data_res);
-		if (animation_state->get_spine_object()) animation_state->get_spine_object()->setListener(this);
-
-		animation_state->update(0);
-		animation_state->apply(skeleton);
-		skeleton->update_world_transform();
-		generate_meshes_for_slots(skeleton);
-
-		if (process_mode == ProcessMode_Process) {
-			_notification(NOTIFICATION_INTERNAL_PROCESS);
-		} else if (process_mode == ProcessMode_Physics) {
-			_notification(NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
-		}
-	}
-
-	property_list_changed_notify();
-}
-
-Ref<SpineNewSkeleton> SpineNewSprite::get_skeleton() {
-	return skeleton;
-}
-
-Ref<SpineNewAnimationState> SpineNewSprite::get_animation_state() {
-	return animation_state;
-}
-
-void SpineNewSprite::_notification(int p_what) {
-	switch (p_what) {
-		case NOTIFICATION_READY: {
-			set_process_internal(process_mode == ProcessMode_Process);
-			set_physics_process_internal(process_mode == ProcessMode_Physics);
-		} break;
-		case NOTIFICATION_INTERNAL_PROCESS: {
-			if (process_mode == ProcessMode_Process)
-				_update_all(get_process_delta_time());
-		} break;
-		case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
-			if (process_mode == ProcessMode_Physics)
-				_update_all(get_physics_process_delta_time());
-		} break;
-	}
-}
-
-void SpineNewSprite::_update_all(float delta) {
-	if (!(skeleton.is_valid() && animation_state.is_valid()) || mesh_instances.empty())
-		return;
-
-	animation_state->update(delta);
-	if (!is_visible_in_tree())
-		return;
-
-	animation_state->apply(skeleton);
-	skeleton->update_world_transform();
-	update_meshes(skeleton);
-	update();
-	update_bind_slot_nodes();
-}
-
-void SpineNewSprite::update_bind_slot_nodes() {
-	if (animation_state.is_valid() && skeleton.is_valid()) {
-		for (size_t i = 0, n = bind_slot_nodes.size(); i < n; ++i) {
-			auto a = bind_slot_nodes[i];
-			if (a.get_type() == Variant::DICTIONARY) {
-				auto d = (Dictionary) a;
-				if (d.has("slot_name") && d.has("node_path")) {
-					NodePath node_path = d["node_path"];
-					Node *node = get_node_or_null(node_path);
-					if (node && node->is_class("Node2D")) {
-						Node2D *node2d = (Node2D *) node;
-
-						String slot_name = d["slot_name"];
-						auto slot = skeleton->find_slot(slot_name);
-						if (slot.is_valid()) {
-							auto bone = slot->get_bone();
-							if (bone.is_valid()) {
-								update_bind_slot_node_transform(bone, node2d);
-								update_bind_slot_node_draw_order(slot_name, node2d);
-							}
-						}
-					}
-				}
-			} else if (a.get_type() == Variant::ARRAY) {
-				auto as = (Array) a;// 0: slot_name, 1: node_path
-				if (as.size() >= 2 && as[0].get_type() == Variant::STRING && as[1].get_type() == Variant::NODE_PATH) {
-					NodePath node_path = as[1];
-					Node *node = get_node_or_null(node_path);
-					if (node && node->is_class("Node2D")) {
-						Node2D *node2d = (Node2D *) node;
-
-						String slot_name = as[0];
-						auto slot = skeleton->find_slot(slot_name);
-						if (slot.is_valid()) {
-							auto bone = slot->get_bone();
-							if (bone.is_valid()) {
-								update_bind_slot_node_transform(bone, node2d);
-								update_bind_slot_node_draw_order(slot_name, node2d);
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-}
-
-void SpineNewSprite::update_bind_slot_node_transform(Ref<SpineBone> bone, Node2D *node2d) {
-	bone->apply_world_transform_2d(node2d);
-}
-
-void SpineNewSprite::update_bind_slot_node_draw_order(const String &slot_name, Node2D *node2d) {
-	auto mesh_ins = find_node(slot_name);
-	if (mesh_ins) {
-		auto pos = mesh_ins->get_index();
-
-		// get child
-		auto node = find_child_node_by_node(node2d);
-		if (node && node->get_index() != pos + 1) {
-			move_child(node, pos + 1);
-		}
-	}
-}
-Node *SpineNewSprite::find_child_node_by_node(Node *node) {
-	if (node == nullptr) return nullptr;
-	while (node && node->get_parent() != this) node = node->get_parent();
-	return node;
-}
-
-void SpineNewSprite::generate_meshes_for_slots(Ref<SpineNewSkeleton> skeleton_ref) {
-	auto skeleton = skeleton_ref->get_spine_object();
-	for (int i = 0, n = skeleton->getSlots().size(); i < n; i++) {
-
-		auto mesh_instance = memnew(MeshInstance2D);
-		mesh_instance->set_position(Vector2(0, 0));
-		mesh_instance->set_material(materials[spine::BlendMode_Normal]);
-
-		add_child(mesh_instance);
-		mesh_instance->set_owner(this);
-		mesh_instances.push_back(mesh_instance);
-	}
-}
-
-void SpineNewSprite::remove_meshes() {
-	for (size_t i = 0; i < mesh_instances.size(); ++i) {
-		remove_child(mesh_instances[i]);
-		memdelete(mesh_instances[i]);
-	}
-	mesh_instances.clear();
-}
-
-#define TEMP_COPY(t, get_res)                   \
-	do {                                        \
-		auto &temp_uvs = get_res;               \
-		t.setSize(temp_uvs.size(), 0);          \
-		for (size_t j = 0; j < t.size(); ++j) { \
-			t[j] = temp_uvs[j];                 \
-		}                                       \
-	} while (false);
-
-void SpineNewSprite::update_meshes(Ref<SpineNewSkeleton> s) {
-	static const unsigned short VERTEX_STRIDE = 2;
-	static unsigned short quad_indices[] = {0, 1, 2, 2, 3, 0};
-
-	auto sk = s->get_spine_object();
-	for (size_t i = 0, n = sk->getSlots().size(); i < n; ++i) {
-		spine::Vector<float> vertices;
-		spine::Vector<float> uvs;
-		spine::Vector<unsigned short> indices;
-
-		spine::Slot *slot = sk->getDrawOrder()[i];
-
-		spine::Attachment *attachment = slot->getAttachment();
-		if (!attachment) {
-			mesh_instances[i]->set_visible(false);
-
-			skeleton_clipper->clipEnd(*slot);
-			continue;
-		}
-		mesh_instances[i]->set_visible(true);
-
-		spine::Color skeleton_color = sk->getColor();
-		spine::Color slot_color = slot->getColor();
-		spine::Color tint(skeleton_color.r * slot_color.r, skeleton_color.g * slot_color.g, skeleton_color.b * slot_color.b, skeleton_color.a * slot_color.a);
-
-		Ref<Texture> tex;
-		Ref<Texture> normal_tex;
-		size_t v_num = 0;
-
-		if (attachment->getRTTI().isExactly(spine::RegionAttachment::rtti)) {
-			spine::RegionAttachment *region_attachment = (spine::RegionAttachment *) attachment;
-
-			auto p_spine_renderer_object = (SpineRendererObject *) ((spine::AtlasRegion *) region_attachment->getRendererObject())->page->getRendererObject();
-			tex = p_spine_renderer_object->texture;
-			normal_tex = p_spine_renderer_object->normal_map;
-
-			v_num = 4;
-			vertices.setSize(v_num * VERTEX_STRIDE, 0);
-
-			region_attachment->computeWorldVertices(*slot, vertices, 0);
-
-			TEMP_COPY(uvs, region_attachment->getUVs());
-
-			indices.setSize(sizeof(quad_indices) / sizeof(unsigned short), 0);
-			for (size_t j = 0, qn = indices.size(); j < qn; ++j) {
-				indices[j] = quad_indices[j];
-			}
-
-			auto attachment_color = region_attachment->getColor();
-			tint.r *= attachment_color.r;
-			tint.g *= attachment_color.g;
-			tint.b *= attachment_color.b;
-			tint.a *= attachment_color.a;
-		} else if (attachment->getRTTI().isExactly(spine::MeshAttachment::rtti)) {
-			spine::MeshAttachment *mesh = (spine::MeshAttachment *) attachment;
-
-			auto p_spine_renderer_object = (SpineRendererObject *) ((spine::AtlasRegion *) mesh->getRendererObject())->page->getRendererObject();
-			tex = p_spine_renderer_object->texture;
-			normal_tex = p_spine_renderer_object->normal_map;
-
-			v_num = mesh->getWorldVerticesLength() / VERTEX_STRIDE;
-			vertices.setSize(mesh->getWorldVerticesLength(), 0);
-
-			mesh->computeWorldVertices(*slot, vertices);
-			TEMP_COPY(uvs, mesh->getUVs());
-			TEMP_COPY(indices, mesh->getTriangles());
-
-			auto attachment_color = mesh->getColor();
-			tint.r *= attachment_color.r;
-			tint.g *= attachment_color.g;
-			tint.b *= attachment_color.b;
-			tint.a *= attachment_color.a;
-		} else if (attachment->getRTTI().isExactly(spine::ClippingAttachment::rtti)) {
-			auto clip = (spine::ClippingAttachment *) attachment;
-			skeleton_clipper->clipStart(*slot, clip);
-			continue;
-		} else {
-			skeleton_clipper->clipEnd(*slot);
-			continue;
-		}
-
-		auto mesh_ins = mesh_instances[i];
-		VisualServer::get_singleton()->canvas_item_clear(mesh_ins->get_canvas_item());
-
-		if (skeleton_clipper->isClipping()) {
-			skeleton_clipper->clipTriangles(vertices, indices, uvs, VERTEX_STRIDE);
-
-			if (skeleton_clipper->getClippedTriangles().size() == 0) {
-				skeleton_clipper->clipEnd(*slot);
-				continue;
-			}
-
-			auto &clipped_vertices = skeleton_clipper->getClippedVertices();
-			v_num = clipped_vertices.size() / VERTEX_STRIDE;
-			auto &clipped_uvs = skeleton_clipper->getClippedUVs();
-			auto &clipped_indices = skeleton_clipper->getClippedTriangles();
-
-			if (indices.size() > 0) {
-				Vector<Vector2> p_points, p_uvs;
-				Vector<Color> p_colors;
-				Vector<int> p_indices;
-				p_points.resize(v_num);
-				p_uvs.resize(v_num);
-				p_colors.resize(v_num);
-				for (size_t j = 0; j < v_num; j++) {
-					p_points.set(j, Vector2(clipped_vertices[j * VERTEX_STRIDE], -clipped_vertices[j * VERTEX_STRIDE + 1]));
-					p_uvs.set(j, Vector2(clipped_uvs[j * VERTEX_STRIDE], clipped_uvs[j * VERTEX_STRIDE + 1]));
-					p_colors.set(j, Color(tint.r, tint.g, tint.b, tint.a));
-				}
-				p_indices.resize(clipped_indices.size());
-				for (size_t j = 0; j < clipped_indices.size(); ++j) {
-					p_indices.set(j, clipped_indices[j]);
-				}
-
-				VisualServer::get_singleton()->canvas_item_add_triangle_array(mesh_ins->get_canvas_item(),
-																			  p_indices,
-																			  p_points,
-																			  p_colors,
-																			  p_uvs,
-																			  Vector<int>(),
-																			  Vector<float>(),
-																			  tex.is_null() ? RID() : tex->get_rid(),
-																			  -1,
-																			  normal_tex.is_null() ? RID() : normal_tex->get_rid());
-			}
-		} else {
-			if (indices.size() > 0) {
-				Vector<Vector2> p_points, p_uvs;
-				Vector<Color> p_colors;
-				Vector<int> p_indices;
-				p_points.resize(v_num);
-				p_uvs.resize(v_num);
-				p_colors.resize(v_num);
-				for (size_t j = 0; j < v_num; j++) {
-					p_points.set(j, Vector2(vertices[j * VERTEX_STRIDE], -vertices[j * VERTEX_STRIDE + 1]));
-					p_uvs.set(j, Vector2(uvs[j * VERTEX_STRIDE], uvs[j * VERTEX_STRIDE + 1]));
-					p_colors.set(j, Color(tint.r, tint.g, tint.b, tint.a));
-				}
-				p_indices.resize(indices.size());
-				for (size_t j = 0; j < indices.size(); ++j) {
-					p_indices.set(j, indices[j]);
-				}
-
-				VisualServer::get_singleton()->canvas_item_add_triangle_array(mesh_ins->get_canvas_item(),
-																			  p_indices,
-																			  p_points,
-																			  p_colors,
-																			  p_uvs,
-																			  Vector<int>(),
-																			  Vector<float>(),
-																			  tex.is_null() ? RID() : tex->get_rid(),
-																			  -1,
-																			  normal_tex.is_null() ? RID() : normal_tex->get_rid());
-			}
-		}
-		skeleton_clipper->clipEnd(*slot);
-
-		if (mesh_ins->get_material()->is_class("CanvasItemMaterial")) {
-			mesh_ins->set_material(materials[slot->getData().getBlendMode()]);
-		}
-	}
-	skeleton_clipper->clipEnd();
-}
-
-void SpineNewSprite::callback(spine::AnimationState *state, spine::EventType type, spine::TrackEntry *entry, spine::Event *event) {
-	Ref<SpineTrackEntry> gd_entry(nullptr);
-	Ref<SpineEvent> gd_event(nullptr);
-
-	if (entry) {
-		gd_entry = Ref<SpineTrackEntry>(memnew(SpineTrackEntry));
-		gd_entry->set_spine_object(entry);
-	}
-	if (event) {
-		gd_event = Ref<SpineEvent>(memnew(SpineEvent));
-		gd_event->set_spine_object(event);
-	}
-
-	switch (type) {
-		case spine::EventType_Start: {
-			emit_signal("animation_start", animation_state, gd_entry, gd_event);
-		} break;
-		case spine::EventType_Interrupt: {
-			emit_signal("animation_interrupt", animation_state, gd_entry, gd_event);
-		} break;
-		case spine::EventType_End: {
-			emit_signal("animation_end", animation_state, gd_entry, gd_event);
-		} break;
-		case spine::EventType_Complete: {
-			emit_signal("animation_complete", animation_state, gd_entry, gd_event);
-		} break;
-		case spine::EventType_Dispose: {
-			emit_signal("animation_dispose", animation_state, gd_entry, gd_event);
-		} break;
-		case spine::EventType_Event: {
-			emit_signal("animation_event", animation_state, gd_entry, gd_event);
-		} break;
-	}
-}
-
-Array SpineNewSprite::get_bind_slot_nodes() {
-	return bind_slot_nodes;
-}
-
-void SpineNewSprite::set_bind_slot_nodes(Array v) {
-	bind_slot_nodes = v;
-}
-
-bool SpineNewSprite::get_overlap() {
-	return overlap;
-}
-
-void SpineNewSprite::set_overlap(bool v) {
-	overlap = v;
-}
-
-Transform2D SpineNewSprite::bone_get_global_transform(const String &bone_name) {
-	if (!animation_state.is_valid() && !skeleton.is_valid()) {
-		return get_global_transform();
-	}
-	auto bone = skeleton->find_bone(bone_name);
-	if (!bone.is_valid()) {
-		print_error(vformat("Bone: '%s' not found.", bone_name));
-		return get_global_transform();
-	}
-	return bone->get_godot_global_transform();
-}
-
-void SpineNewSprite::bone_set_global_transform(const String &bone_name, Transform2D transform) {
-	if (!animation_state.is_valid() && !skeleton.is_valid()) {
-		return;
-	}
-	auto bone = skeleton->find_bone(bone_name);
-	if (!bone.is_valid()) {
-		return;
-	}
-	bone->set_godot_global_transform(transform);
-}
-
-SpineNewSprite::ProcessMode SpineNewSprite::get_process_mode() {
-	return process_mode;
-}
-
-void SpineNewSprite::set_process_mode(SpineNewSprite::ProcessMode v) {
-	process_mode = v;
-	set_process_internal(process_mode == ProcessMode_Process);
-	set_physics_process_internal(process_mode == ProcessMode_Physics);
-}
-
-void SpineNewSprite::_get_property_list(List<PropertyInfo> *p_list) const {
-	Vector<String> animations;
-	Vector<String> skins;
-	if (skeleton_data_res.is_valid()) {
-		skeleton_data_res->get_animation_names(animations);
-		skeleton_data_res->get_skin_names(skins);
-	}
-	animations.insert(0, "- None -");
-
-	PropertyInfo animationListProperty;
-	animationListProperty.name = "Preview animation";
-	animationListProperty.type = Variant::STRING;
-	animationListProperty.hint_string = String(",").join(animations);
-	animationListProperty.hint = PROPERTY_HINT_ENUM;
-	animationListProperty.usage = PROPERTY_USAGE_EDITOR;
-	p_list->push_back(animationListProperty);
-
-	PropertyInfo skinListProperty;
-	skinListProperty.name = "Preview skin";
-	skinListProperty.type = Variant::STRING;
-	skinListProperty.hint_string = String(",").join(skins);
-	skinListProperty.hint = PROPERTY_HINT_ENUM;
-	skinListProperty.usage = PROPERTY_USAGE_EDITOR;
-	p_list->push_back(skinListProperty);
-}
-
-bool SpineNewSprite::_get(const StringName &p_property, Variant &r_value) const {
-	return false;
-}
-
-bool SpineNewSprite::_set(const StringName &p_property, const Variant &p_value) {
-	if (p_property == "Preview animation") {
-		if (animation_state.is_valid() && skeleton.is_valid()) {
-			auto animName = p_value.operator String();
-			skeleton->set_to_setup_pose();
-			if (skeleton->get_skeleton_data_res()->find_animation(animName).is_valid()) {
-				animation_state->set_animation(animName, true, 0);
-			} else {
-				animation_state->clear_tracks();
-			}
-		}
-	}
-
-	if (p_property == "Preview skin") {
-		if (animation_state.is_valid() && skeleton.is_valid()) {
-			auto skinName = p_value.operator String();
-			if (skeleton->get_skeleton_data_res()->find_skin(skinName).is_valid()) {
-				skeleton->set_skin_by_name(skinName);
-			} else {
-				skeleton->set_skin(nullptr);
-			}
-			skeleton->set_to_setup_pose();
-		}
-	}
-	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

+ 0 - 122
spine-godot/godot/modules/spine_godot/SpineNewSprite.h

@@ -1,122 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#ifndef GODOT_SPINENEWSPRITE_H
-#define GODOT_SPINENEWSPRITE_H
-
-#include "scene/2d/node_2d.h"
-#include "scene/resources/texture.h"
-
-#include "SpineNewSkeleton.h"
-#include "SpineNewAnimationState.h"
-#include "scene/2d/mesh_instance_2d.h"
-
-class SpineNewSprite : public Node2D, public spine::AnimationStateListenerObject {
-	GDCLASS(SpineNewSprite, Node2D);
-
-protected:
-	static void _bind_methods();
-
-	void _notification(int p_what);
-
-	void _get_property_list(List<PropertyInfo> *p_list) const;
-	bool _get(const StringName &p_property, Variant &r_value) const;
-	bool _set(const StringName &p_property, const Variant &p_value);
-
-	void _validate_and_play_current_animations();
-
-public:
-	enum ProcessMode {
-		ProcessMode_Process,
-		ProcessMode_Physics,
-		ProcessMode_Manual
-	};
-
-private:
-	Ref<SpineNewSkeletonDataResource> skeleton_data_res;
-
-	Ref<SpineNewSkeleton> skeleton;
-	Ref<SpineNewAnimationState> animation_state;
-
-	String preview_animation;
-	Array bind_slot_nodes;
-	bool overlap;
-
-	ProcessMode process_mode;
-
-	Vector<MeshInstance2D *> mesh_instances;
-	spine::SkeletonClipping *skeleton_clipper;
-	static Ref<CanvasItemMaterial> materials[4];
-
-public:
-	SpineNewSprite();
-	~SpineNewSprite();
-
-	void set_skeleton_data_res(const Ref<SpineNewSkeletonDataResource> &a);
-	Ref<SpineNewSkeletonDataResource> get_skeleton_data_res();
-
-	Ref<SpineNewSkeleton> get_skeleton();
-	Ref<SpineNewAnimationState> get_animation_state();
-
-	void generate_meshes_for_slots(Ref<SpineNewSkeleton> skeleton_ref);
-	void remove_meshes();
-
-	void update_meshes(Ref<SpineNewSkeleton> s);
-
-	void update_bind_slot_nodes();
-	void update_bind_slot_node_transform(Ref<SpineBone> bone, Node2D *node2d);
-	void update_bind_slot_node_draw_order(const String &slot_name, Node2D *node2d);
-	Node *find_child_node_by_node(Node *node);
-
-	virtual void callback(spine::AnimationState *state, spine::EventType type, spine::TrackEntry *entry, spine::Event *event);
-
-	void _on_skeleton_data_changed();
-
-	void _update_all(float delta);
-
-	Array get_bind_slot_nodes();
-	void set_bind_slot_nodes(Array v);
-
-	Transform2D bone_get_global_transform(const String &bone_name);
-	void bone_set_global_transform(const String &bone_name, Transform2D transform);
-
-	bool get_overlap();
-	void set_overlap(bool v);
-
-	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);
-#endif//GODOT_SPINENEWSPRITE_H

+ 0 - 1
spine-godot/godot/modules/spine_godot/SpineRendererObject.h

@@ -37,5 +37,4 @@ struct SpineRendererObject {
 	Ref<Texture> normal_map;
 };
 
-
 #endif

+ 54 - 124
spine-godot/godot/modules/spine_godot/SpineSkeleton.cpp

@@ -30,65 +30,23 @@
 #include "SpineSkeleton.h"
 
 void SpineSkeleton::_bind_methods() {
-	//void update_world_transform();
-	//
-	//	void set_to_setup_pose();
-	//
-	//	void set_bones_to_setup_pose();
-	//
-	//	void set_slots_to_setup_pose();
 	ClassDB::bind_method(D_METHOD("update_world_transform"), &SpineSkeleton::update_world_transform);
 	ClassDB::bind_method(D_METHOD("set_to_setup_pose"), &SpineSkeleton::set_to_setup_pose);
 	ClassDB::bind_method(D_METHOD("set_bones_to_setup_pose"), &SpineSkeleton::set_bones_to_setup_pose);
 	ClassDB::bind_method(D_METHOD("set_slots_to_setup_pose"), &SpineSkeleton::set_slots_to_setup_pose);
-	//
-	//	Ref<SpineBone> find_bone(const String &name);
-	//	int find_bone_index(const String &name);
-	//
-	//	Ref<SpineSlot> find_slot(const String &name);
-	//	int find_slot_index(const String &name);
-	//
-	//	void set_skin_by_name(const String &skin_name);
-	//	void set_skin(Ref<SpineSkin> new_skin);
-	//
-	//	Ref<SpineAttachment> get_attachment_by_slot_name(const String &slot_name, const String &attachment_name);
-	//	Ref<SpineAttachment> get_attachment_by_slot_index(int slot_index, const String &attachment_name);
 	ClassDB::bind_method(D_METHOD("find_bone", "bone_name"), &SpineSkeleton::find_bone);
 	ClassDB::bind_method(D_METHOD("find_slot", "slot_name"), &SpineSkeleton::find_slot);
 	ClassDB::bind_method(D_METHOD("set_skin_by_name", "skin_name"), &SpineSkeleton::set_skin_by_name);
 	ClassDB::bind_method(D_METHOD("set_skin", "new_skin"), &SpineSkeleton::set_skin);
 	ClassDB::bind_method(D_METHOD("get_attachment_by_slot_name", "slot_name", "attachment_name"), &SpineSkeleton::get_attachment_by_slot_name);
 	ClassDB::bind_method(D_METHOD("get_attachment_by_slot_index", "slot_index", "attachment_name"), &SpineSkeleton::get_attachment_by_slot_index);
-	//
-	//	void set_attachment(const String &slot_name, const String &attachment_name);
-	//
-	//	Ref<SpineIkConstraint> find_ik_constraint(const String &constraint_name);
-	//	Ref<SpineTransformConstraint> find_transform_constraint(const String &constraint_name);
-	//	Ref<SpinePathConstraint> find_path_constraint(const String &constraint_name);
-	//
-	//	void update(float delta);
-	//
-	//	Dictionary get_bounds();
-	//
-	//	Ref<SpineBone> get_root_bone();
-	//
-	//	Ref<SpineSkeletonDataResource> get_data();
 	ClassDB::bind_method(D_METHOD("set_attachment", "slot_name", "attachment_name"), &SpineSkeleton::set_attachment);
 	ClassDB::bind_method(D_METHOD("find_ik_constraint", "constraint_name"), &SpineSkeleton::find_ik_constraint);
 	ClassDB::bind_method(D_METHOD("find_transform_constraint", "constraint_name"), &SpineSkeleton::find_transform_constraint);
 	ClassDB::bind_method(D_METHOD("find_path_constraint", "constraint_name"), &SpineSkeleton::find_path_constraint);
 	ClassDB::bind_method(D_METHOD("get_bounds"), &SpineSkeleton::get_bounds);
 	ClassDB::bind_method(D_METHOD("get_root_bone"), &SpineSkeleton::get_root_bone);
-	ClassDB::bind_method(D_METHOD("get_data"), &SpineSkeleton::get_data);
-	//
-	//	Array get_bones();
-	//	Array get_slots();
-	//	Array get_draw_orders();
-	//	Array get_ik_constraints();
-	//	Array get_path_constraints();
-	//	Array get_transform_constraints();
-	//
-	//	Ref<SpineSkin> get_skin();
+	ClassDB::bind_method(D_METHOD("get_data"), &SpineSkeleton::get_skeleton_data_res);
 	ClassDB::bind_method(D_METHOD("get_bones"), &SpineSkeleton::get_bones);
 	ClassDB::bind_method(D_METHOD("get_slots"), &SpineSkeleton::get_slots);
 	ClassDB::bind_method(D_METHOD("get_draw_orders"), &SpineSkeleton::get_draw_orders);
@@ -96,29 +54,9 @@ void SpineSkeleton::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("get_path_constraints"), &SpineSkeleton::get_path_constraints);
 	ClassDB::bind_method(D_METHOD("get_transform_constraints"), &SpineSkeleton::get_transform_constraints);
 	ClassDB::bind_method(D_METHOD("get_skin"), &SpineSkeleton::get_skin);
-	//
-	//	Color get_color();
-	//	void set_color(Color v);
-	//
-	//	float get_time();
-	//	void set_time(float v);
-	//
-	//	void set_position(Vector2 pos);
 	ClassDB::bind_method(D_METHOD("get_color"), &SpineSkeleton::get_color);
 	ClassDB::bind_method(D_METHOD("set_color", "v"), &SpineSkeleton::set_color);
 	ClassDB::bind_method(D_METHOD("set_position", "pos"), &SpineSkeleton::set_position);
-	//
-	//	float get_x();
-	//	void set_x(float v);
-	//
-	//	float get_y();
-	//	void set_y(float v);
-	//
-	//	float get_scale_x();
-	//	void set_scale_x(float v);
-	//
-	//	float get_scale_y();
-	//	void set_scale_y(float v);
 	ClassDB::bind_method(D_METHOD("get_x"), &SpineSkeleton::get_x);
 	ClassDB::bind_method(D_METHOD("set_x", "v"), &SpineSkeleton::set_x);
 	ClassDB::bind_method(D_METHOD("get_y"), &SpineSkeleton::get_y);
@@ -129,26 +67,30 @@ void SpineSkeleton::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_scale_y", "v"), &SpineSkeleton::set_scale_y);
 }
 
-SpineSkeleton::SpineSkeleton() : skeleton(NULL), spine_object(false), the_sprite(nullptr) {
+SpineSkeleton::SpineSkeleton() : skeleton(nullptr), sprite(nullptr), skeleton_data_res(nullptr) {
 }
 
 SpineSkeleton::~SpineSkeleton() {
-	if (skeleton && !spine_object) {
-		delete skeleton;
-		skeleton = NULL;
-	}
+	delete skeleton;
 }
 
-void SpineSkeleton::load_skeleton(Ref<SpineSkeletonDataResource> sd) {
-	if (skeleton && !spine_object) {
-		delete skeleton;
-		skeleton = NULL;
-	}
-	skeleton = new spine::Skeleton(sd->get_skeleton_data());
-	spine_object = false;
+void SpineSkeleton::set_skeleton_data_res(Ref<SpineSkeletonDataResource> data_res) {
+	delete skeleton;
+	skeleton = nullptr;
+	skeleton_data_res = data_res;
+	if (!data_res.is_valid() || !data_res->is_skeleton_data_loaded()) return;
+	skeleton = new spine::Skeleton(data_res->get_skeleton_data());
 }
 
-#define S_T(x) (spine::String(x.utf8()))
+Ref<SpineSkeletonDataResource> SpineSkeleton::get_skeleton_data_res() const {
+	return skeleton_data_res;
+}
+
+void SpineSkeleton::set_spine_sprite(SpineSprite* sprite) {
+	this->sprite = sprite;
+}
+
+#define S_T(x) (spine::String((x).utf8()))
 void SpineSkeleton::update_world_transform() {
 	skeleton->updateWorldTransform();
 }
@@ -166,45 +108,45 @@ void SpineSkeleton::set_slots_to_setup_pose() {
 }
 
 Ref<SpineBone> SpineSkeleton::find_bone(const String &name) {
-	if (name.empty()) return NULL;
-	auto b = skeleton->findBone(S_T(name));
-	if (b == NULL) return NULL;
-	Ref<SpineBone> gd_b(memnew(SpineBone));
-	gd_b->set_spine_object(b);
-	gd_b->set_spine_sprite(the_sprite);
-	return gd_b;
+	if (name.empty()) return nullptr;
+	auto bone = skeleton->findBone(S_T(name));
+	if (!bone) return nullptr;
+	Ref<SpineBone> bone_ref(memnew(SpineBone));
+	bone_ref->set_spine_object(bone);
+	bone_ref->set_spine_sprite(sprite);
+	return bone_ref;
 }
 
 Ref<SpineSlot> SpineSkeleton::find_slot(const String &name) {
-	if (name.empty()) return NULL;
-	auto s = skeleton->findSlot(S_T(name));
-	if (s == NULL) return NULL;
-	Ref<SpineSlot> gd_s(memnew(SpineSlot));
-	gd_s->set_spine_object(s);
-	return gd_s;
+	if (name.empty()) return nullptr;
+	auto slot = skeleton->findSlot(S_T(name));
+	if (!slot) return nullptr;
+	Ref<SpineSlot> slot_ref(memnew(SpineSlot));
+	slot_ref->set_spine_object(slot);
+	return slot_ref;
 }
 
 void SpineSkeleton::set_skin_by_name(const String &skin_name) {
 	skeleton->setSkin(S_T(skin_name));
 }
 void SpineSkeleton::set_skin(Ref<SpineSkin> new_skin) {
-	if (new_skin.is_valid()) {
+	if (new_skin.is_valid())
 		skeleton->setSkin(new_skin->get_spine_object());
-	} else {
-		skeleton->setSkin(NULL);
-	}
+	else
+		skeleton->setSkin(nullptr);
 }
 
 Ref<SpineAttachment> SpineSkeleton::get_attachment_by_slot_name(const String &slot_name, const String &attachment_name) {
 	auto a = skeleton->getAttachment(S_T(slot_name), S_T(attachment_name));
-	if (a == NULL) return NULL;
+	if (a == nullptr) return nullptr;
 	Ref<SpineAttachment> gd_a(memnew(SpineAttachment));
 	gd_a->set_spine_object(a);
 	return gd_a;
 }
+
 Ref<SpineAttachment> SpineSkeleton::get_attachment_by_slot_index(int slot_index, const String &attachment_name) {
 	auto a = skeleton->getAttachment(slot_index, S_T(attachment_name));
-	if (a == NULL) return NULL;
+	if (a == nullptr) return nullptr;
 	Ref<SpineAttachment> gd_a(memnew(SpineAttachment));
 	gd_a->set_spine_object(a);
 	return gd_a;
@@ -212,30 +154,30 @@ Ref<SpineAttachment> SpineSkeleton::get_attachment_by_slot_index(int slot_index,
 
 void SpineSkeleton::set_attachment(const String &slot_name, const String &attachment_name) {
 	ERR_FAIL_COND(slot_name.empty());
-	ERR_FAIL_COND(get_attachment_by_slot_name(slot_name, attachment_name) == NULL);
+	ERR_FAIL_COND(get_attachment_by_slot_name(slot_name, attachment_name) == nullptr);
 	skeleton->setAttachment(S_T(slot_name), S_T(attachment_name));
 }
 
 Ref<SpineIkConstraint> SpineSkeleton::find_ik_constraint(const String &constraint_name) {
-	if (constraint_name.empty()) return NULL;
+	if (constraint_name.empty()) return nullptr;
 	auto c = skeleton->findIkConstraint(S_T(constraint_name));
-	if (c == NULL) return NULL;
+	if (c == nullptr) return nullptr;
 	Ref<SpineIkConstraint> gd_c(memnew(SpineIkConstraint));
 	gd_c->set_spine_object(c);
 	return gd_c;
 }
 Ref<SpineTransformConstraint> SpineSkeleton::find_transform_constraint(const String &constraint_name) {
-	if (constraint_name.empty()) return NULL;
+	if (constraint_name.empty()) return nullptr;
 	auto c = skeleton->findTransformConstraint(S_T(constraint_name));
-	if (c == NULL) return NULL;
+	if (c == nullptr) return nullptr;
 	Ref<SpineTransformConstraint> gd_c(memnew(SpineTransformConstraint));
 	gd_c->set_spine_object(c);
 	return gd_c;
 }
 Ref<SpinePathConstraint> SpineSkeleton::find_path_constraint(const String &constraint_name) {
-	if (constraint_name.empty()) return NULL;
+	if (constraint_name.empty()) return nullptr;
 	auto c = skeleton->findPathConstraint(S_T(constraint_name));
-	if (c == NULL) return NULL;
+	if (c == nullptr) return nullptr;
 	Ref<SpinePathConstraint> gd_c(memnew(SpinePathConstraint));
 	gd_c->set_spine_object(c);
 	return gd_c;
@@ -264,31 +206,23 @@ Dictionary SpineSkeleton::get_bounds() {
 
 Ref<SpineBone> SpineSkeleton::get_root_bone() {
 	auto b = skeleton->getRootBone();
-	if (b == NULL) return NULL;
+	if (b == nullptr) return nullptr;
 	Ref<SpineBone> gd_b(memnew(SpineBone));
 	gd_b->set_spine_object(b);
-	gd_b->set_spine_sprite(the_sprite);
+	gd_b->set_spine_sprite(sprite);
 	return gd_b;
 }
 
-Ref<SpineSkeletonDataResource> SpineSkeleton::get_data() const {
-	auto sd = skeleton->getData();
-	if (sd == NULL) return NULL;
-	Ref<SpineSkeletonDataResource> gd_sd(memnew(SpineSkeletonDataResource));
-	gd_sd->set_spine_object(sd);
-	return gd_sd;
-}
-
 Array SpineSkeleton::get_bones() {
 	auto &as = skeleton->getBones();
 	Array gd_as;
 	gd_as.resize(as.size());
 	for (size_t i = 0; i < gd_as.size(); ++i) {
 		auto b = as[i];
-		if (b == NULL) gd_as[i] = Ref<SpineBone>(NULL);
+		if (b == nullptr) gd_as[i] = Ref<SpineBone>(nullptr);
 		Ref<SpineBone> gd_a(memnew(SpineBone));
 		gd_a->set_spine_object(b);
-		gd_a->set_spine_sprite(the_sprite);
+		gd_a->set_spine_sprite(sprite);
 		gd_as[i] = gd_a;
 	}
 	return gd_as;
@@ -299,7 +233,7 @@ Array SpineSkeleton::get_slots() {
 	gd_as.resize(as.size());
 	for (size_t i = 0; i < gd_as.size(); ++i) {
 		auto b = as[i];
-		if (b == NULL) gd_as[i] = Ref<SpineSlot>(NULL);
+		if (b == nullptr) gd_as[i] = Ref<SpineSlot>(nullptr);
 		Ref<SpineSlot> gd_a(memnew(SpineSlot));
 		gd_a->set_spine_object(b);
 		gd_as[i] = gd_a;
@@ -312,7 +246,7 @@ Array SpineSkeleton::get_draw_orders() {
 	gd_as.resize(as.size());
 	for (size_t i = 0; i < gd_as.size(); ++i) {
 		auto b = as[i];
-		if (b == NULL) gd_as[i] = Ref<SpineSlot>(NULL);
+		if (b == nullptr) gd_as[i] = Ref<SpineSlot>(nullptr);
 		Ref<SpineSlot> gd_a(memnew(SpineSlot));
 		gd_a->set_spine_object(b);
 		gd_as[i] = gd_a;
@@ -325,7 +259,7 @@ Array SpineSkeleton::get_ik_constraints() {
 	gd_as.resize(as.size());
 	for (size_t i = 0; i < gd_as.size(); ++i) {
 		auto b = as[i];
-		if (b == NULL) gd_as[i] = Ref<SpineIkConstraint>(NULL);
+		if (b == nullptr) gd_as[i] = Ref<SpineIkConstraint>(nullptr);
 		Ref<SpineIkConstraint> gd_a(memnew(SpineIkConstraint));
 		gd_a->set_spine_object(b);
 		gd_as[i] = gd_a;
@@ -338,7 +272,7 @@ Array SpineSkeleton::get_path_constraints() {
 	gd_as.resize(as.size());
 	for (size_t i = 0; i < gd_as.size(); ++i) {
 		auto b = as[i];
-		if (b == NULL) gd_as[i] = Ref<SpinePathConstraint>(NULL);
+		if (b == nullptr) gd_as[i] = Ref<SpinePathConstraint>(nullptr);
 		Ref<SpinePathConstraint> gd_a(memnew(SpinePathConstraint));
 		gd_a->set_spine_object(b);
 		gd_as[i] = gd_a;
@@ -351,7 +285,7 @@ Array SpineSkeleton::get_transform_constraints() {
 	gd_as.resize(as.size());
 	for (size_t i = 0; i < gd_as.size(); ++i) {
 		auto b = as[i];
-		if (b == NULL) gd_as[i] = Ref<SpineTransformConstraint>(NULL);
+		if (b == nullptr) gd_as[i] = Ref<SpineTransformConstraint>(nullptr);
 		Ref<SpineTransformConstraint> gd_a(memnew(SpineTransformConstraint));
 		gd_a->set_spine_object(b);
 		gd_as[i] = gd_a;
@@ -361,7 +295,7 @@ Array SpineSkeleton::get_transform_constraints() {
 
 Ref<SpineSkin> SpineSkeleton::get_skin() {
 	auto s = skeleton->getSkin();
-	if (s == NULL) return NULL;
+	if (s == nullptr) return nullptr;
 	Ref<SpineSkin> gd_s(memnew(SpineSkin));
 	gd_s->set_spine_object(s);
 	return gd_s;
@@ -407,7 +341,3 @@ float SpineSkeleton::get_scale_y() {
 void SpineSkeleton::set_scale_y(float v) {
 	skeleton->setScaleY(v);
 }
-
-void SpineSkeleton::set_spine_sprite(SpineSprite *s) {
-	the_sprite = s;
-}

+ 8 - 11
spine-godot/godot/modules/spine_godot/SpineSkeleton.h

@@ -30,13 +30,14 @@
 #ifndef GODOT_SPINESKELETON_H
 #define GODOT_SPINESKELETON_H
 
-#include "core/variant_parser.h"
-
 #include <spine/spine.h>
 
 #include "SpineSkeletonDataResource.h"
 #include "SpineBone.h"
 #include "SpineSlot.h"
+#include "SpineIkConstraint.h"
+#include "SpineTransformConstraint.h"
+#include "SpinePathConstraint.h"
 
 class SpineSprite;
 
@@ -48,26 +49,24 @@ protected:
 
 private:
 	spine::Skeleton *skeleton;
-	bool spine_object;
-
-	SpineSprite *the_sprite;
+	SpineSprite *sprite;
+	Ref<SpineSkeletonDataResource> skeleton_data_res;
 
 public:
 	SpineSkeleton();
 	~SpineSkeleton();
 
-	void load_skeleton(Ref<SpineSkeletonDataResource> sd);
+	void set_skeleton_data_res(Ref<SpineSkeletonDataResource> data_res);
+	Ref<SpineSkeletonDataResource> get_skeleton_data_res() const;
 
 	inline void set_spine_object(spine::Skeleton *s) {
 		skeleton = s;
-		spine_object = true;
 	}
 	inline spine::Skeleton *get_spine_object() {
 		return skeleton;
 	}
 
-	void set_spine_sprite(SpineSprite *s);
-
+	void set_spine_sprite(SpineSprite *sprite);
 
 	void update_world_transform();
 
@@ -97,8 +96,6 @@ public:
 
 	Ref<SpineBone> get_root_bone();
 
-	Ref<SpineSkeletonDataResource> get_data() const;
-
 	Array get_bones();
 	Array get_slots();
 	Array get_draw_orders();

+ 327 - 338
spine-godot/godot/modules/spine_godot/SpineSkeletonDataResource.cpp

@@ -29,429 +29,418 @@
 
 #include "SpineSkeletonDataResource.h"
 
+#ifdef TOOLS_ENABLED
+#include "editor/editor_node.h"
+#include "editor/editor_inspector.h"
+#endif
+
 void SpineSkeletonDataResource::_bind_methods() {
+	ClassDB::bind_method(D_METHOD("is_skeleton_data_loaded"), &SpineSkeletonDataResource::is_skeleton_data_loaded);
 	ClassDB::bind_method(D_METHOD("set_atlas_res", "atlas_res"), &SpineSkeletonDataResource::set_atlas_res);
 	ClassDB::bind_method(D_METHOD("get_atlas_res"), &SpineSkeletonDataResource::get_atlas_res);
 	ClassDB::bind_method(D_METHOD("set_skeleton_file_res", "skeleton_file_res"), &SpineSkeletonDataResource::set_skeleton_file_res);
 	ClassDB::bind_method(D_METHOD("get_skeleton_file_res"), &SpineSkeletonDataResource::get_skeleton_file_res);
-	ClassDB::bind_method(D_METHOD("is_skeleton_data_loaded"), &SpineSkeletonDataResource::is_skeleton_data_loaded);
-	ClassDB::bind_method(D_METHOD("find_animation", "animation_name"), &SpineSkeletonDataResource::find_animation);
-	ClassDB::bind_method(D_METHOD("get_sk_name"), &SpineSkeletonDataResource::get_sk_name);
-	ClassDB::bind_method(D_METHOD("set_sk_name", "sk_name"), &SpineSkeletonDataResource::set_sk_name);
-	ClassDB::bind_method(D_METHOD("get_x"), &SpineSkeletonDataResource::get_x);
-	ClassDB::bind_method(D_METHOD("set_x", "v"), &SpineSkeletonDataResource::set_x);
-	ClassDB::bind_method(D_METHOD("get_y"), &SpineSkeletonDataResource::get_y);
-	ClassDB::bind_method(D_METHOD("set_y", "v"), &SpineSkeletonDataResource::set_y);
-	ClassDB::bind_method(D_METHOD("get_width"), &SpineSkeletonDataResource::get_width);
-	ClassDB::bind_method(D_METHOD("get_height"), &SpineSkeletonDataResource::get_height);
-	ClassDB::bind_method(D_METHOD("get_version"), &SpineSkeletonDataResource::get_version);
-	ClassDB::bind_method(D_METHOD("get_fps"), &SpineSkeletonDataResource::get_fps);
-	ClassDB::bind_method(D_METHOD("set_fps", "v"), &SpineSkeletonDataResource::set_fps);
 
+	// Spine API
 	ClassDB::bind_method(D_METHOD("find_bone", "bone_name"), &SpineSkeletonDataResource::find_bone);
 	ClassDB::bind_method(D_METHOD("find_slot", "slot_name"), &SpineSkeletonDataResource::find_slot);
 	ClassDB::bind_method(D_METHOD("find_skin", "skin_name"), &SpineSkeletonDataResource::find_skin);
 	ClassDB::bind_method(D_METHOD("find_event", "event_data_name"), &SpineSkeletonDataResource::find_event);
+	ClassDB::bind_method(D_METHOD("find_animation", "animation_name"), &SpineSkeletonDataResource::find_animation);
 	ClassDB::bind_method(D_METHOD("find_ik_constraint_data", "constraint_name"), &SpineSkeletonDataResource::find_ik_constraint);
 	ClassDB::bind_method(D_METHOD("find_transform_constraint_data", "constraint_name"), &SpineSkeletonDataResource::find_transform_constraint);
 	ClassDB::bind_method(D_METHOD("find_path_constraint_data", "constraint_name"), &SpineSkeletonDataResource::find_path_constraint);
-	ClassDB::bind_method(D_METHOD("get_all_bone_data"), &SpineSkeletonDataResource::get_bones);
-	ClassDB::bind_method(D_METHOD("get_all_slot_data"), &SpineSkeletonDataResource::get_slots);
+	ClassDB::bind_method(D_METHOD("get_skeleton_name"), &SpineSkeletonDataResource::get_skeleton_name);
+	ClassDB::bind_method(D_METHOD("get_bones"), &SpineSkeletonDataResource::get_bones);
+	ClassDB::bind_method(D_METHOD("get_slots"), &SpineSkeletonDataResource::get_slots);
 	ClassDB::bind_method(D_METHOD("get_skins"), &SpineSkeletonDataResource::get_skins);
 	ClassDB::bind_method(D_METHOD("get_default_skin"), &SpineSkeletonDataResource::get_default_skin);
-	ClassDB::bind_method(D_METHOD("set_default_skin", "v"), &SpineSkeletonDataResource::set_default_skin);
-	ClassDB::bind_method(D_METHOD("get_all_event_data"), &SpineSkeletonDataResource::get_events);
+	ClassDB::bind_method(D_METHOD("set_default_skin", "skin"), &SpineSkeletonDataResource::set_default_skin);
+	ClassDB::bind_method(D_METHOD("get_events"), &SpineSkeletonDataResource::get_events);
 	ClassDB::bind_method(D_METHOD("get_animations"), &SpineSkeletonDataResource::get_animations);
-	ClassDB::bind_method(D_METHOD("get_all_ik_constraint_data"), &SpineSkeletonDataResource::get_ik_constraints);
-	ClassDB::bind_method(D_METHOD("get_all_transform_constraint_data"), &SpineSkeletonDataResource::get_transform_constraints);
-	ClassDB::bind_method(D_METHOD("get_all_path_constraint_data"), &SpineSkeletonDataResource::get_path_constraints);
+	ClassDB::bind_method(D_METHOD("get_ik_constraints"), &SpineSkeletonDataResource::get_ik_constraints);
+	ClassDB::bind_method(D_METHOD("get_transform_constraints"), &SpineSkeletonDataResource::get_transform_constraints);
+	ClassDB::bind_method(D_METHOD("get_path_constraints"), &SpineSkeletonDataResource::get_path_constraints);
+	ClassDB::bind_method(D_METHOD("get_x"), &SpineSkeletonDataResource::get_x);
+	ClassDB::bind_method(D_METHOD("get_y"), &SpineSkeletonDataResource::get_y);
+	ClassDB::bind_method(D_METHOD("get_width"), &SpineSkeletonDataResource::get_width);
+	ClassDB::bind_method(D_METHOD("get_height"), &SpineSkeletonDataResource::get_height);
+	ClassDB::bind_method(D_METHOD("get_version"), &SpineSkeletonDataResource::get_version);
+	ClassDB::bind_method(D_METHOD("get_hash"), &SpineSkeletonDataResource::get_hash);
+	ClassDB::bind_method(D_METHOD("get_images_path"), &SpineSkeletonDataResource::get_images_path);
+	ClassDB::bind_method(D_METHOD("get_audio_path"), &SpineSkeletonDataResource::get_audio_path);
+	ClassDB::bind_method(D_METHOD("get_fps"), &SpineSkeletonDataResource::get_fps);
 
-	ADD_SIGNAL(MethodInfo("skeleton_data_loaded"));
-	ADD_SIGNAL(MethodInfo("atlas_res_changed"));
-	ADD_SIGNAL(MethodInfo("skeleton_file_res_changed"));
+	ADD_SIGNAL(MethodInfo("skeleton_data_changed"));
 
 	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "atlas_res", PropertyHint::PROPERTY_HINT_RESOURCE_TYPE, "SpineAtlasResource"), "set_atlas_res", "get_atlas_res");
 	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "skeleton_file_res", PropertyHint::PROPERTY_HINT_RESOURCE_TYPE, "SpineSkeletonFileResource"), "set_skeleton_file_res", "get_skeleton_file_res");
 }
 
-SpineSkeletonDataResource::SpineSkeletonDataResource() : valid(false), spine_object(false), skeleton_data(NULL) {
-}
-SpineSkeletonDataResource::~SpineSkeletonDataResource() {
-	if (skeleton_data && !spine_object) {
-		delete skeleton_data;
-		skeleton_data = NULL;
-	}
+SpineSkeletonDataResource::SpineSkeletonDataResource() : skeleton_data(nullptr), animation_state_data(nullptr) {
 }
 
-bool SpineSkeletonDataResource::is_skeleton_data_loaded() const {
-	return valid || spine_object;
+SpineSkeletonDataResource::~SpineSkeletonDataResource() {
+	delete skeleton_data;
+	delete animation_state_data;
 }
 
-void SpineSkeletonDataResource::load_res(spine::Atlas *atlas, const String &json, const Vector<uint8_t> &binary) {
-	valid = false;
+void SpineSkeletonDataResource::update_skeleton_data() {
 	if (skeleton_data) {
 		delete skeleton_data;
-		skeleton_data = NULL;
+		skeleton_data = nullptr;
+	}
+	if (animation_state_data) {
+		delete animation_state_data;
+		animation_state_data = nullptr;
 	}
 
-	if ((json.empty() && binary.empty()) || atlas == NULL) return;
+	if (atlas_res.is_valid() && skeleton_file_res.is_valid()) {
+		load_res(atlas_res->get_spine_atlas(), skeleton_file_res->get_json(), skeleton_file_res->get_binary());
+	}
+	emit_signal("skeleton_data_changed");
+#ifdef TOOLS_ENABLED
+	property_list_changed_notify();
+#endif
+}
+
+void SpineSkeletonDataResource::load_res(spine::Atlas *atlas, const String &json, const Vector<uint8_t> &binary) {
+	if ((json.empty() && binary.empty()) || atlas == nullptr) return;
 
-	spine::SkeletonData *skeletonData = NULL;
+	spine::SkeletonData *data;
 	if (!json.empty()) {
 		spine::SkeletonJson skeletonJson(atlas);
-		skeletonData = skeletonJson.readSkeletonData(json.utf8());
-		if (!skeletonData) {
+		data = skeletonJson.readSkeletonData(json.utf8());
+		if (!data) {
 			print_error(String("Error while loading skeleton data: ") + get_path());
 			print_error(String("Error message: ") + skeletonJson.getError().buffer());
 			return;
 		}
 	} else {
 		spine::SkeletonBinary skeletonBinary(atlas);
-		skeletonData = skeletonBinary.readSkeletonData(binary.ptr(), binary.size());
-		if (!skeletonData) {
+		data = skeletonBinary.readSkeletonData(binary.ptr(), binary.size());
+		if (!data) {
 			print_error(String("Error while loading skeleton data: ") + get_path());
 			print_error(String("Error message: ") + skeletonBinary.getError().buffer());
 			return;
 		}
 	}
-	skeleton_data = skeletonData;
-	valid = true;
+	skeleton_data = data;
+	animation_state_data = new spine::AnimationStateData(data);
 }
 
-void SpineSkeletonDataResource::update_skeleton_data() {
-	if (atlas_res.is_valid() && skeleton_file_res.is_valid()) {
-		load_res(atlas_res->get_spine_atlas(), skeleton_file_res->get_json(), skeleton_file_res->get_binary());
-		if (valid) {
-			emit_signal("skeleton_data_loaded");
-		}
-	}
+bool SpineSkeletonDataResource::is_skeleton_data_loaded() const {
+	return skeleton_data != nullptr;
 }
 
-void SpineSkeletonDataResource::set_atlas_res(const Ref<SpineAtlasResource> &a) {
-	atlas_res = a;
-	valid = false;
-	emit_signal("atlas_res_changed");
+void SpineSkeletonDataResource::set_atlas_res(const Ref<SpineAtlasResource> &atlas) {
+	atlas_res = atlas;
 	update_skeleton_data();
 }
 Ref<SpineAtlasResource> SpineSkeletonDataResource::get_atlas_res() {
 	return atlas_res;
 }
 
-void SpineSkeletonDataResource::set_skeleton_file_res(const Ref<SpineSkeletonFileResource> &s) {
-	skeleton_file_res = s;
-	valid = false;
-	emit_signal("skeleton_file_res_changed");
+void SpineSkeletonDataResource::set_skeleton_file_res(const Ref<SpineSkeletonFileResource> &skeleton_file) {
+	skeleton_file_res = skeleton_file;
 	update_skeleton_data();
 }
 Ref<SpineSkeletonFileResource> SpineSkeletonDataResource::get_skeleton_file_res() {
 	return skeleton_file_res;
 }
 
-#define CHECK_V                                         \
-	if (!is_skeleton_data_loaded()) {                   \
-		ERR_PRINT("skeleton data has not loaded yet!"); \
-		return;                                         \
+void SpineSkeletonDataResource::get_animation_names(Vector<String> &animation_names) const {
+	animation_names.clear();
+	if (!is_skeleton_data_loaded()) return;
+	auto animations = skeleton_data->getAnimations();
+	for (size_t i = 0; i < animations.size(); ++i) {
+		auto animation = animations[i];
+		animation_names.push_back(animation->getName().buffer());
+	}
+}
+
+void SpineSkeletonDataResource::get_skin_names(Vector<String> &skin_names) const {
+	skin_names.clear();
+	if (!is_skeleton_data_loaded()) return;
+	auto skins = skeleton_data->getSkins();
+	for (size_t i = 0; i < skins.size(); ++i) {
+		auto skin = skins[i];
+		skin_names.push_back(skin->getName().buffer());
 	}
-#define CHECK_X(x)                                      \
+}
+
+void SpineSkeletonDataResource::_get_property_list(List<PropertyInfo> *p_list) const {
+	PropertyInfo property;
+	Vector<String> animation_names;
+
+	property.name = "animations";
+	property.type = Variant::STRING;
+	get_animation_names(animation_names);
+	property.hint_string = String(",").join(animation_names);
+	property.hint = PROPERTY_HINT_ENUM;
+	p_list->push_back(property);
+
+	property.name = "skins";
+	property.type = Variant::STRING;
+	get_skin_names(animation_names);
+	property.hint_string = String(",").join(animation_names);
+	property.hint = PROPERTY_HINT_ENUM;
+	p_list->push_back(property);
+}
+
+#define CHECK(x)                                      \
 	if (!is_skeleton_data_loaded()) {                   \
 		ERR_PRINT("skeleton data has not loaded yet!"); \
 		return x;                                       \
 	}
-#define S_T(x) (spine::String(x.utf8()))
-Ref<SpineAnimation> SpineSkeletonDataResource::find_animation(const String &animation_name) {
-	CHECK_X(NULL);
-	if (animation_name.empty()) {
-		return NULL;
-	}
-	auto a = skeleton_data->findAnimation(S_T(animation_name));
-	if (!a) return NULL;
-	Ref<SpineAnimation> sa(memnew(SpineAnimation));
-	sa->set_spine_object(a);
-	return sa;
-}
-String SpineSkeletonDataResource::get_sk_name() {
-	CHECK_X("error");
-	return skeleton_data->getName().buffer();
-}
-void SpineSkeletonDataResource::set_sk_name(const String &v) {
-	CHECK_V;
-	skeleton_data->setName(S_T(v));
-}
-float SpineSkeletonDataResource::get_x() {
-	CHECK_X(0);
-	return skeleton_data->getX();
-}
-void SpineSkeletonDataResource::set_x(float v) {
-	CHECK_V;
-	skeleton_data->setX(v);
+
+#define S_T(x) (spine::String((x).utf8()))
+Ref<SpineAnimation> SpineSkeletonDataResource::find_animation(const String &animation_name) const {
+	CHECK(nullptr)
+	if (animation_name.empty()) return nullptr;
+	auto animation = skeleton_data->findAnimation(S_T(animation_name));
+	if (!animation) return nullptr;
+	Ref<SpineAnimation> animation_ref(memnew(SpineAnimation));
+	animation_ref->set_spine_object(animation);
+	return animation_ref;
 }
-float SpineSkeletonDataResource::get_y() {
-	CHECK_X(0);
-	return skeleton_data->getY();
+
+Ref<SpineBoneData> SpineSkeletonDataResource::find_bone(const String &bone_name) const {
+	CHECK(nullptr)
+	if (bone_name.empty()) return nullptr;
+	auto bone = skeleton_data->findBone(S_T(bone_name));
+	if (bone == nullptr) return nullptr;
+	Ref<SpineBoneData> bone_ref(memnew(SpineBoneData));
+	bone_ref->set_spine_object(bone);
+	return bone_ref;
 }
-void SpineSkeletonDataResource::set_y(float v) {
-	CHECK_V;
-	skeleton_data->setY(v);
+
+Ref<SpineSlotData> SpineSkeletonDataResource::find_slot(const String &slot_name) const {
+	CHECK(nullptr)
+	if (slot_name.empty()) return nullptr;
+	auto slot = skeleton_data->findSlot(S_T(slot_name));
+	if (slot == nullptr) return nullptr;
+	Ref<SpineSlotData> slot_ref(memnew(SpineSlotData));
+	slot_ref->set_spine_object(slot);
+	return slot_ref;
 }
-float SpineSkeletonDataResource::get_width() {
-	CHECK_X(0);
-	return skeleton_data->getWidth();
+
+Ref<SpineSkin> SpineSkeletonDataResource::find_skin(const String &skin_name) const {
+	CHECK(nullptr)
+	if (skin_name.empty()) return nullptr;
+	auto skin = skeleton_data->findSkin(S_T(skin_name));
+	if (skin == nullptr) return nullptr;
+	Ref<SpineSkin> skin_ref(memnew(SpineSkin));
+	skin_ref->set_spine_object(skin);
+	return skin_ref;
 }
-float SpineSkeletonDataResource::get_height() {
-	CHECK_X(0);
-	return skeleton_data->getHeight();
+
+Ref<SpineEventData> SpineSkeletonDataResource::find_event(const String &event_data_name) const {
+	CHECK(nullptr)
+	if (event_data_name.empty()) return nullptr;
+	auto event = skeleton_data->findEvent(S_T(event_data_name));
+	if (event == nullptr) return nullptr;
+	Ref<SpineEventData> event_ref(memnew(SpineEventData));
+	event_ref->set_spine_object(event);
+	return event_ref;
 }
-String SpineSkeletonDataResource::get_version() {
-	CHECK_X("error");
-	return skeleton_data->getVersion().buffer();
+
+Ref<SpineIkConstraintData> SpineSkeletonDataResource::find_ik_constraint(const String &constraint_name) const {
+	CHECK(nullptr)
+	if (constraint_name.empty()) return nullptr;
+	auto constraint = skeleton_data->findIkConstraint(S_T(constraint_name));
+	if (constraint == nullptr) return nullptr;
+	Ref<SpineIkConstraintData> constraint_ref(memnew(SpineIkConstraintData));
+	constraint_ref->set_spine_object(constraint);
+	return constraint_ref;
+}
+Ref<SpineTransformConstraintData> SpineSkeletonDataResource::find_transform_constraint(const String &constraint_name) const {
+	CHECK(nullptr)
+	if (constraint_name.empty()) return nullptr;
+	auto constraint = skeleton_data->findTransformConstraint(S_T(constraint_name));
+	if (constraint == nullptr) return nullptr;
+	Ref<SpineTransformConstraintData> constraint_ref(memnew(SpineTransformConstraintData));
+	constraint_ref->set_spine_object(constraint);
+	return constraint_ref;
+}
+Ref<SpinePathConstraintData> SpineSkeletonDataResource::find_path_constraint(const String &constraint_name) const {
+	CHECK(nullptr)
+	if (constraint_name.empty()) return nullptr;
+	auto constraint = skeleton_data->findPathConstraint(S_T(constraint_name));
+	if (constraint == nullptr) return nullptr;
+	Ref<SpinePathConstraintData> constraint_ref(memnew(SpinePathConstraintData));
+	constraint_ref->set_spine_object(constraint);
+	return constraint_ref;
 }
-float SpineSkeletonDataResource::get_fps() {
-	CHECK_X(0);
-	return skeleton_data->getFps();
+
+String SpineSkeletonDataResource::get_skeleton_name() const{
+	CHECK("")
+	return skeleton_data->getName().buffer();
 }
-void SpineSkeletonDataResource::set_fps(float v) {
-	CHECK_V;
-	skeleton_data->setFps(v);
-}
-
-Ref<SpineBoneData> SpineSkeletonDataResource::find_bone(const String &bone_name) {
-	if (bone_name.empty()) return NULL;
-	auto b = skeleton_data->findBone(S_T(bone_name));
-	if (b == NULL) return NULL;
-	Ref<SpineBoneData> gd_b(memnew(SpineBoneData));
-	gd_b->set_spine_object(b);
-	return gd_b;
-}
-
-Ref<SpineSlotData> SpineSkeletonDataResource::find_slot(const String &slot_name) {
-	if (slot_name.empty()) return NULL;
-	auto b = skeleton_data->findSlot(S_T(slot_name));
-	if (b == NULL) return NULL;
-	Ref<SpineSlotData> gd_b(memnew(SpineSlotData));
-	gd_b->set_spine_object(b);
-	return gd_b;
-}
-
-Ref<SpineSkin> SpineSkeletonDataResource::find_skin(const String &skin_name) {
-	if (skin_name.empty()) return NULL;
-	auto b = skeleton_data->findSkin(S_T(skin_name));
-	if (b == NULL) return NULL;
-	Ref<SpineSkin> gd_b(memnew(SpineSkin));
-	gd_b->set_spine_object(b);
-	return gd_b;
-}
-
-Ref<SpineEventData> SpineSkeletonDataResource::find_event(const String &event_data_name) {
-	if (event_data_name.empty()) return NULL;
-	auto b = skeleton_data->findEvent(S_T(event_data_name));
-	if (b == NULL) return NULL;
-	Ref<SpineEventData> gd_b(memnew(SpineEventData));
-	gd_b->set_spine_object(b);
-	return gd_b;
-}
-
-Ref<SpineIkConstraintData> SpineSkeletonDataResource::find_ik_constraint(const String &constraint_name) {
-	if (constraint_name.empty()) return NULL;
-	auto b = skeleton_data->findIkConstraint(S_T(constraint_name));
-	if (b == NULL) return NULL;
-	Ref<SpineIkConstraintData> gd_b(memnew(SpineIkConstraintData));
-	gd_b->set_spine_object(b);
-	return gd_b;
-}
-Ref<SpineTransformConstraintData> SpineSkeletonDataResource::find_transform_constraint(const String &constraint_name) {
-	if (constraint_name.empty()) return NULL;
-	auto b = skeleton_data->findTransformConstraint(S_T(constraint_name));
-	if (b == NULL) return NULL;
-	Ref<SpineTransformConstraintData> gd_b(memnew(SpineTransformConstraintData));
-	gd_b->set_spine_object(b);
-	return gd_b;
-}
-Ref<SpinePathConstraintData> SpineSkeletonDataResource::find_path_constraint(const String &constraint_name) {
-	if (constraint_name.empty()) return NULL;
-	auto b = skeleton_data->findPathConstraint(S_T(constraint_name));
-	if (b == NULL) return NULL;
-	Ref<SpinePathConstraintData> gd_b(memnew(SpinePathConstraintData));
-	gd_b->set_spine_object(b);
-	return gd_b;
-}
-
-Array SpineSkeletonDataResource::get_bones() {
-	auto bs = skeleton_data->getBones();
-	Array gd_bs;
-	gd_bs.resize(bs.size());
-	for (size_t i = 0; i < bs.size(); ++i) {
-		if (bs[i] == NULL) gd_bs[i] = Ref<SpineBoneData>(NULL);
-		else {
-			Ref<SpineBoneData> gd_b(memnew(SpineBoneData));
-			gd_b->set_spine_object(bs[i]);
-			gd_bs[i] = gd_b;
-		}
+
+Array SpineSkeletonDataResource::get_bones() const {
+	Array bone_refs;
+	CHECK(bone_refs)
+	auto bones = skeleton_data->getBones();
+	bone_refs.resize((int)bones.size());
+	for (int i = 0; i < bones.size(); ++i) {
+		Ref<SpineBoneData> bone_ref(memnew(SpineBoneData));
+		bone_ref->set_spine_object(bones[i]);
+		bone_refs[i] = bone_ref;
 	}
-	return gd_bs;
-}
-Array SpineSkeletonDataResource::get_slots() {
-	auto bs = skeleton_data->getSlots();
-	Array gd_bs;
-	gd_bs.resize(bs.size());
-	for (size_t i = 0; i < bs.size(); ++i) {
-		if (bs[i] == NULL) gd_bs[i] = Ref<SpineSlotData>(NULL);
-		else {
-			Ref<SpineSlotData> gd_b(memnew(SpineSlotData));
-			gd_b->set_spine_object(bs[i]);
-			gd_bs[i] = gd_b;
-		}
+	return bone_refs;
+}
+
+Array SpineSkeletonDataResource::get_slots() const {
+	Array slot_refs;
+	CHECK(slot_refs)
+	auto slots = skeleton_data->getSlots();
+	slot_refs.resize((int)slots.size());
+	for (int i = 0; i < slots.size(); ++i) {
+		Ref<SpineSlotData> slot_ref(memnew(SpineSlotData));
+		slot_ref->set_spine_object(slots[i]);
+		slot_refs[i] = slot_ref;
 	}
-	return gd_bs;
+	return slot_refs;
 }
+
 Array SpineSkeletonDataResource::get_skins() const {
-	auto bs = skeleton_data->getSkins();
-	Array gd_bs;
-	gd_bs.resize(bs.size());
-	for (size_t i = 0; i < bs.size(); ++i) {
-		if (bs[i] == NULL) gd_bs[i] = Ref<SpineSkin>(NULL);
-		else {
-			Ref<SpineSkin> gd_b(memnew(SpineSkin));
-			gd_b->set_spine_object(bs[i]);
-			gd_bs[i] = gd_b;
-		}
+	Array skin_refs;
+	CHECK(skin_refs)
+	auto skins = skeleton_data->getSkins();
+	skin_refs.resize((int)skins.size());
+	for (int i = 0; i < skins.size(); ++i) {
+		Ref<SpineSkin> skin_ref(memnew(SpineSkin));
+		skin_ref->set_spine_object(skins[i]);
+		skin_refs[i] = skin_ref;
 	}
-	return gd_bs;
-}
-
-Ref<SpineSkin> SpineSkeletonDataResource::get_default_skin() {
-	auto b = skeleton_data->getDefaultSkin();
-	if (b == NULL) return NULL;
-	Ref<SpineSkin> gd_b(memnew(SpineSkin));
-	gd_b->set_spine_object(b);
-	return gd_b;
-}
-void SpineSkeletonDataResource::set_default_skin(Ref<SpineSkin> v) {
-	if (v.is_valid()) {
-		skeleton_data->setDefaultSkin(v->get_spine_object());
-	} else
-		skeleton_data->setDefaultSkin(NULL);
-}
-
-Array SpineSkeletonDataResource::get_events() {
-	auto bs = skeleton_data->getEvents();
-	Array gd_bs;
-	gd_bs.resize(bs.size());
-	for (size_t i = 0; i < bs.size(); ++i) {
-		if (bs[i] == NULL) gd_bs[i] = Ref<SpineEventData>(NULL);
-		else {
-			Ref<SpineEventData> gd_b(memnew(SpineEventData));
-			gd_b->set_spine_object(bs[i]);
-			gd_bs[i] = gd_b;
-		}
-	}
-	return gd_bs;
-}
-Array SpineSkeletonDataResource::get_animations() {
-	auto bs = skeleton_data->getAnimations();
-	Array gd_bs;
-	gd_bs.resize(bs.size());
-	for (size_t i = 0; i < bs.size(); ++i) {
-		if (bs[i] == NULL) gd_bs[i] = Ref<SpineAnimation>(NULL);
-		else {
-			Ref<SpineAnimation> gd_b(memnew(SpineAnimation));
-			gd_b->set_spine_object(bs[i]);
-			gd_bs[i] = gd_b;
-		}
-	}
-	return gd_bs;
-}
-Array SpineSkeletonDataResource::get_ik_constraints() {
-	auto bs = skeleton_data->getIkConstraints();
-	Array gd_bs;
-	gd_bs.resize(bs.size());
-	for (size_t i = 0; i < bs.size(); ++i) {
-		if (bs[i] == NULL) gd_bs[i] = Ref<SpineIkConstraintData>(NULL);
-		else {
-			Ref<SpineIkConstraintData> gd_b(memnew(SpineIkConstraintData));
-			gd_b->set_spine_object(bs[i]);
-			gd_bs[i] = gd_b;
-		}
-	}
-	return gd_bs;
-}
-Array SpineSkeletonDataResource::get_transform_constraints() {
-	auto bs = skeleton_data->getTransformConstraints();
-	Array gd_bs;
-	gd_bs.resize(bs.size());
-	for (size_t i = 0; i < bs.size(); ++i) {
-		if (bs[i] == NULL) gd_bs[i] = Ref<SpineTransformConstraintData>(NULL);
-		else {
-			Ref<SpineTransformConstraintData> gd_b(memnew(SpineTransformConstraintData));
-			gd_b->set_spine_object(bs[i]);
-			gd_bs[i] = gd_b;
-		}
+	return skin_refs;
+}
+
+Ref<SpineSkin> SpineSkeletonDataResource::get_default_skin() const {
+	CHECK(nullptr)
+	auto skin = skeleton_data->getDefaultSkin();
+	if (skin == nullptr) return nullptr;
+	Ref<SpineSkin> skin_ref(memnew(SpineSkin));
+	skin_ref->set_spine_object(skin);
+	return skin_ref;
+}
+
+void SpineSkeletonDataResource::set_default_skin(Ref<SpineSkin> skin) {
+	CHECK()
+	if (skin.is_valid())
+		skeleton_data->setDefaultSkin(skin->get_spine_object());
+	else
+		skeleton_data->setDefaultSkin(nullptr);
+}
+
+Array SpineSkeletonDataResource::get_events() const {
+	Array event_refs;
+	CHECK(event_refs)
+	auto events = skeleton_data->getEvents();
+	event_refs.resize((int)events.size());
+	for (int i = 0; i < events.size(); ++i) {
+		Ref<SpineEventData> event_ref(memnew(SpineEventData));
+		event_ref->set_spine_object(events[i]);
+		event_refs[i] = event_ref;
 	}
-	return gd_bs;
-}
-Array SpineSkeletonDataResource::get_path_constraints() {
-	auto bs = skeleton_data->getPathConstraints();
-	Array gd_bs;
-	gd_bs.resize(bs.size());
-	for (size_t i = 0; i < bs.size(); ++i) {
-		if (bs[i] == NULL) gd_bs[i] = Ref<SpinePathConstraintData>(NULL);
-		else {
-			Ref<SpinePathConstraintData> gd_b(memnew(SpinePathConstraintData));
-			gd_b->set_spine_object(bs[i]);
-			gd_bs[i] = gd_b;
-		}
+	return event_refs;
+}
+
+Array SpineSkeletonDataResource::get_animations() const {
+	Array animation_refs;
+	CHECK(animation_refs)
+	auto animations = skeleton_data->getAnimations();
+	animation_refs.resize((int)animations.size());
+	for (int i = 0; i < animations.size(); ++i) {
+		Ref<SpineAnimation> animation_ref(memnew(SpineAnimation));
+		animation_ref->set_spine_object(animations[i]);
+		animation_refs[i] = animation_ref;
 	}
-	return gd_bs;
+	return animation_refs;
 }
-#undef S_T
-#undef CHECK_V
-#undef CHECK_X
 
-//External feature functions
-void SpineSkeletonDataResource::get_animation_names(Vector<String> &res) const {
-	res.clear();
-	if (!is_skeleton_data_loaded()) {
-		return;
+Array SpineSkeletonDataResource::get_ik_constraints() const {
+	Array constraint_refs;
+	CHECK(constraint_refs)
+	auto constraints = skeleton_data->getIkConstraints();
+	constraint_refs.resize((int)constraints.size());
+	for (int i = 0; i < constraints.size(); ++i) {
+		Ref<SpineIkConstraintData> constraint_ref(memnew(SpineIkConstraintData));
+		constraint_ref->set_spine_object(constraints[i]);
+		constraint_refs[i] = constraint_ref;
 	}
-	auto as = skeleton_data->getAnimations();
-	for (size_t i = 0; i < as.size(); ++i) {
-		auto a = as[i];
-		if (a) {
-			res.push_back(a->getName().buffer());
-		} else {
-			res.push_back("");
-		}
+	return constraint_refs;
+}
+
+Array SpineSkeletonDataResource::get_transform_constraints() const {
+	Array constraint_refs;
+	CHECK(constraint_refs)
+	auto constraints = skeleton_data->getTransformConstraints();
+	constraint_refs.resize((int)constraints.size());
+	for (int i = 0; i < constraints.size(); ++i) {
+		Ref<SpineTransformConstraintData> constraint_ref(memnew(SpineTransformConstraintData));
+		constraint_ref->set_spine_object(constraints[i]);
+		constraint_refs[i] = constraint_ref;
 	}
+	return constraint_refs;
 }
-void SpineSkeletonDataResource::get_skin_names(Vector<String> &res) const {
-	res.clear();
-	if (!is_skeleton_data_loaded()) return;
-	auto as = get_skins();
-	res.resize(as.size());
-	for (size_t i = 0; i < as.size(); ++i) {
-		auto a = Ref<SpineSkin>(as[i]);
-		if (a.is_valid()) {
-			res.set(i, a->get_skin_name());
-		} else {
-			res.set(i, "");
-		}
+
+Array SpineSkeletonDataResource::get_path_constraints() const {
+	Array constraint_refs;
+	CHECK(constraint_refs)
+	auto constraints = skeleton_data->getPathConstraints();
+	constraint_refs.resize((int)constraints.size());
+	for (int i = 0; i < constraints.size(); ++i) {
+		Ref<SpinePathConstraintData> constraint_ref(memnew(SpinePathConstraintData));
+		constraint_ref->set_spine_object(constraints[i]);
+		constraint_refs[i] = constraint_ref;
 	}
+	return constraint_refs;
 }
 
-void SpineSkeletonDataResource::_get_property_list(List<PropertyInfo> *p_list) const {
-	PropertyInfo p;
-	Vector<String> res;
-
-	p.name = "animations";
-	p.type = Variant::STRING;
-	get_animation_names(res);
-	p.hint_string = String(",").join(res);
-	p.hint = PROPERTY_HINT_ENUM;
-	p_list->push_back(p);
-
-	p.name = "skins";
-	p.type = Variant::STRING;
-	get_skin_names(res);
-	p.hint_string = String(",").join(res);
-	p.hint = PROPERTY_HINT_ENUM;
-	p_list->push_back(p);
+float SpineSkeletonDataResource::get_x() const{
+	CHECK(0)
+	return skeleton_data->getX();
+}
+
+float SpineSkeletonDataResource::get_y() const {
+	CHECK(0)
+	return skeleton_data->getY();
+}
+
+float SpineSkeletonDataResource::get_width() const{
+	CHECK(0)
+	return skeleton_data->getWidth();
+}
+
+float SpineSkeletonDataResource::get_height() const {
+	CHECK(0)
+	return skeleton_data->getHeight();
+}
+
+String SpineSkeletonDataResource::get_version() const {
+	CHECK("")
+	return skeleton_data->getVersion().buffer();
+}
+
+String SpineSkeletonDataResource::get_hash() const {
+	CHECK("")
+	return skeleton_data->getHash().buffer();
+}
+
+
+String SpineSkeletonDataResource::get_images_path() const {
+	CHECK("")
+	return skeleton_data->getImagesPath().buffer();
+}
+
+String SpineSkeletonDataResource::get_audio_path() const {
+	CHECK("")
+	return skeleton_data->getAudioPath().buffer();
+}
+
+float SpineSkeletonDataResource::get_fps() const {
+	CHECK(0)
+	return skeleton_data->getFps();
 }

+ 55 - 78
spine-godot/godot/modules/spine_godot/SpineSkeletonDataResource.h

@@ -1,32 +1,3 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
 #ifndef GODOT_SPINESKELETONDATARESOURCE_H
 #define GODOT_SPINESKELETONDATARESOURCE_H
 
@@ -50,87 +21,93 @@ protected:
 private:
 	Ref<SpineAtlasResource> atlas_res;
 	Ref<SpineSkeletonFileResource> skeleton_file_res;
-	bool valid;
-	bool spine_object;
 
 	spine::SkeletonData *skeleton_data;
+	spine::AnimationStateData *animation_state_data;
 
 	void update_skeleton_data();
 
+	void load_res(spine::Atlas *atlas, const String &json, const Vector<uint8_t> &binary);
+
 public:
 	SpineSkeletonDataResource();
 	virtual ~SpineSkeletonDataResource();
 
-	inline void set_spine_object(spine::SkeletonData *s) {
-		skeleton_data = s;
-		if (s)
-			spine_object = true;
-	}
-	inline spine::SkeletonData *get_spine_object() {
-		return skeleton_data;
-	}
-
-	void load_res(spine::Atlas *atlas, const String &json, const Vector<uint8_t> &binary);
-
-	void _get_property_list(List<PropertyInfo> *p_list) const;
+	bool is_skeleton_data_loaded() const;
 
-	void set_atlas_res(const Ref<SpineAtlasResource> &a);
+	void set_atlas_res(const Ref<SpineAtlasResource> &atlas);
 	Ref<SpineAtlasResource> get_atlas_res();
 
-	void set_skeleton_file_res(const Ref<SpineSkeletonFileResource> &s);
+	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; }
 
-	bool is_skeleton_data_loaded() const;
+	inline spine::AnimationStateData *get_animation_state_data() const { return animation_state_data; }
+
+	void get_animation_names(Vector<String> &animation_names) const;
 
-	void get_animation_names(Vector<String> &l) const;
 	void get_skin_names(Vector<String> &l) const;
 
-	// spine api
-	Ref<SpineBoneData> find_bone(const String &bone_name);
+	void _get_property_list(List<PropertyInfo> *p_list) const;
+
+	// Spine API
+	Ref<SpineBoneData> find_bone(const String &bone_name) const;
+
+	Ref<SpineSlotData> find_slot(const String &slot_name) const;
 
-	Ref<SpineSlotData> find_slot(const String &slot_name);
+	Ref<SpineSkin> find_skin(const String &skin_name) const;
 
-	Ref<SpineSkin> find_skin(const String &skin_name);
+	Ref<SpineEventData> find_event(const String &event_data_name) const;
 
-	Ref<SpineEventData> find_event(const String &event_data_name);
+	Ref<SpineAnimation> find_animation(const String &animation_name) const;
 
-	Ref<SpineAnimation> find_animation(const String &animation_name);
+	Ref<SpineIkConstraintData> find_ik_constraint(const String &constraint_name) const;
 
-	Ref<SpineIkConstraintData> find_ik_constraint(const String &constraint_name);
-	Ref<SpineTransformConstraintData> find_transform_constraint(const String &constraint_name);
-	Ref<SpinePathConstraintData> find_path_constraint(const String &constraint_name);
+	Ref<SpineTransformConstraintData> find_transform_constraint(const String &constraint_name) const;
+
+	Ref<SpinePathConstraintData> find_path_constraint(const String &constraint_name) const;
+
+	String get_skeleton_name() const;
+
+	Array get_bones() const;
+
+	Array get_slots() const;
 
-	Array get_bones();
-	Array get_slots();
 	Array get_skins() const;
 
-	Ref<SpineSkin> get_default_skin();
-	void set_default_skin(Ref<SpineSkin> v);
+	Ref<SpineSkin> get_default_skin() const;
+
+	void set_default_skin(Ref<SpineSkin> skin);
+
+	Array get_events() const;
+
+	Array get_animations() const;
 
-	Array get_events();
-	Array get_animations();
-	Array get_ik_constraints();
-	Array get_transform_constraints();
-	Array get_path_constraints();
+	Array get_ik_constraints() const;
 
-	String get_sk_name();
-	void set_sk_name(const String &v);
+	Array get_transform_constraints() const;
 
-	float get_x();
-	void set_x(float v);
+	Array get_path_constraints() const;
 
-	float get_y();
-	void set_y(float v);
+	float get_x() const;
 
-	float get_width();
-	float get_height();
+	float get_y() const;
 
-	String get_version();
+	float get_width() const;
 
-	float get_fps();
-	void set_fps(float v);
+	float get_height() const;
+
+	String get_version() const;
+
+	String get_hash() const;
+
+	String get_images_path() const;
+
+	String get_audio_path() const;
+
+	float get_fps() const;
 };
 
-#endif//GODOT_SPINESKELETONDATARESOURCE_H
+
+#endif //GODOT_SPINESKELETONDATARESOURCE_H

+ 123 - 147
spine-godot/godot/modules/spine_godot/SpineSprite.cpp

@@ -31,14 +31,17 @@
 
 #include "SpineEvent.h"
 #include "SpineTrackEntry.h"
+#include "SpineSkeleton.h"
+
+Ref<CanvasItemMaterial> SpineSprite::materials[4] = {};
+static int sprite_count = 0;
 
 void SpineSprite::_bind_methods() {
-	ClassDB::bind_method(D_METHOD("set_animation_state_data_res", "animation_state_data_res"), &SpineSprite::set_animation_state_data_res);
-	ClassDB::bind_method(D_METHOD("get_animation_state_data_res"), &SpineSprite::get_animation_state_data_res);
-	ClassDB::bind_method(D_METHOD("_on_animation_data_created"), &SpineSprite::_on_animation_data_created);
+	ClassDB::bind_method(D_METHOD("set_skeleton_data_res", "skeleton_data_res"), &SpineSprite::set_skeleton_data_res);
+	ClassDB::bind_method(D_METHOD("get_skeleton_data_res"), &SpineSprite::get_skeleton_data_res);
 	ClassDB::bind_method(D_METHOD("get_skeleton"), &SpineSprite::get_skeleton);
 	ClassDB::bind_method(D_METHOD("get_animation_state"), &SpineSprite::get_animation_state);
-	ClassDB::bind_method(D_METHOD("_on_animation_data_changed"), &SpineSprite::_on_animation_data_changed);
+	ClassDB::bind_method(D_METHOD("_on_skeleton_data_changed"), &SpineSprite::_on_skeleton_data_changed);
 
 	ClassDB::bind_method(D_METHOD("get_bind_slot_nodes"), &SpineSprite::get_bind_slot_nodes);
 	ClassDB::bind_method(D_METHOD("set_bind_slot_nodes", "v"), &SpineSprite::set_bind_slot_nodes);
@@ -54,7 +57,6 @@ void SpineSprite::_bind_methods() {
 
 	ClassDB::bind_method(D_METHOD("update_all", "delta"), &SpineSprite::_update_all);
 
-	ADD_SIGNAL(MethodInfo("animation_state_ready", PropertyInfo(Variant::OBJECT, "animation_state", PROPERTY_HINT_TYPE_STRING, "SpineAnimationState"), PropertyInfo(Variant::OBJECT, "skeleton", PROPERTY_HINT_TYPE_STRING, "SpineSkeleton")));
 	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")));
@@ -62,7 +64,7 @@ void SpineSprite::_bind_methods() {
 	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_PROPERTY(PropertyInfo(Variant::OBJECT, "animation_state_data_res", PropertyHint::PROPERTY_HINT_RESOURCE_TYPE, "SpineAnimationStateDataResource"), "set_animation_state_data_res", "get_animation_state_data_res");
+	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::BOOL, "overlap"), "set_overlap", "get_overlap");
 	ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "bind_slot_nodes"), "set_bind_slot_nodes", "get_bind_slot_nodes");
 
@@ -73,13 +75,86 @@ void SpineSprite::_bind_methods() {
 	BIND_ENUM_CONSTANT(ProcessMode::ProcessMode_Manual);
 }
 
-SpineSprite::SpineSprite() : overlap(false),
-							 skeleton_clipper(NULL),
-							 process_mode(ProcessMode_Process) {
+SpineSprite::SpineSprite() : overlap(false), process_mode(ProcessMode_Process), skeleton_clipper(nullptr) {
 	skeleton_clipper = new spine::SkeletonClipping();
+
+	// One material per blend mode, shared across all sprites.
+	if (!materials[0].is_valid()) {
+		Ref<CanvasItemMaterial> material_normal(memnew(CanvasItemMaterial));
+		material_normal->set_blend_mode(CanvasItemMaterial::BLEND_MODE_MIX);
+		materials[spine::BlendMode_Normal] = material_normal;
+
+		Ref<CanvasItemMaterial> material_additive(memnew(CanvasItemMaterial));
+		material_additive->set_blend_mode(CanvasItemMaterial::BLEND_MODE_ADD);
+		materials[spine::BlendMode_Additive] = material_additive;
+
+		Ref<CanvasItemMaterial> material_multiply(memnew(CanvasItemMaterial));
+		material_multiply->set_blend_mode(CanvasItemMaterial::BLEND_MODE_MUL);
+		materials[spine::BlendMode_Multiply] = material_multiply;
+
+		Ref<CanvasItemMaterial> material_screen(memnew(CanvasItemMaterial));
+		material_screen->set_blend_mode(CanvasItemMaterial::BLEND_MODE_MIX);
+		materials[spine::BlendMode_Screen] = material_screen;
+	}
+	sprite_count++;
 }
+
 SpineSprite::~SpineSprite() {
 	delete skeleton_clipper;
+	sprite_count--;
+	if (!sprite_count) {
+		for (int i = 0; i < 4; i++) materials[i].unref();
+	}
+}
+
+void SpineSprite::set_skeleton_data_res(const Ref<SpineSkeletonDataResource> &s) {
+	skeleton_data_res = s;
+	_on_skeleton_data_changed();
+}
+Ref<SpineSkeletonDataResource> SpineSprite::get_skeleton_data_res() {
+	return skeleton_data_res;
+}
+
+void SpineSprite::_on_skeleton_data_changed() {
+	remove_meshes();
+	skeleton.unref();
+	animation_state.unref();
+
+	if (skeleton_data_res.is_valid()) {
+		if (!skeleton_data_res->is_connected("skeleton_data_changed", this, "_on_skeleton_data_changed"))
+			skeleton_data_res->connect("skeleton_data_changed", this, "_on_skeleton_data_changed");
+	}
+
+	if (skeleton_data_res.is_valid() && skeleton_data_res->is_skeleton_data_loaded()) {
+		skeleton = Ref<SpineSkeleton>(memnew(SpineSkeleton));
+		skeleton->set_skeleton_data_res(skeleton_data_res);
+		skeleton->set_spine_sprite(this);
+
+		animation_state = Ref<SpineAnimationState>(memnew(SpineAnimationState));
+		animation_state->set_skeleton_data_res(skeleton_data_res);
+		if (animation_state->get_spine_object()) animation_state->get_spine_object()->setListener(this);
+
+		animation_state->update(0);
+		animation_state->apply(skeleton);
+		skeleton->update_world_transform();
+		generate_meshes_for_slots(skeleton);
+
+		if (process_mode == ProcessMode_Process) {
+			_notification(NOTIFICATION_INTERNAL_PROCESS);
+		} else if (process_mode == ProcessMode_Physics) {
+			_notification(NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
+		}
+	}
+
+	property_list_changed_notify();
+}
+
+Ref<SpineSkeleton> SpineSprite::get_skeleton() {
+	return skeleton;
+}
+
+Ref<SpineAnimationState> SpineSprite::get_animation_state() {
+	return animation_state;
 }
 
 void SpineSprite::_notification(int p_what) {
@@ -87,7 +162,6 @@ void SpineSprite::_notification(int p_what) {
 		case NOTIFICATION_READY: {
 			set_process_internal(process_mode == ProcessMode_Process);
 			set_physics_process_internal(process_mode == ProcessMode_Physics);
-			remove_redundant_mesh_instances();
 		} break;
 		case NOTIFICATION_INTERNAL_PROCESS: {
 			if (process_mode == ProcessMode_Process)
@@ -110,7 +184,7 @@ void SpineSprite::_update_all(float delta) {
 
 	animation_state->apply(skeleton);
 	skeleton->update_world_transform();
-	update_mesh_from_skeleton(skeleton);
+	update_meshes(skeleton);
 	update();
 	update_bind_slot_nodes();
 }
@@ -161,9 +235,11 @@ void SpineSprite::update_bind_slot_nodes() {
 		}
 	}
 }
+
 void SpineSprite::update_bind_slot_node_transform(Ref<SpineBone> bone, Node2D *node2d) {
 	bone->apply_world_transform_2d(node2d);
 }
+
 void SpineSprite::update_bind_slot_node_draw_order(const String &slot_name, Node2D *node2d) {
 	auto mesh_ins = find_node(slot_name);
 	if (mesh_ins) {
@@ -177,105 +253,26 @@ void SpineSprite::update_bind_slot_node_draw_order(const String &slot_name, Node
 	}
 }
 Node *SpineSprite::find_child_node_by_node(Node *node) {
-	if (node == NULL) return NULL;
+	if (node == nullptr) return nullptr;
 	while (node && node->get_parent() != this) node = node->get_parent();
 	return node;
 }
 
-void SpineSprite::set_animation_state_data_res(const Ref<SpineAnimationStateDataResource> &s) {
-	animation_state_data_res = s;
-	_on_animation_data_changed();
-}
-Ref<SpineAnimationStateDataResource> SpineSprite::get_animation_state_data_res() {
-	return animation_state_data_res;
-}
-
-void SpineSprite::_on_animation_data_created() {
-	skeleton = Ref<SpineSkeleton>(memnew(SpineSkeleton));
-	skeleton->load_skeleton(animation_state_data_res->get_skeleton());
-	skeleton->set_spine_sprite(this);
+void SpineSprite::generate_meshes_for_slots(Ref<SpineSkeleton> skeleton_ref) {
+	auto skeleton = skeleton_ref->get_spine_object();
+	for (int i = 0, n = skeleton->getSlots().size(); i < n; i++) {
 
-	animation_state = Ref<SpineAnimationState>(memnew(SpineAnimationState));
-	animation_state->create_animation_state(animation_state_data_res->get_animation_state_data());
-	animation_state->get_spine_object()->setListener(this);
+		auto mesh_instance = memnew(MeshInstance2D);
+		mesh_instance->set_position(Vector2(0, 0));
+		mesh_instance->set_material(materials[spine::BlendMode_Normal]);
 
-	animation_state->update(0);
-	animation_state->apply(skeleton);
-	skeleton->update_world_transform();
-	gen_mesh_from_skeleton(skeleton);
-
-	if (process_mode == ProcessMode_Process) {
-		_notification(NOTIFICATION_INTERNAL_PROCESS);
-	} else if (process_mode == ProcessMode_Physics) {
-		_notification(NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
-	}
-
-	emit_signal("animation_state_ready", animation_state, skeleton);
-}
-void SpineSprite::_on_animation_data_changed() {
-	remove_mesh_instances();
-	skeleton.unref();
-	animation_state.unref();
-	if (!animation_state_data_res.is_null()) {
-		if (!animation_state_data_res->is_connected("animation_state_data_created", this, "_on_animation_data_created"))
-			animation_state_data_res->connect("animation_state_data_created", this, "_on_animation_data_created");
-		if (!animation_state_data_res->is_connected("skeleton_data_res_changed", this, "_on_animation_data_changed"))
-			animation_state_data_res->connect("skeleton_data_res_changed", this, "_on_animation_data_changed");
-		if (!animation_state_data_res->is_connected("animation_state_data_changed", this, "_on_animation_data_changed"))
-			animation_state_data_res->connect("animation_state_data_changed", this, "_on_animation_data_changed");
-
-		if (animation_state_data_res->is_animation_state_data_created()) {
-			_on_animation_data_created();
-		}
+		add_child(mesh_instance);
+		mesh_instance->set_owner(this);
+		mesh_instances.push_back(mesh_instance);
 	}
 }
 
-Ref<SpineSkeleton> SpineSprite::get_skeleton() {
-	return skeleton;
-}
-Ref<SpineAnimationState> SpineSprite::get_animation_state() {
-	return animation_state;
-}
-
-void SpineSprite::gen_mesh_from_skeleton(Ref<SpineSkeleton> s) {
-	auto sk = s->get_spine_object();
-	for (size_t i = 0, n = sk->getSlots().size(); i < n; ++i) {
-		auto mesh_ins = memnew(SpineSpriteMeshInstance2D);
-		add_child(mesh_ins);
-		mesh_ins->set_position(Vector2(0, 0));
-		mesh_ins->set_owner(this);
-		mesh_instances.push_back(mesh_ins);
-
-		spine::Slot *slot = sk->getDrawOrder()[i];
-		mesh_ins->set_name(slot->getData().getName().buffer());
-		Ref<SpineSlot> gd_slot(memnew(SpineSlot));
-		gd_slot->set_spine_object(slot);
-		mesh_ins->set_slot(gd_slot);
-
-		Ref<CanvasItemMaterial> mat(memnew(CanvasItemMaterial));
-		CanvasItemMaterial::BlendMode blend_mode;
-		switch (slot->getData().getBlendMode()) {
-			case spine::BlendMode_Normal:
-				blend_mode = CanvasItemMaterial::BLEND_MODE_MIX;
-				break;
-			case spine::BlendMode_Additive:
-				blend_mode = CanvasItemMaterial::BLEND_MODE_ADD;
-				break;
-			case spine::BlendMode_Multiply:
-				blend_mode = CanvasItemMaterial::BLEND_MODE_MUL;
-				break;
-			case spine::BlendMode_Screen:
-				blend_mode = CanvasItemMaterial::BLEND_MODE_MIX;
-				break;
-			default:
-				blend_mode = CanvasItemMaterial::BLEND_MODE_MIX;
-		}
-		mat->set_blend_mode(blend_mode);
-		mesh_ins->set_material(mat);
-	}
-}
-
-void SpineSprite::remove_mesh_instances() {
+void SpineSprite::remove_meshes() {
 	for (size_t i = 0; i < mesh_instances.size(); ++i) {
 		remove_child(mesh_instances[i]);
 		memdelete(mesh_instances[i]);
@@ -283,24 +280,6 @@ void SpineSprite::remove_mesh_instances() {
 	mesh_instances.clear();
 }
 
-void SpineSprite::remove_redundant_mesh_instances() {
-	Vector<Node *> ms;
-	// remove the redundant mesh instances that added by duplicating
-	for (size_t i = 0, n = get_child_count(); i < n; ++i) {
-		auto node = get_child(i);
-		if (node && node->is_class("SpineSpriteMeshInstance2D")) {
-			if (mesh_instances.find((SpineSpriteMeshInstance2D *) node) == -1) {
-				ms.push_back(node);
-			}
-		}
-	}
-	for (size_t i = 0, n = ms.size(); i < n; ++i) {
-		remove_child(ms[i]);
-		memdelete(ms[i]);
-	}
-	ms.clear();
-}
-
 #define TEMP_COPY(t, get_res)                   \
 	do {                                        \
 		auto &temp_uvs = get_res;               \
@@ -310,7 +289,7 @@ void SpineSprite::remove_redundant_mesh_instances() {
 		}                                       \
 	} while (false);
 
-void SpineSprite::update_mesh_from_skeleton(Ref<SpineSkeleton> s) {
+void SpineSprite::update_meshes(Ref<SpineSkeleton> s) {
 	static const unsigned short VERTEX_STRIDE = 2;
 	static unsigned short quad_indices[] = {0, 1, 2, 2, 3, 0};
 
@@ -468,33 +447,15 @@ void SpineSprite::update_mesh_from_skeleton(Ref<SpineSkeleton> s) {
 		skeleton_clipper->clipEnd(*slot);
 
 		if (mesh_ins->get_material()->is_class("CanvasItemMaterial")) {
-			Ref<CanvasItemMaterial> mat = mesh_ins->get_material();
-			CanvasItemMaterial::BlendMode blend_mode;
-			switch (slot->getData().getBlendMode()) {
-				case spine::BlendMode_Normal:
-					blend_mode = CanvasItemMaterial::BLEND_MODE_MIX;
-					break;
-				case spine::BlendMode_Additive:
-					blend_mode = CanvasItemMaterial::BLEND_MODE_ADD;
-					break;
-				case spine::BlendMode_Multiply:
-					blend_mode = CanvasItemMaterial::BLEND_MODE_MUL;
-					break;
-				case spine::BlendMode_Screen:
-					blend_mode = CanvasItemMaterial::BLEND_MODE_MIX;
-					break;
-				default:
-					blend_mode = CanvasItemMaterial::BLEND_MODE_MIX;
-			}
-			mat->set_blend_mode(blend_mode);
+			mesh_ins->set_material(materials[slot->getData().getBlendMode()]);
 		}
 	}
 	skeleton_clipper->clipEnd();
 }
 
 void SpineSprite::callback(spine::AnimationState *state, spine::EventType type, spine::TrackEntry *entry, spine::Event *event) {
-	Ref<SpineTrackEntry> gd_entry(NULL);
-	Ref<SpineEvent> gd_event(NULL);
+	Ref<SpineTrackEntry> gd_entry(nullptr);
+	Ref<SpineEvent> gd_event(nullptr);
 
 	if (entry) {
 		gd_entry = Ref<SpineTrackEntry>(memnew(SpineTrackEntry));
@@ -579,9 +540,9 @@ void SpineSprite::set_process_mode(SpineSprite::ProcessMode v) {
 void SpineSprite::_get_property_list(List<PropertyInfo> *p_list) const {
 	Vector<String> animations;
 	Vector<String> skins;
-	if (animation_state_data_res.is_valid() && animation_state_data_res->get_skeleton().is_valid()) {
-		animation_state_data_res->get_skeleton()->get_animation_names(animations);
-		animation_state_data_res->get_skeleton()->get_skin_names(skins);
+	if (skeleton_data_res.is_valid()) {
+		skeleton_data_res->get_animation_names(animations);
+		skeleton_data_res->get_skin_names(skins);
 	}
 	animations.insert(0, "- None -");
 
@@ -611,7 +572,7 @@ bool SpineSprite::_set(const StringName &p_property, const Variant &p_value) {
 		if (animation_state.is_valid() && skeleton.is_valid()) {
 			auto animName = p_value.operator String();
 			skeleton->set_to_setup_pose();
-			if (skeleton->get_data()->find_animation(animName).is_valid()) {
+			if (skeleton->get_skeleton_data_res()->find_animation(animName).is_valid()) {
 				animation_state->set_animation(animName, true, 0);
 			} else {
 				animation_state->clear_tracks();
@@ -622,13 +583,28 @@ bool SpineSprite::_set(const StringName &p_property, const Variant &p_value) {
 	if (p_property == "Preview skin") {
 		if (animation_state.is_valid() && skeleton.is_valid()) {
 			auto skinName = p_value.operator String();
-			if (skeleton->get_data()->find_skin(skinName).is_valid()) {
+			if (skeleton->get_skeleton_data_res()->find_skin(skinName).is_valid()) {
 				skeleton->set_skin_by_name(skinName);
 			} else {
-				skeleton->set_skin(NULL);
+				skeleton->set_skin(nullptr);
 			}
 			skeleton->set_to_setup_pose();
 		}
 	}
 	return false;
 }
+
+#ifdef TOOLS_ENABLED
+Rect2 SpineSprite::_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 SpineSprite::_edit_use_rect() const {
+	return skeleton_data_res.is_valid() && skeleton_data_res->is_skeleton_data_loaded();
+}
+#endif

+ 18 - 15
spine-godot/godot/modules/spine_godot/SpineSprite.h

@@ -30,13 +30,12 @@
 #ifndef GODOT_SPINESPRITE_H
 #define GODOT_SPINESPRITE_H
 
-#include <scene/resources/texture.h>
-#include <scene/2d/collision_polygon_2d.h>
+#include "scene/2d/node_2d.h"
+#include "scene/resources/texture.h"
 
-#include "SpineAnimationState.h"
-#include "SpineAnimationStateDataResource.h"
 #include "SpineSkeleton.h"
-#include "SpineSpriteMeshInstance2D.h"
+#include "SpineAnimationState.h"
+#include "scene/2d/mesh_instance_2d.h"
 
 class SpineSprite : public Node2D, public spine::AnimationStateListenerObject {
 	GDCLASS(SpineSprite, Node2D);
@@ -60,7 +59,7 @@ public:
 	};
 
 private:
-	Ref<SpineAnimationStateDataResource> animation_state_data_res;
+	Ref<SpineSkeletonDataResource> skeleton_data_res;
 
 	Ref<SpineSkeleton> skeleton;
 	Ref<SpineAnimationState> animation_state;
@@ -71,24 +70,24 @@ private:
 
 	ProcessMode process_mode;
 
-	Vector<SpineSpriteMeshInstance2D *> mesh_instances;
+	Vector<MeshInstance2D *> mesh_instances;
 	spine::SkeletonClipping *skeleton_clipper;
+	static Ref<CanvasItemMaterial> materials[4];
 
 public:
 	SpineSprite();
 	~SpineSprite();
 
-	void set_animation_state_data_res(const Ref<SpineAnimationStateDataResource> &a);
-	Ref<SpineAnimationStateDataResource> get_animation_state_data_res();
+	void set_skeleton_data_res(const Ref<SpineSkeletonDataResource> &a);
+	Ref<SpineSkeletonDataResource> get_skeleton_data_res();
 
 	Ref<SpineSkeleton> get_skeleton();
 	Ref<SpineAnimationState> get_animation_state();
 
-	void gen_mesh_from_skeleton(Ref<SpineSkeleton> s);
-	void remove_mesh_instances();
-	void remove_redundant_mesh_instances();
+	void generate_meshes_for_slots(Ref<SpineSkeleton> skeleton_ref);
+	void remove_meshes();
 
-	void update_mesh_from_skeleton(Ref<SpineSkeleton> s);
+	void update_meshes(Ref<SpineSkeleton> s);
 
 	void update_bind_slot_nodes();
 	void update_bind_slot_node_transform(Ref<SpineBone> bone, Node2D *node2d);
@@ -97,8 +96,7 @@ public:
 
 	virtual void callback(spine::AnimationState *state, spine::EventType type, spine::TrackEntry *entry, spine::Event *event);
 
-	void _on_animation_data_created();
-	void _on_animation_data_changed();
+	void _on_skeleton_data_changed();
 
 	void _update_all(float delta);
 
@@ -113,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(SpineSprite::ProcessMode);

+ 0 - 48
spine-godot/godot/modules/spine_godot/SpineSpriteMeshInstance2D.cpp

@@ -1,48 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#include "SpineSpriteMeshInstance2D.h"
-
-#include "SpineBone.h"
-
-void SpineSpriteMeshInstance2D::_bind_methods() {
-	ClassDB::bind_method(D_METHOD("get_slot"), &SpineSpriteMeshInstance2D::get_slot);
-	ClassDB::bind_method(D_METHOD("apply_transform_2d", "node2d"), &SpineSpriteMeshInstance2D::apply_transform_2d);
-}
-
-SpineSpriteMeshInstance2D::SpineSpriteMeshInstance2D() {}
-SpineSpriteMeshInstance2D::~SpineSpriteMeshInstance2D() {}
-
-Ref<SpineSlot> SpineSpriteMeshInstance2D::get_slot() {
-	return slot;
-}
-
-void SpineSpriteMeshInstance2D::apply_transform_2d(Variant o) {
-	slot->get_bone()->apply_world_transform_2d(o);
-}

+ 0 - 57
spine-godot/godot/modules/spine_godot/SpineSpriteMeshInstance2D.h

@@ -1,57 +0,0 @@
-/******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated January 1, 2020. Replaces all prior versions.
- *
- * Copyright (c) 2013-2020, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
- * or otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-#ifndef GODOT_SPINESPRITEMESHINSTANCE2D_H
-#define GODOT_SPINESPRITEMESHINSTANCE2D_H
-
-#include <scene/2d/mesh_instance_2d.h>
-
-#include "SpineSlot.h"
-
-class SpineSpriteMeshInstance2D : public MeshInstance2D {
-	GDCLASS(SpineSpriteMeshInstance2D, MeshInstance2D);
-
-protected:
-	static void _bind_methods();
-
-	Ref<SpineSlot> slot;
-
-public:
-	SpineSpriteMeshInstance2D();
-	~SpineSpriteMeshInstance2D();
-
-	inline void set_slot(Ref<SpineSlot> s) {
-		slot = s;
-	}
-	Ref<SpineSlot> get_slot();
-
-	void apply_transform_2d(Variant o);
-};
-
-#endif//GODOT_SPINESPRITEMESHINSTANCE2D_H

+ 8 - 12
spine-godot/godot/modules/spine_godot/register_types.cpp

@@ -33,7 +33,6 @@
 #include "SpineSkeletonFileResource.h"
 #include "SpineSkeletonDataResource.h"
 #include "SpineSprite.h"
-#include "SpineAnimationStateDataResource.h"
 #include "SpineSkeleton.h"
 #include "SpineAnimationState.h"
 #include "SpineEventData.h"
@@ -48,7 +47,6 @@
 #include "SpineIkConstraintData.h"
 #include "SpineTransformConstraintData.h"
 #include "SpinePathConstraintData.h"
-#include "SpineSpriteMeshInstance2D.h"
 #include "SpineTimeline.h"
 #include "SpineConstant.h"
 #include "SpineCollisionShapeProxy.h"
@@ -61,12 +59,12 @@ static Ref<SpineSkeletonFileResourceFormatSaver> skeleton_file_saver;
 #ifdef TOOLS_ENABLED
 #include "editor/editor_export.h"
 #include "editor/editor_node.h"
-#include "SpineRuntimeEditorPlugin.h"
-#include "SpineNewSkeletonDataResource.h"
-#include "SpineNewSprite.h"
+#include "SpineEditorPlugin.h"
+#include "SpineSkeletonDataResource.h"
+#include "SpineSprite.h"
 
 static void editor_init_callback() {
-	EditorNode::get_singleton()->add_editor_plugin(memnew(SpineRuntimeEditorPlugin(EditorNode::get_singleton())));
+	EditorNode::get_singleton()->add_editor_plugin(memnew(SpineEditorPlugin(EditorNode::get_singleton())));
 }
 
 #endif
@@ -79,12 +77,11 @@ void register_spine_godot_types() {
 	ClassDB::register_class<SpineAtlasResource>();
 	ClassDB::register_class<SpineSkeletonFileResource>();
 	ClassDB::register_class<SpineSkeletonDataResource>();
-	ClassDB::register_class<SpineNewSkeletonDataResource>();
-	ClassDB::register_class<SpineAnimationStateDataResource>();
+	ClassDB::register_class<SpineSkeletonDataResource>();
 	ClassDB::register_class<SpineSprite>();
-	ClassDB::register_class<SpineNewSprite>();
+	ClassDB::register_class<SpineSprite>();
+	ClassDB::register_class<SpineSkeleton>();
 	ClassDB::register_class<SpineSkeleton>();
-	ClassDB::register_class<SpineNewSkeleton>();
 	ClassDB::register_class<SpineAnimationState>();
 	ClassDB::register_class<SpineAnimation>();
 	ClassDB::register_class<SpineEventData>();
@@ -101,12 +98,11 @@ void register_spine_godot_types() {
 	ClassDB::register_class<SpineTransformConstraintData>();
 	ClassDB::register_class<SpinePathConstraintData>();
 	ClassDB::register_class<SpineBone>();
-	ClassDB::register_class<SpineNewBone>();
+	ClassDB::register_class<SpineBone>();
 	ClassDB::register_class<SpineSlot>();
 	ClassDB::register_class<SpineIkConstraint>();
 	ClassDB::register_class<SpinePathConstraint>();
 	ClassDB::register_class<SpineTransformConstraint>();
-	ClassDB::register_class<SpineSpriteMeshInstance2D>();
 	ClassDB::register_class<SpineTimeline>();
 	ClassDB::register_class<SpineConstant>();
 	ClassDB::register_class<SpineCollisionShapeProxy>();