Skip to content

Commit

Permalink
[godot] Closes #2447, expose bone and sprite in SpineBoneNode
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Jan 12, 2024
1 parent b3aa3e0 commit 068a2bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions spine-godot/spine_godot/SpineBoneNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ void SpineBoneNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_debug_color"), &SpineBoneNode::set_debug_color);
ClassDB::bind_method(D_METHOD("get_debug_color"), &SpineBoneNode::get_debug_color);
ClassDB::bind_method(D_METHOD("_on_world_transforms_changed", "spine_sprite"), &SpineBoneNode::on_world_transforms_changed);
ClassDB::bind_method(D_METHOD("find_bone"), &SpineBoneNode::find_bone);
ClassDB::bind_method(D_METHOD("find_sprite"), &SpineBoneNode::find_parent_sprite);

ADD_PROPERTY(PropertyInfo(Variant::INT, "bone_mode", PROPERTY_HINT_ENUM, "Follow,Drive"), "set_bone_mode", "get_bone_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "get_enabled");
Expand Down
7 changes: 5 additions & 2 deletions spine-godot/spine_godot/SpineBoneNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#pragma once

#include "SpineCommon.h"
#include "SpineSkeleton.h"
#include "SpineSprite.h"
#include "scene/2d/node_2d.h"

Expand All @@ -51,8 +52,6 @@ class SpineBoneNode : public Node2D {
void on_world_transforms_changed(const Variant &_sprite);
void update_transform(SpineSprite *sprite);
void init_transform(SpineSprite *sprite);
SpineSprite *find_parent_sprite() const;
Ref<SpineBone> find_bone() const;
void draw();

public:
Expand All @@ -73,4 +72,8 @@ class SpineBoneNode : public Node2D {
void set_debug_color(Color _color);

Color get_debug_color();

SpineSprite *find_parent_sprite() const;

Ref<SpineBone> find_bone() const;
};

0 comments on commit 068a2bb

Please sign in to comment.