Spine module for godot game engine

This module adds Spine animation support for godot game engine 3.0. It has been tested with Godot 3.0.2, but may contain bugs. The 2.1 module is also avaiable in the 2.1 branch

Current Spine runtime version for master branch 3.6.52.1 (Github link). Current Spine runtime version for 2.1 branch 3.5.51.

About the license

This module is forked from sanikoyes's godot branch and some of the code is forked from godot-spine-module. Both of the code are declared as MIT license.

The license of this module is under the Spine Runtimes Software License.

Usage

Add this code under modules/spine in your Godot source tree. You may either copy it or use git submodule add.

Build Godot using scons platform=x11 tools=yes target=release_debug or whatever build options you prefer.

Use the Spine type in your scene tree and load your animation into it as a resource.

Further reference

The Spine API Reference is useful to learning more about how the code works.

Comments
  • How do you load Spine files?

    How do you load Spine files?

    Sorry if this isn't the right place to ask...

    I select load from the menu on the "Resource" key under Spine in the properties inspector and the file browser states that it recognises .json and .skel files, amongst others, but when I try to load one of the sample exports from Spine (I've tried alien and spineboy, both json and skel files) that I've copied into my Godot project directory, I get an error Error loading file: Not a resource.

    The same same steps worked in this video https://www.youtube.com/watch?v=m0liBPf1NW8

    What am I missing? Thanks!

  • Build error with Godot 3.1

    Build error with Godot 3.1

    When compiling from master branch with Godot 3.1 beta 11 I'm getting the error:

    modules/spine/spine.cpp:1072:78: error: passing 'const Vector2' as 'this' argument discards qualifiers [-fpermissive]
    points[idx] = Vector2(info->vertices[idx * 2], -info->vertices[idx * 2 + 1]);
    

    If I delete all #if (VERSION_MAJOR == 3 && VERSION_MINOR >= 1) conditions and corresponding else branches (leaving only 3.1 lines) the compilations succeeds.
    However, in this case I'm getting the following when I try to add resource to Spine node:

    [1] /usr/lib/libc.so.6(+0x37e00) [0x7f419a5f5e00] (??:0)
    [2] /usr/lib/libc.so.6(+0x15f715) [0x7f419a71d715] (??:0)
    [3] /home/bemyak/Downloads/godot-3.1-beta11/bin/godot.x11.tools.64(spSkeletonJson_readSkeletonData+0x19f) [0x161a702] (/home/bemyak/Downloads/godot-3.1-beta11/modules/spine/src/spine/SkeletonJson.c:600)
    [4] /home/bemyak/Downloads/godot-3.1-beta11/bin/godot.x11.tools.64(spSkeletonJson_readSkeletonDataFile+0x7d) [0x161a539] (/home/bemyak/Downloads/godot-3.1-beta11/modules/spine/src/spine/SkeletonJson.c:573)
    [5] ResourceFormatLoaderSpine::load(String const&, String const&, Error*) (/home/bemyak/Downloads/godot-3.1-beta11/modules/spine/register_types.cpp:190 (discriminator 3))
    [6] ResourceLoader::_load(String const&, String const&, String const&, bool, Error*) (/home/bemyak/Downloads/godot-3.1-beta11/core/io/resource_loader.cpp:272 (discriminator 6))
    [7] ResourceLoader::load(String const&, String const&, bool, Error*) (/home/bemyak/Downloads/godot-3.1-beta11/core/io/resource_loader.cpp:408)
    [8] EditorPropertyResource::_file_selected(String const&) (/home/bemyak/Downloads/godot-3.1-beta11/editor/editor_properties.cpp:1983)
    [9] MethodBind1<String const&>::call(Object*, Variant const**, int, Variant::CallError&) (/home/bemyak/Downloads/godot-3.1-beta11/./core/method_bind.gen.inc:729 (discriminator 12))
    [10] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/bemyak/Downloads/godot-3.1-beta11/core/object.cpp:943 (discriminator 1))
    [11] Object::emit_signal(StringName const&, Variant const**, int) (/home/bemyak/Downloads/godot-3.1-beta11/core/object.cpp:1229 (discriminator 1))
    [12] Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/bemyak/Downloads/godot-3.1-beta11/core/object.cpp:1285)
    [13] EditorFileDialog::_action_pressed() (/home/bemyak/Downloads/godot-3.1-beta11/editor/editor_file_dialog.cpp:357 (discriminator 4))
    [14] EditorFileDialog::_item_dc_selected(int) (/home/bemyak/Downloads/godot-3.1-beta11/editor/editor_file_dialog.cpp:535)
    [15] MethodBind1<int>::call(Object*, Variant const**, int, Variant::CallError&) (/home/bemyak/Downloads/godot-3.1-beta11/./core/method_bind.gen.inc:729 (discriminator 12))
    [16] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/bemyak/Downloads/godot-3.1-beta11/core/object.cpp:943 (discriminator 1))
    [17] Object::emit_signal(StringName const&, Variant const**, int) (/home/bemyak/Downloads/godot-3.1-beta11/core/object.cpp:1229 (discriminator 1))
    [18] Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/bemyak/Downloads/godot-3.1-beta11/core/object.cpp:1285)
    [19] ItemList::_gui_input(Ref<InputEvent> const&) (/home/bemyak/Downloads/godot-3.1-beta11/scene/gui/item_list.cpp:566 (discriminator 4))
    [20] MethodBind1<Ref<InputEvent> const&>::call(Object*, Variant const**, int, Variant::CallError&) (/home/bemyak/Downloads/godot-3.1-beta11/./core/method_bind.gen.inc:729 (discriminator 12))
    [21] Object::call_multilevel(StringName const&, Variant const**, int) (/home/bemyak/Downloads/godot-3.1-beta11/core/object.cpp:777 (discriminator 1))
    [22] Object::call_multilevel(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/bemyak/Downloads/godot-3.1-beta11/core/object.cpp:884)
    [23] Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) (/home/bemyak/Downloads/godot-3.1-beta11/scene/main/viewport.cpp:1542 (discriminator 2))
    [24] Viewport::_gui_input_event(Ref<InputEvent>) (/home/bemyak/Downloads/godot-3.1-beta11/scene/main/viewport.cpp:1844 (discriminator 3))
    [25] Viewport::input(Ref<InputEvent> const&) (/home/bemyak/Downloads/godot-3.1-beta11/scene/main/viewport.cpp:2668 (discriminator 2))
    [26] Viewport::_vp_input(Ref<InputEvent> const&) (/home/bemyak/Downloads/godot-3.1-beta11/scene/main/viewport.cpp:1319)
    [27] MethodBind1<Ref<InputEvent> const&>::call(Object*, Variant const**, int, Variant::CallError&) (/home/bemyak/Downloads/godot-3.1-beta11/./core/method_bind.gen.inc:729 (discriminator 12))
    [28] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/bemyak/Downloads/godot-3.1-beta11/core/object.cpp:943 (discriminator 1))
    [29] Object::call(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/bemyak/Downloads/godot-3.1-beta11/core/object.cpp:868)
    [30] SceneTree::call_group_flags(unsigned int, StringName const&, StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/bemyak/Downloads/godot-3.1-beta11/scene/main/scene_tree.cpp:262)
    [31] SceneTree::input_event(Ref<InputEvent> const&) (/home/bemyak/Downloads/godot-3.1-beta11/scene/main/scene_tree.cpp:418 (discriminator 6))
    [32] InputDefault::_parse_input_event_impl(Ref<InputEvent> const&, bool) (/home/bemyak/Downloads/godot-3.1-beta11/main/input_default.cpp:414)
    [33] InputDefault::parse_input_event(Ref<InputEvent> const&) (/home/bemyak/Downloads/godot-3.1-beta11/main/input_default.cpp:260)
    [34] InputDefault::flush_accumulated_events() (/home/bemyak/Downloads/godot-3.1-beta11/main/input_default.cpp:677)
    [35] OS_X11::process_xevents() (/home/bemyak/Downloads/godot-3.1-beta11/platform/x11/os_x11.cpp:2462)
    [36] OS_X11::run() (/home/bemyak/Downloads/godot-3.1-beta11/platform/x11/os_x11.cpp:3004)
    [37] /home/bemyak/Downloads/godot-3.1-beta11/bin/godot.x11.tools.64(main+0xdc) [0x1179232] (/home/bemyak/Downloads/godot-3.1-beta11/platform/x11/godot_x11.cpp:56)
    [38] /usr/lib/libc.so.6(__libc_start_main+0xf3) [0x7f419a5e2223] (??:0)
    [39] /home/bemyak/Downloads/godot-3.1-beta11/bin/godot.x11.tools.64(_start+0x2e) [0x117909e] (??:?)
    -- END OF BACKTRACE --
    
  • New changes in Godot breaks Spine module

    New changes in Godot breaks Spine module

    Hi, I got the lastest version of branch master of Godot and it can´t compile the spine module. Probably because of the lastest changes in Godot: https://godotengine.org/article/why-we-broke-your-pr

    any one found a way to compile the spine module without errors?

  • Add animation duration to properties

    Add animation duration to properties

    This is useful when an AnimationPlayer controls the Spine node and you need to tell your animation how long it's going to be. With the wrong duration, the animation will be broken and there's no better way to check this than having it visible.

    It would be nicer if it was truly read-only. Now it looks like it can be edited, though it can't and obviously shouldn't.

  • Add some feature that can read flip attribute

    Add some feature that can read flip attribute

    Added feature that can read "flip" from json which from spine runtime 2.1.15. There is a flip bug when change motion in console. See spFlipTimeline_apply.

  • Fix error reporting

    Fix error reporting

    It appears that ERR_EXPLAIN must always be the preceding line before actually reacting on an error. Like a return value in shell.

    This simple change makes errors visible!

    This commit also removes the redundant ternary check.

  • Make Spine nodes active by default

    Make Spine nodes active by default

    I noticed that from a usability point of view, it makes sense that the active boolean is set.

    If it's not, loading a resource and playing an animation will not actually play it, and there's an extra click involved in making it work.

    Unless there's a reason I'm missing here, it would be nice to have this merged in :)

    Thanks!

  • Recent change in Godot codebase breaks compilation

    Recent change in Godot codebase breaks compilation

    Basically same problem with dragon bones module but in spine_batcher.cpp(89):

    https://github.com/sanja-sa/gddragonbones/issues/18

    Commit that break compilation: https://github.com/godotengine/godot/commit/b3e4bc562c07142d48907278f9cc496791ff7b33

  • Upgrade runtime dependency to latest 3.6

    Upgrade runtime dependency to latest 3.6

    This PR gets rid of current Spine runtime dependency and replaces it with Spine runtime version 3.6.

    Also, of course, necessary alterations for proper compilation and run.

  • Eventual 3.0 compatibility

    Eventual 3.0 compatibility

    Hello,

    Godot 3.0 is a reality now and some modest efforts would be enough to bring this module up to speed with the stable branch. Newer Godot features, however, open up a lot of possibilities for module developers.

    Do you, as project maintainer, have something specific in mind as to what this module should look like alongside Godot 3.0 stable? Keep on with compatibility updates, GDNative, world domination...

    Thanks in advance and congrats for the nice work so far.

  • Spine module would not compile for builds without the editor (tools=no)

    Spine module would not compile for builds without the editor (tools=no)

    Two methods in spine.cpp can only be compiled if the target build includes the Godot editor. So, a conditional compilation directive allows Spine module to be compiled for builds without the editor.

  • Error while build in register_types.cpp + 212

    Error while build in register_types.cpp + 212

    https://github.com/GodotExplorer/spine/blob/3abeaaff6cc7dcf77f0f0a3c3fd2e737169d20a5/register_types.cpp#L212

    Yes. There is some bug:

    #if defined(ERR_FAIL_COND_V_MSG)
                ERR_FAIL_COND_V_MSG(res->data == NULL, RES(), bin->error);
    #else
                ERR_EXPLAIN(bin->error);
                ERR_FAIL_COND_V(res->data == NULL, RES());
                ERR_FAIL_COND_V_MSG(res->data == NULL, RES(), bin->error); // AAAA WATAFK
    #endif
    

    In code, we check the ERR_FAIL_COND_V_MSG is defined, but if it isn't, we whatever use it

  • Compile error with Godot 3.2 stable Mono

    Compile error with Godot 3.2 stable Mono

    On the final build stage throws this:

    "C:\Users\Teashrock\Documents\Development\Not-Mine\godot-3.2-stable\modules\mono\glue\GodotSharp\GodotSharp.sln" (целев
    ой объект по умолчанию) (1) ->
    "C:\Users\Teashrock\Documents\Development\Not-Mine\godot-3.2-stable\modules\mono\glue\GodotSharp\GodotSharp\GodotSharp.
    csproj" (целевой объект по умолчанию) (2) ->
    (Целевой объект CoreCompile) ->
      Generated\GodotObjects\Spine.cs(319,33): error CS1750: Использование значения типа "float" в качестве параметра по ум
    олчанию недопустимо, так как отсутствуют стандартные методы преобразования в тип "string". [C:\Users\Teashrock\Document
    s\Development\Not-Mine\godot-3.2-stable\modules\mono\glue\GodotSharp\GodotSharp\GodotSharp.csproj]
      Generated\GodotObjects\Spine.cs(328,32): error CS1750: Использование значения типа "float" в качестве параметра по ум
    олчанию недопустимо, так как отсутствуют стандартные методы преобразования в тип "string". [C:\Users\Teashrock\Document
    s\Development\Not-Mine\godot-3.2-stable\modules\mono\glue\GodotSharp\GodotSharp\GodotSharp.csproj]
    
        Предупреждений: 7
        Ошибок: 2
    

    In case if You don't know Russian: it complains about impossibility of using "float" typed value as default parameter, because of lack of a standard methods of conversion "float" type to "string" type.

  • Build for mono

    Build for mono

    Hello I new to Godot. Is it any way to build this module for mono? I try to generate mono-glue, and have errors ERROR: _get_type_by_name_or_placeholder: Type not found. Creating placeholder: Spine.AnimationProcessMode. What I need to edit for register methods?

