[godot] Make SpineObjectWrapper a RefCounted, fix up type hierarchy.

This commit is contained in:
badlogic 2022-04-26 17:15:27 +02:00
parent e807ef406c
commit 6ad83c94a8
16 changed files with 62 additions and 28 deletions

View File

@ -39,8 +39,8 @@ class SpineSkeleton;
class SpineTimeline;
class SpineSkeletonDataResource;
class SpineAnimation : public REFCOUNTED, public SpineObjectWrapper<SpineSkeletonDataResource, spine::Animation> {
GDCLASS(SpineAnimation, REFCOUNTED);
class SpineAnimation : public SpineObjectWrapper<SpineSkeletonDataResource, spine::Animation> {
GDCLASS(SpineAnimation, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -35,8 +35,8 @@
class SpineSkeletonDataResource;
class SpineAttachment : public REFCOUNTED, public SpineObjectWrapper<SpineSkeletonDataResource, spine::Attachment> {
GDCLASS(SpineAttachment, REFCOUNTED)
class SpineAttachment : public SpineObjectWrapper<SpineSkeletonDataResource, spine::Attachment> {
GDCLASS(SpineAttachment, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -38,8 +38,8 @@
class SpineSkeleton;
class SpineSprite;
class SpineBone : public REFCOUNTED, public SpineObjectWrapper<SpineSprite, spine::Bone> {
GDCLASS(SpineBone, REFCOUNTED)
class SpineBone : public SpineObjectWrapper<SpineSprite, spine::Bone> {
GDCLASS(SpineBone, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -36,8 +36,8 @@
class SpineSkeletonDataResource;
class SpineBoneData : public REFCOUNTED, public SpineObjectWrapper<SpineSkeletonDataResource, spine::BoneData> {
GDCLASS(SpineBoneData, REFCOUNTED)
class SpineBoneData : public SpineObjectWrapper<SpineSkeletonDataResource, spine::BoneData> {
GDCLASS(SpineBoneData, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -35,8 +35,8 @@
class SpineSkeletonDataResource;
class SpineConstraintData : public REFCOUNTED, public SpineObjectWrapper<SpineSkeletonDataResource, spine::ConstraintData> {
GDCLASS(SpineConstraintData, REFCOUNTED)
class SpineConstraintData : public SpineObjectWrapper<SpineSkeletonDataResource, spine::ConstraintData> {
GDCLASS(SpineConstraintData, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -36,8 +36,8 @@
class SpineBone;
class SpineSprite;
class SpineIkConstraint : public REFCOUNTED, public SpineObjectWrapper<SpineSprite, spine::IkConstraint> {
GDCLASS(SpineIkConstraint, REFCOUNTED);
class SpineIkConstraint : public SpineObjectWrapper<SpineSprite, spine::IkConstraint> {
GDCLASS(SpineIkConstraint, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -0,0 +1,33 @@
/******************************************************************************
* 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 "SpineObjectWrapper.h"

View File

@ -30,7 +30,9 @@
#ifndef GODOT_SPINEOBJECTWRAPPER_H
#define GODOT_SPINEOBJECTWRAPPER_H
template <typename OWNER, typename OBJECT> class SpineObjectWrapper {
#include "SpineCommon.h"
template <typename OWNER, typename OBJECT> class SpineObjectWrapper: public REFCOUNTED {
protected:
Object *owner;
OBJECT *spine_object;

View File

@ -34,8 +34,8 @@
#include "SpineSlot.h"
#include <spine/PathConstraint.h>
class SpinePathConstraint : public REFCOUNTED, public SpineObjectWrapper<SpineSprite, spine::PathConstraint> {
GDCLASS(SpinePathConstraint, REFCOUNTED);
class SpinePathConstraint : public SpineObjectWrapper<SpineSprite, spine::PathConstraint> {
GDCLASS(SpinePathConstraint, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -37,7 +37,7 @@
#include <spine/PathConstraintData.h>
class SpinePathConstraintData : public SpineConstraintData {
GDCLASS(SpinePathConstraintData, SpineConstraintData);
GDCLASS(SpinePathConstraintData, SpineConstraintData)
spine::PathConstraintData *get_spine_constraint_data() { return (spine::PathConstraintData *)get_spine_object(); }

View File

@ -36,8 +36,8 @@
class SpineSkeletonDataResource;
class SpineSprite;
class SpineSkin : public REFCOUNTED, public SpineObjectWrapper<SpineSkeletonDataResource, spine::Skin> {
GDCLASS(SpineSkin, REFCOUNTED);
class SpineSkin : public SpineObjectWrapper<SpineSkeletonDataResource, spine::Skin> {
GDCLASS(SpineSkin, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -35,12 +35,11 @@
#include "SpineAttachment.h"
#include "SpineBone.h"
// Breaks cyclic dependency.
class SpineSkeleton;
class SpineSprite;
class SpineSlot : public REFCOUNTED, public SpineObjectWrapper<SpineSprite, spine::Slot> {
GDCLASS(SpineSlot, REFCOUNTED)
class SpineSlot : public SpineObjectWrapper<SpineSprite, spine::Slot> {
GDCLASS(SpineSlot, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -36,8 +36,8 @@
class SpineSkeletonDataResource;
class SpineSlotData : public REFCOUNTED, public SpineObjectWrapper<SpineSkeletonDataResource, spine::SlotData> {
GDCLASS(SpineSlotData, REFCOUNTED)
class SpineSlotData : public SpineObjectWrapper<SpineSkeletonDataResource, spine::SlotData> {
GDCLASS(SpineSlotData, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -37,8 +37,8 @@
#include "SpineSprite.h"
class SpineTrackEntry : public REFCOUNTED, public SpineObjectWrapper<SpineSprite, spine::TrackEntry> {
GDCLASS(SpineTrackEntry, REFCOUNTED);
class SpineTrackEntry : public SpineObjectWrapper<SpineSprite, spine::TrackEntry> {
GDCLASS(SpineTrackEntry, SpineObjectWrapper);
protected:
static void _bind_methods();

View File

@ -35,8 +35,8 @@
#include "SpineBone.h"
#include <spine/TransformConstraint.h>
class SpineTransformConstraint : public REFCOUNTED, public SpineObjectWrapper<SpineSprite, spine::TransformConstraint> {
GDCLASS(SpineTransformConstraint, REFCOUNTED)
class SpineTransformConstraint : public SpineObjectWrapper<SpineSprite, spine::TransformConstraint> {
GDCLASS(SpineTransformConstraint, SpineObjectWrapper)
protected:
static void _bind_methods();

View File

@ -35,7 +35,7 @@
#include <spine/TransformConstraintData.h>
class SpineTransformConstraintData : public SpineConstraintData {
GDCLASS(SpineTransformConstraintData, SpineConstraintData);
GDCLASS(SpineTransformConstraintData, SpineConstraintData)
spine::TransformConstraintData *get_spine_constraint_data() { return (spine::TransformConstraintData *) SpineConstraintData::get_spine_object(); }