Skip to content

Commit

Permalink
[godot] More GDExtension work. SpineAnimationTrack, animation mixes e…
Browse files Browse the repository at this point in the history
…ditor plugin and SpineMesh2D are non-functional due to missing APIs in godot-cpp
  • Loading branch information
badlogic committed Oct 7, 2024
1 parent f8a0b5b commit e9b43f9
Show file tree
Hide file tree
Showing 101 changed files with 20,602 additions and 39 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,10 @@ spine-sdl/.vs
spine-ts/spine-canvaskit/dist
spine-ts/output.png
spine-godot/godot-cpp
spine-godot/__pycache__
*.os
spine-godot/.sconsign.dblite
spine-godot/example-v4-extension/.godot
spine-godot/src
spine-godot/compile_commands.json
spine-godot/bin
17 changes: 16 additions & 1 deletion spine-godot/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
{
"cmake.configureOnOpen": false,
"C_Cpp.intelliSenseEngine": "default",
"dotnet.defaultSolution": "disable"
"dotnet.defaultSolution": "disable",
"files.associations": {
"__bit_reference": "cpp",
"__hash_table": "cpp",
"__tree": "cpp",
"map": "cpp",
"set": "cpp",
"string": "cpp",
"string_view": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"__split_buffer": "cpp",
"deque": "cpp",
"list": "cpp"
}
}
99 changes: 99 additions & 0 deletions spine-godot/SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/usr/bin/env python
import os
import sys

from methods import print_error


def normalize_path(val, env):
return val if os.path.isabs(val) else os.path.join(env.Dir("#").abspath, val)


def validate_parent_dir(key, val, env):
if not os.path.isdir(normalize_path(os.path.dirname(val), env)):
raise UserError("'%s' is not a directory: %s" % (key, os.path.dirname(val)))


libname = "spine_godot"
projectdir = "example-v4-extension"

localEnv = Environment(tools=["default"], PLATFORM="")

customs = ["custom.py"]
customs = [os.path.abspath(path) for path in customs]

opts = Variables(customs, ARGUMENTS)
opts.Add(
BoolVariable(
key="compiledb",
help="Generate compilation DB (`compile_commands.json`) for external tools",
default=localEnv.get("compiledb", False),
)
)
opts.Add(
PathVariable(
key="compiledb_file",
help="Path to a custom `compile_commands.json` file",
default=localEnv.get("compiledb_file", "compile_commands.json"),
validator=validate_parent_dir,
)
)
opts.Update(localEnv)

Help(opts.GenerateHelpText(localEnv))

env = localEnv.Clone()
env["compiledb"] = False

env.Tool("compilation_db")
compilation_db = env.CompilationDatabase(
normalize_path(localEnv["compiledb_file"], localEnv)
)
env.Alias("compiledb", compilation_db)

submodule_initialized = False
dir_name = 'godot-cpp'
if os.path.isdir(dir_name):
if os.listdir(dir_name):
submodule_initialized = True

if not submodule_initialized:
print_error("""godot-cpp is not available within this folder, as Git submodules haven't been initialized.
Run the following command to download godot-cpp:
git submodule update --init --recursive""")
sys.exit(1)

env = SConscript("godot-cpp/SConstruct", {"env": env, "customs": customs})

env.Append(CPPDEFINES=["SPINE_GODOT_EXTENSION"])
env.Append(CPPPATH=["spine_godot/", "spine_godot/spine-cpp/include"])

sources = Glob("spine_godot/*.cpp") + Glob("spine_godot/spine-cpp/src/spine/*.cpp")

if env["target"] in ["editor", "template_debug"]:
try:
doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("spine_godot/docs/*.xml"))
sources.append(doc_data)
except AttributeError:
print("Not including class reference as we're targeting a pre-4.3 baseline.")

file = "{}{}{}".format(libname, env["suffix"], env["SHLIBSUFFIX"])
filepath = ""

if env["platform"] == "macos" or env["platform"] == "ios":
filepath = "{}.framework/".format(env["platform"])
file = "{}.{}.{}".format(libname, env["platform"], env["target"])

libraryfile = "bin/{}/{}{}".format(env["platform"], filepath, file)
library = env.SharedLibrary(
libraryfile,
source=sources,
)

copy = env.InstallAs("{}/bin/{}/{}lib{}".format(projectdir, env["platform"], filepath, file), library)

default_args = [library, copy]
if localEnv.get("compiledb", False):
default_args += [compilation_db]
Default(*default_args)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[gd_resource type="SpineSkeletonDataResource" load_steps=3 format=3 uid="uid://d1ordmjpe5kt7"]

[ext_resource type="SpineAtlasResource" uid="uid://syvy0bxbnwgi" path="res://assets/celestial-circus/celestial-circus.atlas" id="1_fs1an"]
[ext_resource type="SpineSkeletonFileResource" uid="uid://doan7yl2by7vm" path="res://assets/celestial-circus/celestial-circus.skel" id="2_sbom4"]