FlappyCalf - a game powered by Go+ spx game engine
FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this

Nov 6, 2022
FlappyCalf - a game powered by Go+ spx game engine
FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this

Nov 6, 2022
MazePlay - a game powered by Go+ spx game engine
MazePlay - a game powered by Go+ spx game engine

MazePlay - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this g

Dec 16, 2021
A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy!
A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy!

galactic-asteroid-belt Overview A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy! Run To run, you will need Go

Dec 2, 2021
RundQuiz-Game - This is a Go exercise that implements and builds a quiz game from a list of math questions in a CSV file.

Go RundQuiz Game Exercise details This exercise is broken into two parts to help simplify the process of explaining it as well as to make it easier to

Jan 5, 2022
Simple 2D game to teach myself various things about game development and ECS, etc

2d-grass-game I really don't know what to name this game. Its a big grass field, and its in 2d so....2D Grass game This is a simple 2D game to teach m

Jan 17, 2022
Engo is an open-source 2D game engine written in Go.

Engo A cross-platform game engine written in Go following an interpretation of the Entity Component System paradigm. Engo is currently compilable for

Dec 26, 2022
Go 3D Game Engine
Go 3D Game Engine

G3N - Go 3D Game Engine G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that

Jan 9, 2023
Scalable Distributed Game Server Engine with Hot Swapping in Golang
Scalable Distributed Game Server Engine with Hot Swapping in Golang

