mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
Merge branch '4.1' into 4.2-beta
This commit is contained in:
commit
6705ad675f
@ -1870,7 +1870,7 @@ void _spDeformTimeline_apply(
|
|||||||
/* Vertex positions or deform offsets, with alpha. */
|
/* Vertex positions or deform offsets, with alpha. */
|
||||||
for (i = 0; i < vertexCount; i++)
|
for (i = 0; i < vertexCount; i++)
|
||||||
deformArray[i] += (lastVertices[i] - deformArray[i]) * alpha;
|
deformArray[i] += (lastVertices[i] - deformArray[i]) * alpha;
|
||||||
break;
|
break;
|
||||||
case SP_MIX_BLEND_ADD:
|
case SP_MIX_BLEND_ADD:
|
||||||
vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment);
|
vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment);
|
||||||
if (!vertexAttachment->bones) {
|
if (!vertexAttachment->bones) {
|
||||||
|
|||||||
81
spine-godot/convert.py
Executable file
81
spine-godot/convert.py
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
#
|
||||||
|
# Python script to convert a Godot project using Spine .json skeleton files to use the new
|
||||||
|
# extension .spine-json instead.
|
||||||
|
#
|
||||||
|
# Usage: python convert.py path/to/godot/project
|
||||||
|
#
|
||||||
|
# Note: ensure you have created a backup of your Godot project before running this script.
|
||||||
|
#
|
||||||
|
# The script will traverse all .json, .tscn, and .tres files in the directory recursively.
|
||||||
|
#
|
||||||
|
# For each .json file, it will rename the file to .spine-json and remove the .json.import file.
|
||||||
|
# Upon reloading the the project in Godot, the file will be re-imported and the a .spine-json.import
|
||||||
|
# file will be created in place of the .json.import file.
|
||||||
|
#
|
||||||
|
# For each .tscn or .tres file, it will replace the .json suffix in external resources of type
|
||||||
|
# SpineSkeletonFileResource with the new suffix .spine-json.
|
||||||
|
#
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import pathlib
|
||||||
|
import codecs
|
||||||
|
|
||||||
|
def convert_json(filename):
|
||||||
|
with open(filename) as file:
|
||||||
|
content = file.read()
|
||||||
|
if "skeleton" in content and "hash" in content and "spine" in content:
|
||||||
|
path = pathlib.Path(filename)
|
||||||
|
new_path = path.with_suffix('.spine-json')
|
||||||
|
print("Renaming " + str(path) + " to " + str(new_path))
|
||||||
|
path.rename(new_path)
|
||||||
|
if os.path.exists(filename + ".import"):
|
||||||
|
print("Removing " + str(filename) + ".import")
|
||||||
|
os.remove(filename + ".import")
|
||||||
|
|
||||||
|
def convert_tscn_or_tres(filename):
|
||||||
|
file = codecs.open(filename, "r", "utf-8")
|
||||||
|
content = file.read()
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
new_content = ""
|
||||||
|
is_converted = False
|
||||||
|
for line in content.splitlines(True):
|
||||||
|
if line.startswith("[ext_resource") and 'type="SpineSkeletonFileResource"' in line and '.json"' in line:
|
||||||
|
if not is_converted:
|
||||||
|
print("Converting TSCN file " + str(filename))
|
||||||
|
is_converted = True
|
||||||
|
print("Replacing .json with .spine-json in \n" + line)
|
||||||
|
line = line.replace('.json"', '.spine-json"')
|
||||||
|
new_content += line
|
||||||
|
|
||||||
|
file = codecs.open(filename, "w", "utf-8")
|
||||||
|
file.write(new_content)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
def convert_tres(filename):
|
||||||
|
print("Converting TRES file " + str(filename))
|
||||||
|
with open(filename) as file:
|
||||||
|
content = file.read()
|
||||||
|
|
||||||
|
def convert(path):
|
||||||
|
for dirpath, dirs, files in os.walk(path):
|
||||||
|
for filename in files:
|
||||||
|
file = os.path.join(dirpath,filename)
|
||||||
|
if file.endswith(".json"):
|
||||||
|
convert_json(file)
|
||||||
|
elif file.endswith(".tscn") or file.endswith(".tres"):
|
||||||
|
convert_tscn_or_tres(file)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) == 1:
|
||||||
|
print("Please provide the path to your Godot project, e.g. python convert.py path/to/my/project.")
|
||||||
|
sys.exit(-1)
|
||||||
|
path = os.path.abspath(sys.argv[1])
|
||||||
|
if not os.path.exists(path):
|
||||||
|
print("Directory " + str(path) + " does not exist.")
|
||||||
|
sys.exit(-1)
|
||||||
|
if not os.path.isdir(path):
|
||||||
|
print(str(path) + " is not a directory.")
|
||||||
|
sys.exit(-1)
|
||||||
|
print("Converting " + str(path))
|
||||||
|
convert(path)
|
||||||
@ -1,7 +1,7 @@
|
|||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="oggvorbisstr"
|
importer="oggvorbisstr"
|
||||||
type="AudioStreamOGGVorbis"
|
type="AudioStreamOggVorbis"
|
||||||
uid="uid://can7k84o8svum"
|
uid="uid://can7k84o8svum"
|
||||||
path="res://.godot/imported/footstep.ogg-789c3f1e3c4e0ca3bebcb13f1160f623.oggvorbisstr"
|
path="res://.godot/imported/footstep.ogg-789c3f1e3c4e0ca3bebcb13f1160f623.oggvorbisstr"
|
||||||
|
|
||||||
@ -14,3 +14,6 @@ dest_files=["res://.godot/imported/footstep.ogg-789c3f1e3c4e0ca3bebcb13f1160f623
|
|||||||
|
|
||||||
loop=false
|
loop=false
|
||||||
loop_offset=0
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="spine.json"
|
|
||||||
type="SpineSkeletonFileResource"
|
|
||||||
uid="uid://bijrb2mt3vodc"
|
|
||||||
path="res://.godot/imported/mix-and-match-pro.json-57325a5014e6fd56fc4a86824bc458ea.spjson"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://assets/mix-and-match/mix-and-match-pro.json"
|
|
||||||
dest_files=["res://.godot/imported/mix-and-match-pro.json-57325a5014e6fd56fc4a86824bc458ea.spjson"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="spine.json"
|
||||||
|
type="SpineSkeletonFileResource"
|
||||||
|
uid="uid://ckitsrtfxmo2w"
|
||||||
|
path="res://.godot/imported/mix-and-match-pro.spine-json-3655503b0d08b0b0590c6310da1ac47b.spjson"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/mix-and-match/mix-and-match-pro.spine-json"
|
||||||
|
dest_files=["res://.godot/imported/mix-and-match-pro.spine-json-3655503b0d08b0b0590c6310da1ac47b.spjson"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
[gd_resource type="SpineSkeletonDataResource" load_steps=3 format=2]
|
[gd_resource type="SpineSkeletonDataResource" load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/raggedyspineboy/Raggedy Spineboy.atlas" type="SpineAtlasResource" id=1]
|
[ext_resource path="res://assets/raggedyspineboy/Raggedy Spineboy.atlas" type="SpineAtlasResource" id=1]
|
||||||
[ext_resource path="res://assets/raggedyspineboy/raggedy spineboy.json" type="SpineSkeletonFileResource" id=2]
|
[ext_resource path="res://assets/raggedyspineboy/raggedy spineboy.spine-json" type="SpineSkeletonFileResource" id=2]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
atlas_res = ExtResource( 1 )
|
atlas_res = ExtResource( 1 )
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="spine.json"
|
|
||||||
type="SpineSkeletonFileResource"
|
|
||||||
uid="uid://bulrbalpjr863"
|
|
||||||
path="res://.godot/imported/raggedy spineboy.json-a7000cc987b23355ac0b09613918efcc.spjson"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://assets/raggedyspineboy/raggedy spineboy.json"
|
|
||||||
dest_files=["res://.godot/imported/raggedy spineboy.json-a7000cc987b23355ac0b09613918efcc.spjson"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="spine.json"
|
||||||
|
type="SpineSkeletonFileResource"
|
||||||
|
uid="uid://2iqykoiop2tc"
|
||||||
|
path="res://.godot/imported/raggedy spineboy.spine-json-d90ee4b829503274afa3dbf64c369460.spjson"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/raggedyspineboy/raggedy spineboy.spine-json"
|
||||||
|
dest_files=["res://.godot/imported/raggedy spineboy.spine-json-d90ee4b829503274afa3dbf64c369460.spjson"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="spine.json"
|
|
||||||
type="SpineSkeletonFileResource"
|
|
||||||
uid="uid://drl0og0imdkla"
|
|
||||||
path="res://.godot/imported/spineboy-pro.json-60444223fe3960c6d4c33b92d7495419.spjson"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://assets/spineboy/spineboy-pro.json"
|
|
||||||
dest_files=["res://.godot/imported/spineboy-pro.json-60444223fe3960c6d4c33b92d7495419.spjson"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="spine.json"
|
||||||
|
type="SpineSkeletonFileResource"
|
||||||
|
uid="uid://bngulrxfavqyn"
|
||||||
|
path="res://.godot/imported/spineboy-pro.spine-json-f9f3900b0187b1b6e5b1abca50f5f02a.spjson"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/spineboy/spineboy-pro.spine-json"
|
||||||
|
dest_files=["res://.godot/imported/spineboy-pro.spine-json-f9f3900b0187b1b6e5b1abca50f5f02a.spjson"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user