[resource]
atlas_res = ExtResource("1_fs1an")
skeleton_file_res = ExtResource("2_sbom4")
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
celestial-circus.png
size: 1024, 1024
filter: Linear, Linear
scale: 0.4
arm-back-down
bounds: 324, 401, 38, 82
rotate: 90
arm-back-up
bounds: 290, 44, 83, 116
rotate: 90
arm-front-down
bounds: 706, 2, 36, 78
rotate: 90
arm-front-up
bounds: 860, 138, 77, 116
bench
bounds: 725, 256, 189, 48
body-bottom
bounds: 879, 868, 154, 124
rotate: 90
body-top
bounds: 725, 128, 126, 133
rotate: 90
chest
bounds: 408, 26, 104, 93
cloud-back
bounds: 752, 378, 202, 165
cloud-front
bounds: 2, 2, 325, 196
rotate: 90
collar
bounds: 786, 13, 47, 26
ear
bounds: 1002, 643, 20, 28
eye-back-shadow
bounds: 428, 395, 14, 10
eye-front-shadow
bounds: 704, 529, 24, 14
eye-reflex-back
bounds: 860, 128, 8, 7
rotate: 90
eye-reflex-front
bounds: 726, 386, 10, 7
eye-white-back
bounds: 835, 23, 13, 16
eye-white-front
bounds: 1005, 1000, 22, 17
rotate: 90
eyelashes-down-back
bounds: 232, 329, 11, 6
rotate: 90
eyelashes-down-front
bounds: 913, 851, 15, 6
rotate: 90
eyelashes-top-back
bounds: 408, 395, 18, 10
eyelashes-top-front
bounds: 702, 179, 30, 16
rotate: 90
face
bounds: 514, 26, 93, 102
rotate: 90
feathers-back
bounds: 954, 625, 46, 46
feathers-front
bounds: 706, 40, 72, 86
fringe-middle-back
bounds: 200, 6, 33, 52
rotate: 90
fringe-middle-front
bounds: 878, 76, 60, 50
rotate: 90
fringe-side-back
bounds: 780, 41, 27, 94
rotate: 90
fringe-side-front
bounds: 939, 161, 26, 93
glove-bottom-back
bounds: 954, 572, 51, 41
rotate: 90
glove-bottom-front
bounds: 916, 256, 47, 48
hair-back-1
bounds: 444, 395, 132, 306
rotate: 90
hair-back-2
bounds: 438, 211, 80, 285
rotate: 90
hair-back-3
bounds: 719, 306, 70, 268
rotate: 90
hair-back-4
bounds: 438, 121, 88, 262
rotate: 90
hair-back-5
bounds: 438, 293, 88, 279
rotate: 90
hair-back-6
bounds: 200, 41, 88, 286
hair-hat-shadow
bounds: 232, 398, 90, 41
hand-back
bounds: 954, 673, 60, 47
rotate: 90
hand-front
bounds: 967, 172, 53, 60
hat-back
bounds: 954, 802, 64, 45
rotate: 90
hat-front
bounds: 780, 70, 96, 56
head-back
bounds: 618, 17, 102, 86
rotate: 90
jabot
bounds: 967, 234, 70, 55
rotate: 90
leg-back
bounds: 232, 441, 210, 333
leg-front
bounds: 444, 529, 258, 320
logo-brooch
bounds: 954, 545, 16, 25
mouth
bounds: 408, 121, 22, 6
neck
bounds: 232, 342, 39, 56
rotate: 90
nose
bounds: 742, 529, 6, 7
rotate: 90
nose-highlight
bounds: 719, 300, 4, 4
nose-shadow
bounds: 869, 128, 7, 8
pupil-back
bounds: 730, 529, 10, 14
pupil-front
bounds: 254, 21, 12, 18
rope-back
bounds: 232, 383, 10, 492
rotate: 90
rope-front
bounds: 232, 383, 10, 492
rotate: 90
rope-front-bottom
bounds: 954, 735, 42, 65
skirt
bounds: 2, 776, 440, 246
sock-bow
bounds: 408, 407, 33, 32
spine-logo-body
bounds: 879, 853, 13, 32
rotate: 90
star-big
bounds: 939, 141, 18, 24
rotate: 90
star-medium
bounds: 742, 537, 6, 8
rotate: 90
star-small
bounds: 719, 378, 3, 4
rotate: 90
underskirt
bounds: 2, 329, 445, 228
rotate: 90
underskirt-back
bounds: 444, 851, 433, 171
wing-back
bounds: 290, 129, 146, 252
wing-front
bounds: 704, 545, 304, 248
rotate: 90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[remap]

importer="spine.atlas"
type="SpineAtlasResource"
uid="uid://syvy0bxbnwgi"
path="res://.godot/imported/celestial-circus.atlas-8277f39286d729eed930dc8584632c9d.spatlas"

[deps]

source_file="res://assets/celestial-circus/celestial-circus.atlas"
dest_files=["res://.godot/imported/celestial-circus.atlas-8277f39286d729eed930dc8584632c9d.spatlas"]

[params]

normal_map_prefix="n"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://d27f2nxof5i18"
path="res://.godot/imported/celestial-circus.png-362082edc9ee92c57423ee448ab8be8a.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/celestial-circus/celestial-circus.png"
dest_files=["res://.godot/imported/celestial-circus.png-362082edc9ee92c57423ee448ab8be8a.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[remap]

importer="spine.skel"
type="SpineSkeletonFileResource"
uid="uid://doan7yl2by7vm"
path="res://.godot/imported/celestial-circus.skel-57e15df02c4ab2ec1bbb6a38273235f3.spskel"

[deps]

source_file="res://assets/celestial-circus/celestial-circus.skel"
dest_files=["res://.godot/imported/celestial-circus.skel-57e15df02c4ab2ec1bbb6a38273235f3.spskel"]

[params]

Loading

0 comments on commit e9b43f9

Please sign in to comment.