GoWorld Scalable Distributed Game Server Engine with Hot Reload in Golang Features Architecture Introduction Get GoWorld Manage GoWorld Servers Demos

Dec 25, 2022
A pure Go game engine
A pure Go game engine

Oak A pure Go game engine Table of Contents Installation Motivation Features Support Quick Start Implementation and Examples Finished Games Installati

Jan 8, 2023
Terminal-based game engine for Go, built on top of Termbox
Terminal-based game engine for Go, built on top of Termbox

Termloop Termloop is a pure Go game engine for the terminal, built on top of the excellent Termbox. It provides a simple render loop for building game

Dec 29, 2022
A 2D ARPG game engine.
A 2D ARPG game engine.

Abyss Engine is an ARPG game engine in the same vein of the 2000's games, and supports playing games similar to Diablo 2. The engine is written in golang and is cross platform. This engine does not ship with game specific files, and will require a game's assets in order to run.

Dec 24, 2022
A small fantasy game engine in WASM using GoLang
A small fantasy game engine in WASM using GoLang

The GoLang Fantasy Engine (GoLF Engine) is a retro game engine. It draws inspiration from fantasy console projects like pico-8, tic-80, and pyxle. Like those projects it is designed to be a retro-feeling game creation/playing tool. Unlike those projects GoLF is more minimal in scope and only provides an API and a small set of tools to help you create your games. Tools like an image editor and code editor are not built in. Despite this minimalism creating games in GoLF is still easy and should still maintain the retro game feel.

