mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[godot] Test scene, minor clean-up.
This commit is contained in:
parent
cc57c3dbc9
commit
0b0800143a
2
.gitignore
vendored
2
.gitignore
vendored
@ -155,3 +155,5 @@ spine-ts/spine-threejs/dist
|
|||||||
spine-godot/godot
|
spine-godot/godot
|
||||||
spine-godot/spine_godot/spine-cpp
|
spine-godot/spine_godot/spine-cpp
|
||||||
spine-godot/spine_godot/__pycache__
|
spine-godot/spine_godot/__pycache__
|
||||||
|
spine-godot/example/.import
|
||||||
|
spine-godot/spine_godot/*.o
|
||||||
|
|||||||
@ -11,6 +11,7 @@ config_version=4
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="spine-godot-examples"
|
config/name="spine-godot-examples"
|
||||||
|
run/main_scene="res://test.tscn"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|||||||
8699
spine-godot/example/spineboy-pro.spjson
Normal file
8699
spine-godot/example/spineboy-pro.spjson
Normal file
File diff suppressed because it is too large
Load Diff
101
spine-godot/example/spineboy.atlas
Normal file
101
spine-godot/example/spineboy.atlas
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
spineboy.png
|
||||||
|
size: 1024, 256
|
||||||
|
filter: Linear, Linear
|
||||||
|
scale: 0.5
|
||||||
|
crosshair
|
||||||
|
bounds: 813, 160, 45, 45
|
||||||
|
eye-indifferent
|
||||||
|
bounds: 569, 2, 47, 45
|
||||||
|
eye-surprised
|
||||||
|
bounds: 643, 7, 47, 45
|
||||||
|
rotate: 90
|
||||||
|
front-bracer
|
||||||
|
bounds: 811, 51, 29, 40
|
||||||
|
front-fist-closed
|
||||||
|
bounds: 807, 93, 38, 41
|
||||||
|
front-fist-open
|
||||||
|
bounds: 815, 210, 43, 44
|
||||||
|
front-foot
|
||||||
|
bounds: 706, 64, 63, 35
|
||||||
|
rotate: 90
|
||||||
|
front-shin
|
||||||
|
bounds: 80, 11, 41, 92
|
||||||
|
front-thigh
|
||||||
|
bounds: 754, 12, 23, 56
|
||||||
|
front-upper-arm
|
||||||
|
bounds: 618, 5, 23, 49
|
||||||
|
goggles
|
||||||
|
bounds: 214, 20, 131, 83
|
||||||
|
gun
|
||||||
|
bounds: 347, 14, 105, 102
|
||||||
|
rotate: 90
|
||||||
|
head
|
||||||
|
bounds: 80, 105, 136, 149
|
||||||
|
hoverboard-board
|
||||||
|
bounds: 2, 8, 246, 76
|
||||||
|
rotate: 90
|
||||||
|
hoverboard-thruster
|
||||||
|
bounds: 478, 2, 30, 32
|
||||||
|
hoverglow-small
|
||||||
|
bounds: 218, 117, 137, 38
|
||||||
|
rotate: 90
|
||||||
|
mouth-grind
|
||||||
|
bounds: 775, 80, 47, 30
|
||||||
|
rotate: 90
|
||||||
|
mouth-oooo
|
||||||
|
bounds: 779, 31, 47, 30
|
||||||
|
rotate: 90
|
||||||
|
mouth-smile
|
||||||
|
bounds: 783, 207, 47, 30
|
||||||
|
rotate: 90
|
||||||
|
muzzle-glow
|
||||||
|
bounds: 779, 4, 25, 25
|
||||||
|
muzzle-ring
|
||||||
|
bounds: 451, 14, 25, 105
|
||||||
|
muzzle01
|
||||||
|
bounds: 664, 60, 67, 40
|
||||||
|
rotate: 90
|
||||||
|
muzzle02
|
||||||
|
bounds: 580, 56, 68, 42
|
||||||
|
rotate: 90
|
||||||
|
muzzle03
|
||||||
|
bounds: 478, 36, 83, 53
|
||||||
|
rotate: 90
|
||||||
|
muzzle04
|
||||||
|
bounds: 533, 49, 75, 45
|
||||||
|
rotate: 90
|
||||||
|
muzzle05
|
||||||
|
bounds: 624, 56, 68, 38
|
||||||
|
rotate: 90
|
||||||
|
neck
|
||||||
|
bounds: 806, 8, 18, 21
|
||||||
|
portal-bg
|
||||||
|
bounds: 258, 121, 133, 133
|
||||||
|
portal-flare1
|
||||||
|
bounds: 690, 2, 56, 30
|
||||||
|
rotate: 90
|
||||||
|
portal-flare2
|
||||||
|
bounds: 510, 3, 57, 31
|
||||||
|
portal-flare3
|
||||||
|
bounds: 722, 4, 58, 30
|
||||||
|
rotate: 90
|
||||||
|
portal-shade
|
||||||
|
bounds: 393, 121, 133, 133
|
||||||
|
portal-streaks1
|
||||||
|
bounds: 528, 126, 126, 128
|
||||||
|
portal-streaks2
|
||||||
|
bounds: 656, 129, 125, 125
|
||||||
|
rear-bracer
|
||||||
|
bounds: 826, 13, 28, 36
|
||||||
|
rear-foot
|
||||||
|
bounds: 743, 70, 57, 30
|
||||||
|
rotate: 90
|
||||||
|
rear-shin
|
||||||
|
bounds: 174, 14, 38, 89
|
||||||
|
rear-thigh
|
||||||
|
bounds: 783, 158, 28, 47
|
||||||
|
rear-upper-arm
|
||||||
|
bounds: 783, 136, 20, 44
|
||||||
|
rotate: 90
|
||||||
|
torso
|
||||||
|
bounds: 123, 13, 49, 90
|
||||||
14
spine-godot/example/spineboy.atlas.import
Normal file
14
spine-godot/example/spineboy.atlas.import
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="spine.atlas"
|
||||||
|
type="SpineAtlasResource"
|
||||||
|
path="res://.import/spineboy.atlas-ce2b95e2abaaca5faa7726fe317501ea.spatlas"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://spineboy.atlas"
|
||||||
|
dest_files=[ "res://.import/spineboy.atlas-ce2b95e2abaaca5faa7726fe317501ea.spatlas" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
normal_texture_prefix=""
|
||||||
17
spine-godot/example/spineboy.gd
Normal file
17
spine-godot/example/spineboy.gd
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
extends SpineSprite
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
self.get_animation_state().set_animation("walk", true, 0)
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
||||||
BIN
spine-godot/example/spineboy.png
Normal file
BIN
spine-godot/example/spineboy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 243 KiB |
34
spine-godot/example/spineboy.png.import
Normal file
34
spine-godot/example/spineboy.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/spineboy.png-846f399ad53ae6f7ed8bbfe03f0b1f88.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://spineboy.png"
|
||||||
|
dest_files=[ "res://.import/spineboy.png-846f399ad53ae6f7ed8bbfe03f0b1f88.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
||||||
10
spine-godot/example/spineboy.tres
Normal file
10
spine-godot/example/spineboy.tres
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[gd_resource type="SpineSkeletonDataResource" load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://spineboy.atlas" type="SpineAtlasResource" id=1]
|
||||||
|
[ext_resource path="res://spineboy-pro.spjson" type="SpineSkeletonJsonDataResource" id=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas_res = ExtResource( 1 )
|
||||||
|
skeleton_json_res = ExtResource( 2 )
|
||||||
|
animations = null
|
||||||
|
skins = null
|
||||||
7
spine-godot/example/spineboyanimdata.tres
Normal file
7
spine-godot/example/spineboyanimdata.tres
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[gd_resource type="SpineAnimationStateDataResource" load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://spineboy.tres" type="SpineSkeletonDataResource" id=1]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
skeleton = ExtResource( 1 )
|
||||||
|
default_mix = 1.0
|
||||||
13
spine-godot/example/test.tscn
Normal file
13
spine-godot/example/test.tscn
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://spineboy.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://spineboyanimdata.tres" type="SpineAnimationStateDataResource" id=2]
|
||||||
|
|
||||||
|
[node name="Node2D" type="Node2D"]
|
||||||
|
position = Vector2( 2.12469, 1.06235 )
|
||||||
|
|
||||||
|
[node name="SpineSprite" type="SpineSprite" parent="."]
|
||||||
|
position = Vector2( 503.556, 465.311 )
|
||||||
|
scale = Vector2( 0.5, 0.5 )
|
||||||
|
animation_state_data_res = ExtResource( 2 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
@ -1,80 +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 "GodotSpineExtension.h"
|
|
||||||
|
|
||||||
#include "core/variant_parser.h"
|
|
||||||
#include <spine/SpineString.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
spine::SpineExtension *spine::getDefaultExtension() {
|
|
||||||
return new GodotSpineExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
GodotSpineExtension::GodotSpineExtension(){}
|
|
||||||
GodotSpineExtension::~GodotSpineExtension(){}
|
|
||||||
|
|
||||||
void *GodotSpineExtension::_alloc(size_t size, const char *file, int line){
|
|
||||||
// std::cout<<"_alloc "<<file<<" "<<line<<std::endl;
|
|
||||||
return memalloc(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *GodotSpineExtension::_calloc(size_t size, const char *file, int line){
|
|
||||||
// std::cout<<"_calloc "<<file<<" "<<line<<std::endl;
|
|
||||||
auto p = memalloc(size);
|
|
||||||
memset(p, 0, size);
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *GodotSpineExtension::_realloc(void *ptr, size_t size, const char *file, int line){
|
|
||||||
// std::cout<<"_realloc "<<file<<" "<<line<<std::endl;
|
|
||||||
return memrealloc(ptr, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GodotSpineExtension::_free(void *mem, const char *file, int line){
|
|
||||||
// std::cout<<"_free "<<file<<" "<<line<<std::endl;
|
|
||||||
memfree(mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *GodotSpineExtension::_readFile(const spine::String &path, int *length){
|
|
||||||
Error error;
|
|
||||||
auto res = FileAccess::get_file_as_array(String(path.buffer()), &error);
|
|
||||||
// std::cout<<"Spine is loading something: "<<path.buffer()<<std::endl;
|
|
||||||
if (error != OK){
|
|
||||||
if(length) *length = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(length) *length = res.size();
|
|
||||||
auto r = alloc<char>(res.size(), __FILE__, __LINE__);
|
|
||||||
for(size_t i=0;i<res.size();++i)
|
|
||||||
r[i] = res[i];
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include "core/class_db.h"
|
#include "core/class_db.h"
|
||||||
|
|
||||||
#include "spine_runtime.h"
|
|
||||||
#include "SpineAtlasResource.h"
|
#include "SpineAtlasResource.h"
|
||||||
#include "ResourceFormatLoaderSpineAtlas.h"
|
#include "ResourceFormatLoaderSpineAtlas.h"
|
||||||
#include "ResourceFormatSaverSpineAtlas.h"
|
#include "ResourceFormatSaverSpineAtlas.h"
|
||||||
@ -88,8 +87,7 @@ void register_spine_godot_types(){
|
|||||||
EditorNode::add_init_callback(editor_init_callback);
|
EditorNode::add_init_callback(editor_init_callback);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ClassDB::register_class<SpineRuntime>();
|
|
||||||
ClassDB::register_class<SpineAtlasResource>();
|
ClassDB::register_class<SpineAtlasResource>();
|
||||||
ClassDB::register_class<SpineSprite>();
|
ClassDB::register_class<SpineSprite>();
|
||||||
ClassDB::register_class<SpineSkeletonDataResource>();
|
ClassDB::register_class<SpineSkeletonDataResource>();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user