Jul 16, 2022
golang powered game engine
golang powered game engine

Gobatch Go powered engine that offers features from low level opengl abstraction to UI framework. I created this to separate lot of logic from game am

Nov 13, 2022
spx - A 2D Game Engine for learning Go+
spx - A 2D Game Engine for learning Go+

spx - A 2D Game Engine for learning Go+ Tutorials How to run spx tutorials? Download Go+ and build it. See https://github.com/goplus/gop#how-to-build.

Dec 1, 2022
Go Game Engine using SDL for fun

nMage nMage is a (hopefully!) high performance 3D Game Engine written in Go being developed live, with recordings posted on YouTube. This project is b

Nov 30, 2022
HelloSpx - Hello world of Go+ spx game engine
HelloSpx - Hello world of Go+ spx game engine

HelloSpx - Hello world of Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this game

Nov 27, 2021
HelloWorldForSpx - Hello world of Go+ spx game engine
 HelloWorldForSpx - Hello world of Go+ spx game engine

HelloWorldForSpx - Hello world of Go+ spx game engineHelloWorldForSpx - Hello world of Go+ spx game engine

Nov 22, 2021
A dead simple 2D game library for Go
A dead simple 2D game library for Go

Ebiten (v2) A dead simple 2D game library for Go Ebiten is an open source game library for the Go programming language. Ebiten's simple API allows you

Dec 28, 2022