mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 23:34:53 +08:00
Formatting
This commit is contained in:
parent
a3bfbf15c8
commit
83ba44ed37
@ -28,6 +28,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SpineIkConstraint.h"
|
||||
#include "SpineIkConstraintPose.h"
|
||||
#include "SpineBone.h"
|
||||
#include "SpineCommon.h"
|
||||
#include "SpineSprite.h"
|
||||
@ -38,16 +39,8 @@ void SpineIkConstraint::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_bones"), &SpineIkConstraint::get_bones);
|
||||
ClassDB::bind_method(D_METHOD("get_target"), &SpineIkConstraint::get_target);
|
||||
ClassDB::bind_method(D_METHOD("set_target", "v"), &SpineIkConstraint::set_target);
|
||||
ClassDB::bind_method(D_METHOD("get_bend_direction"), &SpineIkConstraint::get_bend_direction);
|
||||
ClassDB::bind_method(D_METHOD("set_bend_direction", "v"), &SpineIkConstraint::set_bend_direction);
|
||||
ClassDB::bind_method(D_METHOD("get_compress"), &SpineIkConstraint::get_compress);
|
||||
ClassDB::bind_method(D_METHOD("set_compress", "v"), &SpineIkConstraint::set_compress);
|
||||
ClassDB::bind_method(D_METHOD("get_stretch"), &SpineIkConstraint::get_stretch);
|
||||
ClassDB::bind_method(D_METHOD("set_stretch", "v"), &SpineIkConstraint::set_stretch);
|
||||
ClassDB::bind_method(D_METHOD("get_mix"), &SpineIkConstraint::get_mix);
|
||||
ClassDB::bind_method(D_METHOD("set_mix", "v"), &SpineIkConstraint::set_mix);
|
||||
ClassDB::bind_method(D_METHOD("get_softness"), &SpineIkConstraint::get_softness);
|
||||
ClassDB::bind_method(D_METHOD("set_softness", "v"), &SpineIkConstraint::set_softness);
|
||||
ClassDB::bind_method(D_METHOD("get_pose"), &SpineIkConstraint::get_pose);
|
||||
ClassDB::bind_method(D_METHOD("get_applied_pose"), &SpineIkConstraint::get_applied_pose);
|
||||
ClassDB::bind_method(D_METHOD("is_active"), &SpineIkConstraint::is_active);
|
||||
ClassDB::bind_method(D_METHOD("set_active", "v"), &SpineIkConstraint::set_active);
|
||||
}
|
||||
@ -72,7 +65,7 @@ Array SpineIkConstraint::get_bones() {
|
||||
result.resize((int) bones.size());
|
||||
for (int i = 0; i < bones.size(); ++i) {
|
||||
auto bone = bones[i];
|
||||
Ref<SpineBone> bone_ref(memnew(SpineBone));
|
||||
Ref<SpineBonePose> bone_ref(memnew(SpineBonePose));
|
||||
bone_ref->set_spine_object(get_spine_owner(), bone);
|
||||
result[i] = bone_ref;
|
||||
}
|
||||
@ -95,53 +88,20 @@ void SpineIkConstraint::set_target(Ref<SpineBone> v) {
|
||||
}
|
||||
}
|
||||
|
||||
int SpineIkConstraint::get_bend_direction() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getBendDirection();
|
||||
Ref<SpineIkConstraintPose> SpineIkConstraint::get_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_object()->getPose();
|
||||
Ref<SpineIkConstraintPose> pose_ref(memnew(SpineIkConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
void SpineIkConstraint::set_bend_direction(int v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setBendDirection(v);
|
||||
}
|
||||
|
||||
bool SpineIkConstraint::get_compress() {
|
||||
SPINE_CHECK(get_spine_object(), false)
|
||||
return get_spine_object()->getPose().getCompress();
|
||||
}
|
||||
|
||||
void SpineIkConstraint::set_compress(bool v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setCompress(v);
|
||||
}
|
||||
|
||||
bool SpineIkConstraint::get_stretch() {
|
||||
SPINE_CHECK(get_spine_object(), false)
|
||||
return get_spine_object()->getPose().getStretch();
|
||||
}
|
||||
|
||||
void SpineIkConstraint::set_stretch(bool v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setStretch(v);
|
||||
}
|
||||
|
||||
float SpineIkConstraint::get_mix() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getMix();
|
||||
}
|
||||
void SpineIkConstraint::set_mix(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setMix(v);
|
||||
}
|
||||
|
||||
float SpineIkConstraint::get_softness() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getSoftness();
|
||||
}
|
||||
|
||||
void SpineIkConstraint::set_softness(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setSoftness(v);
|
||||
Ref<SpineIkConstraintPose> SpineIkConstraint::get_applied_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_object()->getAppliedPose();
|
||||
Ref<SpineIkConstraintPose> pose_ref(memnew(SpineIkConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
bool SpineIkConstraint::is_active() {
|
||||
|
||||
@ -31,10 +31,11 @@
|
||||
|
||||
#include "SpineIkConstraintData.h"
|
||||
#include <spine/IkConstraint.h>
|
||||
#include "SpineSkeleton.h"
|
||||
|
||||
class SpineBone;
|
||||
class SpineSprite;
|
||||
class SpineSkeleton;
|
||||
class SpineIkConstraintPose;
|
||||
|
||||
class SpineIkConstraint : public SpineSpriteOwnedObject<spine::IkConstraint> {
|
||||
GDCLASS(SpineIkConstraint, SpineObjectWrapper)
|
||||
@ -53,25 +54,9 @@ public:
|
||||
|
||||
void set_target(Ref<SpineBone> v);
|
||||
|
||||
int get_bend_direction();
|
||||
Ref<SpineIkConstraintPose> get_pose();
|
||||
|
||||
void set_bend_direction(int v);
|
||||
|
||||
bool get_compress();
|
||||
|
||||
void set_compress(bool v);
|
||||
|
||||
bool get_stretch();
|
||||
|
||||
void set_stretch(bool v);
|
||||
|
||||
float get_mix();
|
||||
|
||||
void set_mix(float v);
|
||||
|
||||
float get_softness();
|
||||
|
||||
void set_softness(float v);
|
||||
Ref<SpineIkConstraintPose> get_applied_pose();
|
||||
|
||||
bool is_active();
|
||||
|
||||
|
||||
@ -28,24 +28,16 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SpineIkConstraintData.h"
|
||||
#include "SpineIkConstraintPose.h"
|
||||
#include "SpineCommon.h"
|
||||
|
||||
void SpineIkConstraintData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_bones"), &SpineIkConstraintData::get_bones);
|
||||
ClassDB::bind_method(D_METHOD("get_target"), &SpineIkConstraintData::get_target);
|
||||
ClassDB::bind_method(D_METHOD("set_target", "v"), &SpineIkConstraintData::set_target);
|
||||
ClassDB::bind_method(D_METHOD("get_bend_direction"), &SpineIkConstraintData::get_bend_direction);
|
||||
ClassDB::bind_method(D_METHOD("set_bend_direction", "v"), &SpineIkConstraintData::set_bend_direction);
|
||||
ClassDB::bind_method(D_METHOD("get_compress"), &SpineIkConstraintData::get_compress);
|
||||
ClassDB::bind_method(D_METHOD("set_compress", "v"), &SpineIkConstraintData::set_compress);
|
||||
ClassDB::bind_method(D_METHOD("get_stretch"), &SpineIkConstraintData::get_stretch);
|
||||
ClassDB::bind_method(D_METHOD("set_stretch", "v"), &SpineIkConstraintData::set_stretch);
|
||||
ClassDB::bind_method(D_METHOD("get_uniform"), &SpineIkConstraintData::get_uniform);
|
||||
ClassDB::bind_method(D_METHOD("set_uniform", "v"), &SpineIkConstraintData::set_uniform);
|
||||
ClassDB::bind_method(D_METHOD("get_mix"), &SpineIkConstraintData::get_mix);
|
||||
ClassDB::bind_method(D_METHOD("set_mix", "v"), &SpineIkConstraintData::set_mix);
|
||||
ClassDB::bind_method(D_METHOD("get_softness"), &SpineIkConstraintData::get_softness);
|
||||
ClassDB::bind_method(D_METHOD("set_softness", "v"), &SpineIkConstraintData::set_softness);
|
||||
ClassDB::bind_method(D_METHOD("get_setup_pose"), &SpineIkConstraintData::get_setup_pose);
|
||||
}
|
||||
|
||||
Array SpineIkConstraintData::get_bones() {
|
||||
@ -77,36 +69,6 @@ void SpineIkConstraintData::set_target(Ref<SpineBoneData> v) {
|
||||
}
|
||||
}
|
||||
|
||||
int SpineIkConstraintData::get_bend_direction() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getBendDirection();
|
||||
}
|
||||
|
||||
void SpineIkConstraintData::set_bend_direction(int v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_constraint_data()->getSetupPose().setBendDirection(v);
|
||||
}
|
||||
|
||||
bool SpineIkConstraintData::get_compress() {
|
||||
SPINE_CHECK(get_spine_object(), false)
|
||||
return get_spine_constraint_data()->getSetupPose().getCompress();
|
||||
}
|
||||
|
||||
void SpineIkConstraintData::set_compress(bool v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_constraint_data()->getSetupPose().setCompress(v);
|
||||
}
|
||||
|
||||
bool SpineIkConstraintData::get_stretch() {
|
||||
SPINE_CHECK(get_spine_object(), false)
|
||||
return get_spine_constraint_data()->getSetupPose().getStretch();
|
||||
}
|
||||
|
||||
void SpineIkConstraintData::set_stretch(bool v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_constraint_data()->getSetupPose().setStretch(v);
|
||||
}
|
||||
|
||||
bool SpineIkConstraintData::get_uniform() {
|
||||
SPINE_CHECK(get_spine_object(), false)
|
||||
return get_spine_constraint_data()->getUniform();
|
||||
@ -117,22 +79,10 @@ void SpineIkConstraintData::set_uniform(bool v) {
|
||||
get_spine_constraint_data()->setUniform(v);
|
||||
}
|
||||
|
||||
float SpineIkConstraintData::get_mix() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMix();
|
||||
}
|
||||
|
||||
void SpineIkConstraintData::set_mix(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_constraint_data()->getSetupPose().setMix(v);
|
||||
}
|
||||
|
||||
float SpineIkConstraintData::get_softness() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getSoftness();
|
||||
}
|
||||
|
||||
void SpineIkConstraintData::set_softness(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_constraint_data()->getSetupPose().setSoftness(v);
|
||||
Ref<SpineIkConstraintPose> SpineIkConstraintData::get_setup_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_constraint_data()->getSetupPose();
|
||||
Ref<SpineIkConstraintPose> pose_ref(memnew(SpineIkConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
#include "SpineBoneData.h"
|
||||
#include <spine/IkConstraintData.h>
|
||||
|
||||
class SpineIkConstraintPose;
|
||||
|
||||
class SpineIkConstraintData : public SpineConstraintData {
|
||||
GDCLASS(SpineIkConstraintData, SpineConstraintData)
|
||||
|
||||
@ -47,30 +49,10 @@ public:
|
||||
Array get_bones();
|
||||
|
||||
Ref<SpineBoneData> get_target();
|
||||
|
||||
void set_target(Ref<SpineBoneData> v);
|
||||
|
||||
int get_bend_direction();
|
||||
|
||||
void set_bend_direction(int v);
|
||||
|
||||
bool get_compress();
|
||||
|
||||
void set_compress(bool v);
|
||||
|
||||
bool get_stretch();
|
||||
|
||||
void set_stretch(bool v);
|
||||
|
||||
bool get_uniform();
|
||||
|
||||
void set_uniform(bool v);
|
||||
|
||||
float get_mix();
|
||||
|
||||
void set_mix(float v);
|
||||
|
||||
float get_softness();
|
||||
|
||||
void set_softness(float v);
|
||||
Ref<SpineIkConstraintPose> get_setup_pose();
|
||||
};
|
||||
|
||||
94
spine-godot/spine_godot/SpineIkConstraintPose.cpp
Normal file
94
spine-godot/spine_godot/SpineIkConstraintPose.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, 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 "SpineIkConstraintPose.h"
|
||||
#include "SpineCommon.h"
|
||||
|
||||
void SpineIkConstraintPose::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_mix"), &SpineIkConstraintPose::get_mix);
|
||||
ClassDB::bind_method(D_METHOD("set_mix", "value"), &SpineIkConstraintPose::set_mix);
|
||||
ClassDB::bind_method(D_METHOD("get_softness"), &SpineIkConstraintPose::get_softness);
|
||||
ClassDB::bind_method(D_METHOD("set_softness", "value"), &SpineIkConstraintPose::set_softness);
|
||||
ClassDB::bind_method(D_METHOD("get_bend_direction"), &SpineIkConstraintPose::get_bend_direction);
|
||||
ClassDB::bind_method(D_METHOD("set_bend_direction", "value"), &SpineIkConstraintPose::set_bend_direction);
|
||||
ClassDB::bind_method(D_METHOD("get_compress"), &SpineIkConstraintPose::get_compress);
|
||||
ClassDB::bind_method(D_METHOD("set_compress", "value"), &SpineIkConstraintPose::set_compress);
|
||||
ClassDB::bind_method(D_METHOD("get_stretch"), &SpineIkConstraintPose::get_stretch);
|
||||
ClassDB::bind_method(D_METHOD("set_stretch", "value"), &SpineIkConstraintPose::set_stretch);
|
||||
}
|
||||
|
||||
float SpineIkConstraintPose::get_mix() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMix();
|
||||
}
|
||||
|
||||
void SpineIkConstraintPose::set_mix(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMix(value);
|
||||
}
|
||||
|
||||
float SpineIkConstraintPose::get_softness() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getSoftness();
|
||||
}
|
||||
|
||||
void SpineIkConstraintPose::set_softness(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setSoftness(value);
|
||||
}
|
||||
|
||||
int SpineIkConstraintPose::get_bend_direction() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getBendDirection();
|
||||
}
|
||||
|
||||
void SpineIkConstraintPose::set_bend_direction(int value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setBendDirection(value);
|
||||
}
|
||||
|
||||
bool SpineIkConstraintPose::get_compress() {
|
||||
SPINE_CHECK(get_spine_object(), false)
|
||||
return get_spine_object()->getCompress();
|
||||
}
|
||||
|
||||
void SpineIkConstraintPose::set_compress(bool value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setCompress(value);
|
||||
}
|
||||
|
||||
bool SpineIkConstraintPose::get_stretch() {
|
||||
SPINE_CHECK(get_spine_object(), false)
|
||||
return get_spine_object()->getStretch();
|
||||
}
|
||||
|
||||
void SpineIkConstraintPose::set_stretch(bool value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setStretch(value);
|
||||
}
|
||||
67
spine-godot/spine_godot/SpineIkConstraintPose.h
Normal file
67
spine-godot/spine_godot/SpineIkConstraintPose.h
Normal file
@ -0,0 +1,67 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SpineCommon.h"
|
||||
#include <spine/IkConstraintPose.h>
|
||||
|
||||
class SpineSprite;
|
||||
|
||||
class SpineIkConstraintPose : public SpineObjectWrapper {
|
||||
GDCLASS(SpineIkConstraintPose, SpineObjectWrapper)
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
// Can be used by both SpineSprite and SpineSkeletonDataResource
|
||||
void set_spine_object(void *owner, spine::IkConstraintPose *object) {
|
||||
_set_spine_object_internal(owner, object);
|
||||
}
|
||||
|
||||
spine::IkConstraintPose *get_spine_object() {
|
||||
return (spine::IkConstraintPose *) _get_spine_object_internal();
|
||||
}
|
||||
|
||||
float get_mix();
|
||||
void set_mix(float value);
|
||||
|
||||
float get_softness();
|
||||
void set_softness(float value);
|
||||
|
||||
int get_bend_direction();
|
||||
void set_bend_direction(int value);
|
||||
|
||||
bool get_compress();
|
||||
void set_compress(bool value);
|
||||
|
||||
bool get_stretch();
|
||||
void set_stretch(bool value);
|
||||
};
|
||||
@ -28,22 +28,15 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SpinePathConstraint.h"
|
||||
#include "SpinePathConstraintPose.h"
|
||||
#include "SpineBone.h"
|
||||
#include "SpineCommon.h"
|
||||
#include "SpineSprite.h"
|
||||
|
||||
void SpinePathConstraint::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("update", "skeleton"), &SpinePathConstraint::update);
|
||||
ClassDB::bind_method(D_METHOD("get_position"), &SpinePathConstraint::get_position);
|
||||
ClassDB::bind_method(D_METHOD("set_position", "v"), &SpinePathConstraint::set_position);
|
||||
ClassDB::bind_method(D_METHOD("get_spacing"), &SpinePathConstraint::get_spacing);
|
||||
ClassDB::bind_method(D_METHOD("set_spacing", "v"), &SpinePathConstraint::set_spacing);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_rotate"), &SpinePathConstraint::get_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_rotate", "v"), &SpinePathConstraint::set_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_x"), &SpinePathConstraint::get_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_x", "v"), &SpinePathConstraint::set_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_y"), &SpinePathConstraint::get_mix_y);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_y", "v"), &SpinePathConstraint::set_mix_y);
|
||||
ClassDB::bind_method(D_METHOD("get_pose"), &SpinePathConstraint::get_pose);
|
||||
ClassDB::bind_method(D_METHOD("get_applied_pose"), &SpinePathConstraint::get_applied_pose);
|
||||
ClassDB::bind_method(D_METHOD("get_bones"), &SpinePathConstraint::get_bones);
|
||||
ClassDB::bind_method(D_METHOD("get_slot"), &SpinePathConstraint::get_slot);
|
||||
ClassDB::bind_method(D_METHOD("set_slot", "v"), &SpinePathConstraint::set_slot);
|
||||
@ -57,54 +50,20 @@ void SpinePathConstraint::update(Ref<SpineSkeleton> skeleton) {
|
||||
get_spine_object()->update(*skeleton->get_spine_object(), spine::Physics_Update);
|
||||
}
|
||||
|
||||
float SpinePathConstraint::get_position() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getPosition();
|
||||
Ref<SpinePathConstraintPose> SpinePathConstraint::get_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_object()->getPose();
|
||||
Ref<SpinePathConstraintPose> pose_ref(memnew(SpinePathConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
void SpinePathConstraint::set_position(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setPosition(v);
|
||||
}
|
||||
|
||||
float SpinePathConstraint::get_spacing() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getSpacing();
|
||||
}
|
||||
|
||||
void SpinePathConstraint::set_spacing(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setSpacing(v);
|
||||
}
|
||||
|
||||
float SpinePathConstraint::get_mix_rotate() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getMixRotate();
|
||||
}
|
||||
|
||||
void SpinePathConstraint::set_mix_rotate(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setMixRotate(v);
|
||||
}
|
||||
|
||||
float SpinePathConstraint::get_mix_x() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getMixX();
|
||||
}
|
||||
|
||||
void SpinePathConstraint::set_mix_x(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setMixX(v);
|
||||
}
|
||||
|
||||
float SpinePathConstraint::get_mix_y() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getMixY();
|
||||
}
|
||||
|
||||
void SpinePathConstraint::set_mix_y(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setMixY(v);
|
||||
Ref<SpinePathConstraintPose> SpinePathConstraint::get_applied_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_object()->getAppliedPose();
|
||||
Ref<SpinePathConstraintPose> pose_ref(memnew(SpinePathConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
Array SpinePathConstraint::get_bones() {
|
||||
@ -114,7 +73,7 @@ Array SpinePathConstraint::get_bones() {
|
||||
result.resize((int) bones.size());
|
||||
for (int i = 0; i < bones.size(); ++i) {
|
||||
auto bone = bones[i];
|
||||
Ref<SpineBone> bone_ref(memnew(SpineBone));
|
||||
Ref<SpineBonePose> bone_ref(memnew(SpineBonePose));
|
||||
bone_ref->set_spine_object(get_spine_owner(), bone);
|
||||
result[i] = bone_ref;
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
#include "SpineSlot.h"
|
||||
#include <spine/PathConstraint.h>
|
||||
|
||||
class SpinePathConstraintPose;
|
||||
|
||||
class SpinePathConstraint : public SpineSpriteOwnedObject<spine::PathConstraint> {
|
||||
GDCLASS(SpinePathConstraint, SpineObjectWrapper)
|
||||
|
||||
@ -42,25 +44,9 @@ protected:
|
||||
public:
|
||||
void update(Ref<SpineSkeleton> skeleton);
|
||||
|
||||
float get_position();
|
||||
Ref<SpinePathConstraintPose> get_pose();
|
||||
|
||||
void set_position(float v);
|
||||
|
||||
float get_spacing();
|
||||
|
||||
void set_spacing(float v);
|
||||
|
||||
float get_mix_rotate();
|
||||
|
||||
void set_mix_rotate(float v);
|
||||
|
||||
float get_mix_x();
|
||||
|
||||
void set_mix_x(float v);
|
||||
|
||||
float get_mix_y();
|
||||
|
||||
void set_mix_y(float v);
|
||||
Ref<SpinePathConstraintPose> get_applied_pose();
|
||||
|
||||
Array get_bones();
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SpinePathConstraintData.h"
|
||||
#include "SpinePathConstraintPose.h"
|
||||
#include "SpineCommon.h"
|
||||
#include "SpineSkeletonDataResource.h"
|
||||
|
||||
@ -43,16 +44,7 @@ void SpinePathConstraintData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_rotate_mode", "v"), &SpinePathConstraintData::set_rotate_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_offset_rotation"), &SpinePathConstraintData::get_offset_rotation);
|
||||
ClassDB::bind_method(D_METHOD("set_offset_rotation", "v"), &SpinePathConstraintData::set_offset_rotation);
|
||||
ClassDB::bind_method(D_METHOD("get_position"), &SpinePathConstraintData::get_position);
|
||||
ClassDB::bind_method(D_METHOD("set_position", "v"), &SpinePathConstraintData::set_position);
|
||||
ClassDB::bind_method(D_METHOD("get_spacing"), &SpinePathConstraintData::get_spacing);
|
||||
ClassDB::bind_method(D_METHOD("set_spacing", "v"), &SpinePathConstraintData::set_spacing);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_rotate"), &SpinePathConstraintData::get_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_rotate", "v"), &SpinePathConstraintData::set_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_x"), &SpinePathConstraintData::get_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_x", "v"), &SpinePathConstraintData::set_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_y"), &SpinePathConstraintData::get_mix_y);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_y", "v"), &SpinePathConstraintData::set_mix_y);
|
||||
ClassDB::bind_method(D_METHOD("get_setup_pose"), &SpinePathConstraintData::get_setup_pose);
|
||||
}
|
||||
|
||||
Array SpinePathConstraintData::get_bones() {
|
||||
@ -124,52 +116,10 @@ void SpinePathConstraintData::set_offset_rotation(float v) {
|
||||
get_spine_constraint_data()->setOffsetRotation(v);
|
||||
}
|
||||
|
||||
float SpinePathConstraintData::get_position() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getPosition();
|
||||
}
|
||||
|
||||
void SpinePathConstraintData::set_position(float v) {
|
||||
SPINE_CHECK(get_spine_constraint_data(), )
|
||||
get_spine_constraint_data()->getSetupPose().setPosition(v);
|
||||
}
|
||||
|
||||
float SpinePathConstraintData::get_spacing() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getSpacing();
|
||||
}
|
||||
|
||||
void SpinePathConstraintData::set_spacing(float v) {
|
||||
SPINE_CHECK(get_spine_constraint_data(), )
|
||||
get_spine_constraint_data()->getSetupPose().setSpacing(v);
|
||||
}
|
||||
|
||||
float SpinePathConstraintData::get_mix_rotate() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMixRotate();
|
||||
}
|
||||
|
||||
void SpinePathConstraintData::set_mix_rotate(float v) {
|
||||
SPINE_CHECK(get_spine_constraint_data(), )
|
||||
get_spine_constraint_data()->getSetupPose().setMixRotate(v);
|
||||
}
|
||||
|
||||
float SpinePathConstraintData::get_mix_x() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMixX();
|
||||
}
|
||||
|
||||
void SpinePathConstraintData::set_mix_x(float v) {
|
||||
SPINE_CHECK(get_spine_constraint_data(), )
|
||||
get_spine_constraint_data()->getSetupPose().setMixX(v);
|
||||
}
|
||||
|
||||
float SpinePathConstraintData::get_mix_y() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMixY();
|
||||
}
|
||||
|
||||
void SpinePathConstraintData::set_mix_y(float v) {
|
||||
SPINE_CHECK(get_spine_constraint_data(), )
|
||||
get_spine_constraint_data()->getSetupPose().setMixY(v);
|
||||
Ref<SpinePathConstraintPose> SpinePathConstraintData::get_setup_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_constraint_data()->getSetupPose();
|
||||
Ref<SpinePathConstraintPose> pose_ref(memnew(SpinePathConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
@ -35,6 +35,8 @@
|
||||
#include "SpineSlotData.h"
|
||||
#include <spine/PathConstraintData.h>
|
||||
|
||||
class SpinePathConstraintPose;
|
||||
|
||||
class SpinePathConstraintData : public SpineConstraintData {
|
||||
GDCLASS(SpinePathConstraintData, SpineConstraintData)
|
||||
|
||||
@ -68,23 +70,5 @@ public:
|
||||
|
||||
void set_offset_rotation(float v);
|
||||
|
||||
float get_position();
|
||||
|
||||
void set_position(float v);
|
||||
|
||||
float get_spacing();
|
||||
|
||||
void set_spacing(float v);
|
||||
|
||||
float get_mix_rotate();
|
||||
|
||||
void set_mix_rotate(float v);
|
||||
|
||||
float get_mix_x();
|
||||
|
||||
void set_mix_x(float v);
|
||||
|
||||
float get_mix_y();
|
||||
|
||||
void set_mix_y(float v);
|
||||
Ref<SpinePathConstraintPose> get_setup_pose();
|
||||
};
|
||||
|
||||
94
spine-godot/spine_godot/SpinePathConstraintPose.cpp
Normal file
94
spine-godot/spine_godot/SpinePathConstraintPose.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, 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 "SpinePathConstraintPose.h"
|
||||
#include "SpineCommon.h"
|
||||
|
||||
void SpinePathConstraintPose::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_position"), &SpinePathConstraintPose::get_position);
|
||||
ClassDB::bind_method(D_METHOD("set_position", "value"), &SpinePathConstraintPose::set_position);
|
||||
ClassDB::bind_method(D_METHOD("get_spacing"), &SpinePathConstraintPose::get_spacing);
|
||||
ClassDB::bind_method(D_METHOD("set_spacing", "value"), &SpinePathConstraintPose::set_spacing);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_rotate"), &SpinePathConstraintPose::get_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_rotate", "value"), &SpinePathConstraintPose::set_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_x"), &SpinePathConstraintPose::get_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_x", "value"), &SpinePathConstraintPose::set_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_y"), &SpinePathConstraintPose::get_mix_y);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_y", "value"), &SpinePathConstraintPose::set_mix_y);
|
||||
}
|
||||
|
||||
float SpinePathConstraintPose::get_position() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPosition();
|
||||
}
|
||||
|
||||
void SpinePathConstraintPose::set_position(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setPosition(value);
|
||||
}
|
||||
|
||||
float SpinePathConstraintPose::get_spacing() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getSpacing();
|
||||
}
|
||||
|
||||
void SpinePathConstraintPose::set_spacing(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setSpacing(value);
|
||||
}
|
||||
|
||||
float SpinePathConstraintPose::get_mix_rotate() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixRotate();
|
||||
}
|
||||
|
||||
void SpinePathConstraintPose::set_mix_rotate(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixRotate(value);
|
||||
}
|
||||
|
||||
float SpinePathConstraintPose::get_mix_x() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixX();
|
||||
}
|
||||
|
||||
void SpinePathConstraintPose::set_mix_x(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixX(value);
|
||||
}
|
||||
|
||||
float SpinePathConstraintPose::get_mix_y() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixY();
|
||||
}
|
||||
|
||||
void SpinePathConstraintPose::set_mix_y(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixY(value);
|
||||
}
|
||||
68
spine-godot/spine_godot/SpinePathConstraintPose.h
Normal file
68
spine-godot/spine_godot/SpinePathConstraintPose.h
Normal file
@ -0,0 +1,68 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SpineCommon.h"
|
||||
#include "spine-cpp/include/spine/PathConstraintPose.h"
|
||||
#include <spine/PathConstraintPose.h>
|
||||
|
||||
class SpineSprite;
|
||||
|
||||
class SpinePathConstraintPose : public SpineObjectWrapper {
|
||||
GDCLASS(SpinePathConstraintPose, SpineObjectWrapper)
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
// Can be used by both SpineSprite and SpineSkeletonDataResource
|
||||
void set_spine_object(void *owner, spine::PathConstraintPose *object) {
|
||||
_set_spine_object_internal(owner, object);
|
||||
}
|
||||
|
||||
spine::PathConstraintPose *get_spine_object() {
|
||||
return (spine::PathConstraintPose *) _get_spine_object_internal();
|
||||
}
|
||||
|
||||
float get_position();
|
||||
void set_position(float value);
|
||||
|
||||
float get_spacing();
|
||||
void set_spacing(float value);
|
||||
|
||||
float get_mix_rotate();
|
||||
void set_mix_rotate(float value);
|
||||
|
||||
float get_mix_x();
|
||||
void set_mix_x(float value);
|
||||
|
||||
float get_mix_y();
|
||||
void set_mix_y(float value);
|
||||
};
|
||||
@ -28,26 +28,17 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SpinePhysicsConstraint.h"
|
||||
#include "SpinePhysicsConstraintPose.h"
|
||||
#include "SpineCommon.h"
|
||||
#include "SpineSprite.h"
|
||||
|
||||
void SpinePhysicsConstraint::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("update", "skeleton", "physics"), &SpinePhysicsConstraint::update);
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &SpinePhysicsConstraint::get_data);
|
||||
ClassDB::bind_method(D_METHOD("get_bone"), &SpinePhysicsConstraint::get_bone);
|
||||
ClassDB::bind_method(D_METHOD("set_inertia", "value"), &SpinePhysicsConstraint::set_inertia);
|
||||
ClassDB::bind_method(D_METHOD("get_inertia"), &SpinePhysicsConstraint::get_inertia);
|
||||
ClassDB::bind_method(D_METHOD("set_strength", "value"), &SpinePhysicsConstraint::set_strength);
|
||||
ClassDB::bind_method(D_METHOD("get_strength"), &SpinePhysicsConstraint::get_strength);
|
||||
ClassDB::bind_method(D_METHOD("set_damping", "value"), &SpinePhysicsConstraint::set_damping);
|
||||
ClassDB::bind_method(D_METHOD("get_damping"), &SpinePhysicsConstraint::get_damping);
|
||||
ClassDB::bind_method(D_METHOD("set_mass_inverse", "value"), &SpinePhysicsConstraint::set_mass_inverse);
|
||||
ClassDB::bind_method(D_METHOD("get_mass_inverse"), &SpinePhysicsConstraint::get_mass_inverse);
|
||||
ClassDB::bind_method(D_METHOD("set_wind", "value"), &SpinePhysicsConstraint::set_wind);
|
||||
ClassDB::bind_method(D_METHOD("get_wind"), &SpinePhysicsConstraint::get_wind);
|
||||
ClassDB::bind_method(D_METHOD("set_gravity", "value"), &SpinePhysicsConstraint::set_gravity);
|
||||
ClassDB::bind_method(D_METHOD("get_gravity"), &SpinePhysicsConstraint::get_gravity);
|
||||
ClassDB::bind_method(D_METHOD("set_mix", "value"), &SpinePhysicsConstraint::set_mix);
|
||||
ClassDB::bind_method(D_METHOD("get_mix"), &SpinePhysicsConstraint::get_mix);
|
||||
ClassDB::bind_method(D_METHOD("set_bone", "v"), &SpinePhysicsConstraint::set_bone);
|
||||
ClassDB::bind_method(D_METHOD("get_pose"), &SpinePhysicsConstraint::get_pose);
|
||||
ClassDB::bind_method(D_METHOD("get_applied_pose"), &SpinePhysicsConstraint::get_applied_pose);
|
||||
ClassDB::bind_method(D_METHOD("reset", "skeleton"), &SpinePhysicsConstraint::reset);
|
||||
ClassDB::bind_method(D_METHOD("translate", "x", "y"), &SpinePhysicsConstraint::translate);
|
||||
ClassDB::bind_method(D_METHOD("rotate", "x", "y", "degrees"), &SpinePhysicsConstraint::rotate);
|
||||
@ -66,90 +57,36 @@ Ref<SpinePhysicsConstraintData> SpinePhysicsConstraint::get_data() {
|
||||
return data_ref;
|
||||
}
|
||||
|
||||
Ref<SpineBone> SpinePhysicsConstraint::get_bone() {
|
||||
Ref<SpineBonePose> SpinePhysicsConstraint::get_bone() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto target = &get_spine_object()->getBone();
|
||||
if (!target) return nullptr;
|
||||
Ref<SpineBone> target_ref(memnew(SpineBone));
|
||||
Ref<SpineBonePose> target_ref(memnew(SpineBonePose));
|
||||
target_ref->set_spine_object(get_spine_owner(), target);
|
||||
return target_ref;
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraint::set_bone(Ref<SpineBone> v) {
|
||||
void SpinePhysicsConstraint::set_bone(Ref<SpineBonePose> v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
if (v.is_valid() && v->get_spine_object()) {
|
||||
get_spine_object()->setBone(v->get_spine_object());
|
||||
get_spine_object()->setBone(*v->get_spine_object());
|
||||
}
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraint::set_inertia(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setInertia(value);
|
||||
Ref<SpinePhysicsConstraintPose> SpinePhysicsConstraint::get_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_object()->getPose();
|
||||
Ref<SpinePhysicsConstraintPose> pose_ref(memnew(SpinePhysicsConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraint::get_inertia() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getInertia();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraint::set_strength(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setStrength(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraint::get_strength() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getStrength();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraint::set_damping(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setDamping(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraint::get_damping() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getDamping();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraint::set_mass_inverse(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setMassInverse(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraint::get_mass_inverse() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getMassInverse();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraint::set_wind(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setWind(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraint::get_wind() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getWind();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraint::set_gravity(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setGravity(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraint::get_gravity() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getGravity();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraint::set_mix(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setMix(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraint::get_mix() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getPose().getMix();
|
||||
Ref<SpinePhysicsConstraintPose> SpinePhysicsConstraint::get_applied_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_object()->getAppliedPose();
|
||||
Ref<SpinePhysicsConstraintPose> pose_ref(memnew(SpinePhysicsConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraint::reset(Ref<SpineSkeleton> skeleton) {
|
||||
|
||||
@ -34,6 +34,8 @@
|
||||
#include "SpineBone.h"
|
||||
#include <spine/PhysicsConstraint.h>
|
||||
|
||||
class SpinePhysicsConstraintPose;
|
||||
|
||||
class SpinePhysicsConstraint : public SpineSpriteOwnedObject<spine::PhysicsConstraint> {
|
||||
GDCLASS(SpinePhysicsConstraint, SpineObjectWrapper)
|
||||
|
||||
@ -45,30 +47,11 @@ public:
|
||||
|
||||
Ref<SpinePhysicsConstraintData> get_data();
|
||||
|
||||
Ref<SpineBone> get_bone();
|
||||
Ref<SpineBonePose> get_bone();
|
||||
void set_bone(Ref<SpineBonePose> v);
|
||||
|
||||
void set_bone(Ref<SpineBone> v);
|
||||
|
||||
void set_inertia(float value);
|
||||
float get_inertia();
|
||||
|
||||
void set_strength(float value);
|
||||
float get_strength();
|
||||
|
||||
void set_damping(float value);
|
||||
float get_damping();
|
||||
|
||||
void set_mass_inverse(float value);
|
||||
float get_mass_inverse();
|
||||
|
||||
void set_wind(float value);
|
||||
float get_wind();
|
||||
|
||||
void set_gravity(float value);
|
||||
float get_gravity();
|
||||
|
||||
void set_mix(float value);
|
||||
float get_mix();
|
||||
Ref<SpinePhysicsConstraintPose> get_pose();
|
||||
Ref<SpinePhysicsConstraintPose> get_applied_pose();
|
||||
|
||||
void reset(Ref<SpineSkeleton> skeleton);
|
||||
|
||||
|
||||
@ -28,21 +28,18 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SpinePhysicsConstraintData.h"
|
||||
#include "SpinePhysicsConstraintPose.h"
|
||||
#include "SpineCommon.h"
|
||||
|
||||
void SpinePhysicsConstraintData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_bone"), &SpinePhysicsConstraintData::get_bone);
|
||||
ClassDB::bind_method(D_METHOD("get_x"), &SpinePhysicsConstraintData::get_x);
|
||||
ClassDB::bind_method(D_METHOD("get_y"), &SpinePhysicsConstraintData::get_y);
|
||||
ClassDB::bind_method(D_METHOD("get_rotate"), &SpinePhysicsConstraintData::get_rotate);
|
||||
ClassDB::bind_method(D_METHOD("get_scale_x"), &SpinePhysicsConstraintData::get_scale_x);
|
||||
ClassDB::bind_method(D_METHOD("get_shear_x"), &SpinePhysicsConstraintData::get_shear_x);
|
||||
ClassDB::bind_method(D_METHOD("get_limit"), &SpinePhysicsConstraintData::get_limit);
|
||||
ClassDB::bind_method(D_METHOD("get_step"), &SpinePhysicsConstraintData::get_step);
|
||||
ClassDB::bind_method(D_METHOD("get_inertia"), &SpinePhysicsConstraintData::get_inertia);
|
||||
ClassDB::bind_method(D_METHOD("get_strength"), &SpinePhysicsConstraintData::get_strength);
|
||||
ClassDB::bind_method(D_METHOD("get_damping"), &SpinePhysicsConstraintData::get_damping);
|
||||
ClassDB::bind_method(D_METHOD("get_mass_inverse"), &SpinePhysicsConstraintData::get_mass_inverse);
|
||||
ClassDB::bind_method(D_METHOD("get_wind"), &SpinePhysicsConstraintData::get_wind);
|
||||
ClassDB::bind_method(D_METHOD("get_gravity"), &SpinePhysicsConstraintData::get_gravity);
|
||||
ClassDB::bind_method(D_METHOD("get_mix"), &SpinePhysicsConstraintData::get_mix);
|
||||
ClassDB::bind_method(D_METHOD("is_inertia_global"), &SpinePhysicsConstraintData::is_inertia_global);
|
||||
ClassDB::bind_method(D_METHOD("is_strength_global"), &SpinePhysicsConstraintData::is_strength_global);
|
||||
ClassDB::bind_method(D_METHOD("is_damping_global"), &SpinePhysicsConstraintData::is_damping_global);
|
||||
@ -50,6 +47,7 @@ void SpinePhysicsConstraintData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("is_wind_global"), &SpinePhysicsConstraintData::is_wind_global);
|
||||
ClassDB::bind_method(D_METHOD("is_gravity_global"), &SpinePhysicsConstraintData::is_gravity_global);
|
||||
ClassDB::bind_method(D_METHOD("is_mix_global"), &SpinePhysicsConstraintData::is_mix_global);
|
||||
ClassDB::bind_method(D_METHOD("get_setup_pose"), &SpinePhysicsConstraintData::get_setup_pose);
|
||||
}
|
||||
|
||||
|
||||
@ -82,40 +80,21 @@ float SpinePhysicsConstraintData::get_step() {
|
||||
return get_spine_constraint_data()->getStep();
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintData::get_inertia() {
|
||||
float SpinePhysicsConstraintData::get_x() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getInertia();
|
||||
return get_spine_constraint_data()->getX();
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintData::get_strength() {
|
||||
float SpinePhysicsConstraintData::get_y() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getStrength();
|
||||
return get_spine_constraint_data()->getY();
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintData::get_damping() {
|
||||
float SpinePhysicsConstraintData::get_rotate() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getDamping();
|
||||
return get_spine_constraint_data()->getRotate();
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintData::get_mass_inverse() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMassInverse();
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintData::get_wind() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getWind();
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintData::get_gravity() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getGravity();
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintData::get_mix() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMix();
|
||||
}
|
||||
|
||||
bool SpinePhysicsConstraintData::is_inertia_global() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), false)
|
||||
@ -151,3 +130,11 @@ bool SpinePhysicsConstraintData::is_mix_global() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), false)
|
||||
return get_spine_constraint_data()->getMixGlobal();
|
||||
}
|
||||
|
||||
Ref<SpinePhysicsConstraintPose> SpinePhysicsConstraintData::get_setup_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_constraint_data()->getSetupPose();
|
||||
Ref<SpinePhysicsConstraintPose> pose_ref(memnew(SpinePhysicsConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
#include "SpineBoneData.h"
|
||||
#include <spine/PhysicsConstraintData.h>
|
||||
|
||||
class SpinePhysicsConstraintPose;
|
||||
|
||||
class SpinePhysicsConstraintData : public SpineConstraintData {
|
||||
GDCLASS(SpinePhysicsConstraintData, SpineConstraintData)
|
||||
|
||||
@ -60,20 +62,6 @@ public:
|
||||
|
||||
float get_step();
|
||||
|
||||
float get_inertia();
|
||||
|
||||
float get_strength();
|
||||
|
||||
float get_damping();
|
||||
|
||||
float get_mass_inverse();
|
||||
|
||||
float get_wind();
|
||||
|
||||
float get_gravity();
|
||||
|
||||
float get_mix();
|
||||
|
||||
bool is_inertia_global();
|
||||
|
||||
bool is_strength_global();
|
||||
@ -87,4 +75,6 @@ public:
|
||||
bool is_gravity_global();
|
||||
|
||||
bool is_mix_global();
|
||||
|
||||
Ref<SpinePhysicsConstraintPose> get_setup_pose();
|
||||
};
|
||||
|
||||
118
spine-godot/spine_godot/SpinePhysicsConstraintPose.cpp
Normal file
118
spine-godot/spine_godot/SpinePhysicsConstraintPose.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, 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 "SpinePhysicsConstraintPose.h"
|
||||
#include "SpineCommon.h"
|
||||
|
||||
void SpinePhysicsConstraintPose::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_inertia"), &SpinePhysicsConstraintPose::get_inertia);
|
||||
ClassDB::bind_method(D_METHOD("set_inertia", "value"), &SpinePhysicsConstraintPose::set_inertia);
|
||||
ClassDB::bind_method(D_METHOD("get_strength"), &SpinePhysicsConstraintPose::get_strength);
|
||||
ClassDB::bind_method(D_METHOD("set_strength", "value"), &SpinePhysicsConstraintPose::set_strength);
|
||||
ClassDB::bind_method(D_METHOD("get_damping"), &SpinePhysicsConstraintPose::get_damping);
|
||||
ClassDB::bind_method(D_METHOD("set_damping", "value"), &SpinePhysicsConstraintPose::set_damping);
|
||||
ClassDB::bind_method(D_METHOD("get_mass_inverse"), &SpinePhysicsConstraintPose::get_mass_inverse);
|
||||
ClassDB::bind_method(D_METHOD("set_mass_inverse", "value"), &SpinePhysicsConstraintPose::set_mass_inverse);
|
||||
ClassDB::bind_method(D_METHOD("get_wind"), &SpinePhysicsConstraintPose::get_wind);
|
||||
ClassDB::bind_method(D_METHOD("set_wind", "value"), &SpinePhysicsConstraintPose::set_wind);
|
||||
ClassDB::bind_method(D_METHOD("get_gravity"), &SpinePhysicsConstraintPose::get_gravity);
|
||||
ClassDB::bind_method(D_METHOD("set_gravity", "value"), &SpinePhysicsConstraintPose::set_gravity);
|
||||
ClassDB::bind_method(D_METHOD("get_mix"), &SpinePhysicsConstraintPose::get_mix);
|
||||
ClassDB::bind_method(D_METHOD("set_mix", "value"), &SpinePhysicsConstraintPose::set_mix);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintPose::get_inertia() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getInertia();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraintPose::set_inertia(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setInertia(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintPose::get_strength() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getStrength();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraintPose::set_strength(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setStrength(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintPose::get_damping() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getDamping();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraintPose::set_damping(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setDamping(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintPose::get_mass_inverse() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMassInverse();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraintPose::set_mass_inverse(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMassInverse(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintPose::get_wind() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getWind();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraintPose::set_wind(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setWind(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintPose::get_gravity() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getGravity();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraintPose::set_gravity(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setGravity(value);
|
||||
}
|
||||
|
||||
float SpinePhysicsConstraintPose::get_mix() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMix();
|
||||
}
|
||||
|
||||
void SpinePhysicsConstraintPose::set_mix(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMix(value);
|
||||
}
|
||||
74
spine-godot/spine_godot/SpinePhysicsConstraintPose.h
Normal file
74
spine-godot/spine_godot/SpinePhysicsConstraintPose.h
Normal file
@ -0,0 +1,74 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SpineCommon.h"
|
||||
#include "spine-cpp/include/spine/PhysicsConstraintPose.h"
|
||||
#include <spine/PhysicsConstraintPose.h>
|
||||
|
||||
class SpineSprite;
|
||||
|
||||
class SpinePhysicsConstraintPose : public SpineObjectWrapper {
|
||||
GDCLASS(SpinePhysicsConstraintPose, SpineObjectWrapper)
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
// Can be used by both SpineSprite and SpineSkeletonDataResource
|
||||
void set_spine_object(void *owner, spine::PhysicsConstraintPose *object) {
|
||||
_set_spine_object_internal(owner, object);
|
||||
}
|
||||
|
||||
spine::PhysicsConstraintPose *get_spine_object() {
|
||||
return (spine::PhysicsConstraintPose *) _get_spine_object_internal();
|
||||
}
|
||||
|
||||
float get_inertia();
|
||||
void set_inertia(float value);
|
||||
|
||||
float get_strength();
|
||||
void set_strength(float value);
|
||||
|
||||
float get_damping();
|
||||
void set_damping(float value);
|
||||
|
||||
float get_mass_inverse();
|
||||
void set_mass_inverse(float value);
|
||||
|
||||
float get_wind();
|
||||
void set_wind(float value);
|
||||
|
||||
float get_gravity();
|
||||
void set_gravity(float value);
|
||||
|
||||
float get_mix();
|
||||
void set_mix(float value);
|
||||
};
|
||||
@ -30,6 +30,10 @@
|
||||
#include "SpineSkeleton.h"
|
||||
#include "SpineCommon.h"
|
||||
#include "SpineSprite.h"
|
||||
#include "SpineIkConstraint.h"
|
||||
#include "SpineTransformConstraint.h"
|
||||
#include "SpinePathConstraint.h"
|
||||
#include "SpinePhysicsConstraint.h"
|
||||
#include "spine/IkConstraint.h"
|
||||
#include "spine/PathConstraint.h"
|
||||
#include "spine/PhysicsConstraint.h"
|
||||
|
||||
@ -33,14 +33,15 @@
|
||||
#include "SpineSkeletonDataResource.h"
|
||||
#include "SpineBone.h"
|
||||
#include "SpineSlot.h"
|
||||
#include "SpineIkConstraint.h"
|
||||
#include "SpineTransformConstraint.h"
|
||||
#include "SpinePathConstraint.h"
|
||||
#include "SpinePhysicsConstraint.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
// Forward declarations to avoid circular includes
|
||||
class SpineSprite;
|
||||
class SpineIkConstraint;
|
||||
class SpineTransformConstraint;
|
||||
class SpinePathConstraint;
|
||||
class SpinePhysicsConstraint;
|
||||
|
||||
class SpineSkeleton : public REFCOUNTED {
|
||||
GDCLASS(SpineSkeleton, REFCOUNTED);
|
||||
|
||||
@ -629,7 +629,7 @@ Array SpineSkeletonDataResource::get_ik_constraints() const {
|
||||
result.resize((int) constraints.size());
|
||||
int size = 0;
|
||||
for (int i = 0; i < constraints.size(); ++i) {
|
||||
if (!constraints[i].getRtti().isExactly(spine::IkConstraintData::rtti)) continue;
|
||||
if (!constraints[i]->getRTTI().isExactly(spine::IkConstraintData::rtti)) continue;
|
||||
Ref<SpineIkConstraintData> constraint_ref(memnew(SpineIkConstraintData));
|
||||
constraint_ref->set_spine_object(this, constraints[i]);
|
||||
result[i] = constraint_ref;
|
||||
@ -646,7 +646,7 @@ Array SpineSkeletonDataResource::get_transform_constraints() const {
|
||||
result.resize((int) constraints.size());
|
||||
int size = 0;
|
||||
for (int i = 0; i < constraints.size(); ++i) {
|
||||
if (!constraints[i].getRtti().isExactly(spine::TransformConstraintData::rtti)) continue;
|
||||
if (!constraints[i]->getRTTI().isExactly(spine::TransformConstraintData::rtti)) continue;
|
||||
Ref<SpineTransformConstraintData> constraint_ref(memnew(SpineTransformConstraintData));
|
||||
constraint_ref->set_spine_object(this, constraints[i]);
|
||||
result[i] = constraint_ref;
|
||||
@ -663,7 +663,7 @@ Array SpineSkeletonDataResource::get_path_constraints() const {
|
||||
result.resize((int) constraints.size());
|
||||
int size = 0;
|
||||
for (int i = 0; i < constraints.size(); ++i) {
|
||||
if (!constraints[i].getRtti().isExactly(spine::PathConstraintData::rtti)) continue;
|
||||
if (!constraints[i]->getRTTI().isExactly(spine::PathConstraintData::rtti)) continue;
|
||||
Ref<SpinePathConstraintData> constraint_ref(memnew(SpinePathConstraintData));
|
||||
constraint_ref->set_spine_object(this, constraints[i]);
|
||||
result[i] = constraint_ref;
|
||||
@ -680,7 +680,7 @@ Array SpineSkeletonDataResource::get_physics_constraints() const {
|
||||
result.resize((int) constraints.size());
|
||||
int size = 0;
|
||||
for (int i = 0; i < constraints.size(); ++i) {
|
||||
if (!constraints[i].getRtti().isExactly(spine::PhysicsConstraintData::rtti)) continue;
|
||||
if (!constraints[i]->getRTTI().isExactly(spine::PhysicsConstraintData::rtti)) continue;
|
||||
Ref<SpinePhysicsConstraintData> constraint_ref(memnew(SpinePhysicsConstraintData));
|
||||
constraint_ref->set_spine_object(this, constraints[i]);
|
||||
result[i] = constraint_ref;
|
||||
|
||||
58
spine-godot/spine_godot/SpineSliderPose.cpp
Normal file
58
spine-godot/spine_godot/SpineSliderPose.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, 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 "SpineSliderPose.h"
|
||||
#include "SpineCommon.h"
|
||||
|
||||
void SpineSliderPose::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_time"), &SpineSliderPose::get_time);
|
||||
ClassDB::bind_method(D_METHOD("set_time", "value"), &SpineSliderPose::set_time);
|
||||
ClassDB::bind_method(D_METHOD("get_mix"), &SpineSliderPose::get_mix);
|
||||
ClassDB::bind_method(D_METHOD("set_mix", "value"), &SpineSliderPose::set_mix);
|
||||
}
|
||||
|
||||
float SpineSliderPose::get_time() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getTime();
|
||||
}
|
||||
|
||||
void SpineSliderPose::set_time(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setTime(value);
|
||||
}
|
||||
|
||||
float SpineSliderPose::get_mix() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMix();
|
||||
}
|
||||
|
||||
void SpineSliderPose::set_mix(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMix(value);
|
||||
}
|
||||
58
spine-godot/spine_godot/SpineSliderPose.h
Normal file
58
spine-godot/spine_godot/SpineSliderPose.h
Normal file
@ -0,0 +1,58 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SpineCommon.h"
|
||||
#include <spine/SliderPose.h>
|
||||
|
||||
class SpineSprite;
|
||||
|
||||
class SpineSliderPose : public SpineObjectWrapper {
|
||||
GDCLASS(SpineSliderPose, SpineObjectWrapper)
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
// Can be used by both SpineSprite and SpineSkeletonDataResource
|
||||
void set_spine_object(void *owner, spine::SliderPose *object) {
|
||||
_set_spine_object_internal(owner, object);
|
||||
}
|
||||
|
||||
spine::SliderPose *get_spine_object() {
|
||||
return (spine::SliderPose *) _get_spine_object_internal();
|
||||
}
|
||||
|
||||
float get_time();
|
||||
void set_time(float value);
|
||||
|
||||
float get_mix();
|
||||
void set_mix(float value);
|
||||
};
|
||||
@ -37,19 +37,6 @@ void SpineSlot::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_to_setup_pose"), &SpineSlot::set_to_setup_pose);
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &SpineSlot::get_data);
|
||||
ClassDB::bind_method(D_METHOD("get_bone"), &SpineSlot::get_bone);
|
||||
ClassDB::bind_method(D_METHOD("get_color"), &SpineSlot::get_color);
|
||||
ClassDB::bind_method(D_METHOD("set_color"), &SpineSlot::set_color);
|
||||
ClassDB::bind_method(D_METHOD("get_dark_color"), &SpineSlot::get_dark_color);
|
||||
ClassDB::bind_method(D_METHOD("set_dark_color", "v"), &SpineSlot::set_dark_color);
|
||||
ClassDB::bind_method(D_METHOD("has_dark_color"), &SpineSlot::has_dark_color);
|
||||
ClassDB::bind_method(D_METHOD("get_attachment"), &SpineSlot::get_attachment);
|
||||
ClassDB::bind_method(D_METHOD("set_attachment", "v"), &SpineSlot::set_attachment);
|
||||
ClassDB::bind_method(D_METHOD("get_attachment_state"), &SpineSlot::get_attachment_state);
|
||||
ClassDB::bind_method(D_METHOD("set_attachment_state", "v"), &SpineSlot::set_attachment_state);
|
||||
ClassDB::bind_method(D_METHOD("get_deform"), &SpineSlot::get_deform);
|
||||
ClassDB::bind_method(D_METHOD("set_deform", "v"), &SpineSlot::set_deform);
|
||||
ClassDB::bind_method(D_METHOD("get_sequence_index"), &SpineSlot::get_sequence_index);
|
||||
ClassDB::bind_method(D_METHOD("set_sequence_index", "v"), &SpineSlot::set_sequence_index);
|
||||
ClassDB::bind_method(D_METHOD("get_pose"), &SpineSlot::get_pose);
|
||||
ClassDB::bind_method(D_METHOD("get_applied_pose"), &SpineSlot::get_applied_pose);
|
||||
}
|
||||
@ -85,88 +72,6 @@ Ref<SpineBone> SpineSlot::get_bone() {
|
||||
}
|
||||
}
|
||||
|
||||
Color SpineSlot::get_color() {
|
||||
SPINE_CHECK(get_spine_object(), Color(0, 0, 0, 0))
|
||||
auto &color = get_spine_object()->getAppliedPose().getColor();
|
||||
return Color(color.r, color.g, color.b, color.a);
|
||||
}
|
||||
|
||||
void SpineSlot::set_color(Color v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
auto &color = get_spine_object()->getPose().getColor();
|
||||
color.set(v.r, v.g, v.b, v.a);
|
||||
}
|
||||
|
||||
Color SpineSlot::get_dark_color() {
|
||||
SPINE_CHECK(get_spine_object(), Color(0, 0, 0, 0))
|
||||
auto &color = get_spine_object()->getAppliedPose().getDarkColor();
|
||||
return Color(color.r, color.g, color.b, color.a);
|
||||
}
|
||||
|
||||
void SpineSlot::set_dark_color(Color v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
auto &color = get_spine_object()->getPose().getDarkColor();
|
||||
color.set(v.r, v.g, v.b, v.a);
|
||||
}
|
||||
|
||||
bool SpineSlot::has_dark_color() {
|
||||
SPINE_CHECK(get_spine_object(), false)
|
||||
return get_spine_object()->getAppliedPose().hasDarkColor();
|
||||
}
|
||||
|
||||
Ref<SpineAttachment> SpineSlot::get_attachment() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto attachment = get_spine_object()->getAppliedPose().getAttachment();
|
||||
if (!attachment) return nullptr;
|
||||
Ref<SpineAttachment> attachment_ref(memnew(SpineAttachment));
|
||||
attachment_ref->set_spine_object(*get_spine_owner()->get_skeleton_data_res(), attachment);
|
||||
return attachment_ref;
|
||||
}
|
||||
|
||||
void SpineSlot::set_attachment(Ref<SpineAttachment> v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setAttachment(v.is_valid() && v->get_spine_object() ? v->get_spine_object() : nullptr);
|
||||
}
|
||||
|
||||
int SpineSlot::get_attachment_state() {
|
||||
// TODO: attachmentState is no longer exposed in the new API
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SpineSlot::set_attachment_state(int v){// TODO: attachmentState is no longer exposed in the new API
|
||||
SPINE_CHECK(get_spine_object(), )}
|
||||
|
||||
Array SpineSlot::get_deform() {
|
||||
Array result;
|
||||
SPINE_CHECK(get_spine_object(), result)
|
||||
auto &deform = get_spine_object()->getAppliedPose().getDeform();
|
||||
result.resize((int) deform.size());
|
||||
for (int i = 0; i < (int) deform.size(); ++i) {
|
||||
result[i] = deform[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void SpineSlot::set_deform(Array v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
auto &deform = get_spine_object()->getPose().getDeform();
|
||||
deform.setSize(v.size(), 0);
|
||||
for (int i = 0; i < v.size(); ++i) {
|
||||
deform[i] = v[i];
|
||||
}
|
||||
}
|
||||
|
||||
int SpineSlot::get_sequence_index() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getAppliedPose().getSequenceIndex();
|
||||
}
|
||||
|
||||
void SpineSlot::set_sequence_index(int v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->getPose().setSequenceIndex(v);
|
||||
}
|
||||
|
||||
Ref<SpineSlotPose> SpineSlot::get_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_object()->getPose();
|
||||
|
||||
@ -56,32 +56,6 @@ public:
|
||||
|
||||
Ref<SpineBone> get_bone();
|
||||
|
||||
Color get_color();
|
||||
|
||||
void set_color(Color v);
|
||||
|
||||
Color get_dark_color();
|
||||
|
||||
void set_dark_color(Color v);
|
||||
|
||||
bool has_dark_color();
|
||||
|
||||
Ref<SpineAttachment> get_attachment();
|
||||
|
||||
void set_attachment(Ref<SpineAttachment> v);
|
||||
|
||||
int get_attachment_state();
|
||||
|
||||
void set_attachment_state(int v);
|
||||
|
||||
Array get_deform();
|
||||
|
||||
void set_deform(Array v);
|
||||
|
||||
int get_sequence_index();
|
||||
|
||||
void set_sequence_index(int v);
|
||||
|
||||
Ref<SpineSlotPose> get_pose();
|
||||
|
||||
Ref<SpineSlotPose> get_applied_pose();
|
||||
|
||||
@ -45,16 +45,16 @@ void SpineTimeline::_bind_methods() {
|
||||
}
|
||||
|
||||
void SpineTimeline::apply(Ref<SpineSkeleton> skeleton, float last_time, float time, Array events, float alpha, SpineConstant::MixBlend blend,
|
||||
SpineConstant::MixDirection direction) {
|
||||
SpineConstant::MixDirection direction, bool applied_pose) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
if (!skeleton->get_spine_object()) return;
|
||||
spine::Vector<spine::Event *> spine_events;
|
||||
spine::Array<spine::Event *> spine_events;
|
||||
spine_events.setSize((int) events.size(), nullptr);
|
||||
for (int i = 0; i < events.size(); ++i) {
|
||||
events[i] = ((Ref<SpineEvent>) spine_events[i])->get_spine_object();
|
||||
}
|
||||
get_spine_object()->apply(*(skeleton->get_spine_object()), last_time, time, &spine_events, alpha, (spine::MixBlend) blend,
|
||||
(spine::MixDirection) direction);
|
||||
(spine::MixDirection) direction, applied_pose);
|
||||
}
|
||||
|
||||
int SpineTimeline::get_frame_entries() {
|
||||
|
||||
@ -46,7 +46,7 @@ protected:
|
||||
|
||||
public:
|
||||
void apply(Ref<SpineSkeleton> skeleton, float last_time, float time, Array events, float alpha, SpineConstant::MixBlend blend,
|
||||
SpineConstant::MixDirection direction);
|
||||
SpineConstant::MixDirection direction, bool applied_pose);
|
||||
|
||||
int get_frame_entries();
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SpineTransformConstraint.h"
|
||||
#include "SpineTransformConstraintPose.h"
|
||||
#include "SpineCommon.h"
|
||||
#include "SpineSkeleton.h"
|
||||
#include "SpineSprite.h"
|
||||
@ -36,20 +37,10 @@ void SpineTransformConstraint::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("update", "skeleton"), &SpineTransformConstraint::update);
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &SpineTransformConstraint::get_data);
|
||||
ClassDB::bind_method(D_METHOD("get_bones"), &SpineTransformConstraint::get_bones);
|
||||
ClassDB::bind_method(D_METHOD("get_target"), &SpineTransformConstraint::get_target);
|
||||
ClassDB::bind_method(D_METHOD("set_target", "v"), &SpineTransformConstraint::set_target);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_rotate"), &SpineTransformConstraint::get_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_rotate", "v"), &SpineTransformConstraint::set_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_x"), &SpineTransformConstraint::get_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_x", "v"), &SpineTransformConstraint::set_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_y"), &SpineTransformConstraint::get_mix_y);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_y", "v"), &SpineTransformConstraint::set_mix_y);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_scale_x"), &SpineTransformConstraint::get_mix_scale_x);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_scale_x", "v"), &SpineTransformConstraint::set_mix_scale_x);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_scale_y"), &SpineTransformConstraint::get_mix_scale_y);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_scale_y", "v"), &SpineTransformConstraint::set_mix_scale_y);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_shear_y"), &SpineTransformConstraint::get_mix_shear_y);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_shear_y", "v"), &SpineTransformConstraint::set_mix_shear_y);
|
||||
ClassDB::bind_method(D_METHOD("get_source"), &SpineTransformConstraint::get_source);
|
||||
ClassDB::bind_method(D_METHOD("set_source", "v"), &SpineTransformConstraint::set_source);
|
||||
ClassDB::bind_method(D_METHOD("get_pose"), &SpineTransformConstraint::get_pose);
|
||||
ClassDB::bind_method(D_METHOD("get_applied_pose"), &SpineTransformConstraint::get_applied_pose);
|
||||
ClassDB::bind_method(D_METHOD("is_active"), &SpineTransformConstraint::is_active);
|
||||
ClassDB::bind_method(D_METHOD("set_active", "v"), &SpineTransformConstraint::set_active);
|
||||
}
|
||||
@ -74,85 +65,43 @@ Array SpineTransformConstraint::get_bones() {
|
||||
result.resize((int) bones.size());
|
||||
for (int i = 0; i < bones.size(); ++i) {
|
||||
auto bone = bones[i];
|
||||
Ref<SpineBone> bone_ref(memnew(SpineBone));
|
||||
Ref<SpineBonePose> bone_ref(memnew(SpineBonePose));
|
||||
bone_ref->set_spine_object(get_spine_owner(), bone);
|
||||
result[i] = bone_ref;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Ref<SpineBone> SpineTransformConstraint::get_target() {
|
||||
Ref<SpineBone> SpineTransformConstraint::get_source() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto target = get_spine_object()->getTarget();
|
||||
if (!target) return nullptr;
|
||||
auto source = &get_spine_object()->getSource();
|
||||
if (!source) return nullptr;
|
||||
Ref<SpineBone> target_ref(memnew(SpineBone));
|
||||
target_ref->set_spine_object(get_spine_owner(), target);
|
||||
target_ref->set_spine_object(get_spine_owner(), source);
|
||||
return target_ref;
|
||||
}
|
||||
|
||||
void SpineTransformConstraint::set_target(Ref<SpineBone> v) {
|
||||
void SpineTransformConstraint::set_source(Ref<SpineBone> v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setTarget(v.is_valid() && v->get_spine_object() ? v->get_spine_object() : nullptr);
|
||||
if (v.is_valid() && v->get_spine_object()) {
|
||||
get_spine_object()->setSource(*v->get_spine_object());
|
||||
}
|
||||
}
|
||||
|
||||
float SpineTransformConstraint::get_mix_rotate() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixRotate();
|
||||
Ref<SpineTransformConstraintPose> SpineTransformConstraint::get_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_object()->getPose();
|
||||
Ref<SpineTransformConstraintPose> pose_ref(memnew(SpineTransformConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
void SpineTransformConstraint::set_mix_rotate(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixRotate(v);
|
||||
}
|
||||
|
||||
float SpineTransformConstraint::get_mix_x() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixX();
|
||||
}
|
||||
|
||||
void SpineTransformConstraint::set_mix_x(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixX(v);
|
||||
}
|
||||
|
||||
float SpineTransformConstraint::get_mix_y() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixY();
|
||||
}
|
||||
|
||||
void SpineTransformConstraint::set_mix_y(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixY(v);
|
||||
}
|
||||
|
||||
float SpineTransformConstraint::get_mix_scale_x() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixScaleX();
|
||||
}
|
||||
|
||||
void SpineTransformConstraint::set_mix_scale_x(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixScaleX(v);
|
||||
}
|
||||
|
||||
float SpineTransformConstraint::get_mix_scale_y() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixScaleY();
|
||||
}
|
||||
|
||||
void SpineTransformConstraint::set_mix_scale_y(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixScaleY(v);
|
||||
}
|
||||
|
||||
float SpineTransformConstraint::get_mix_shear_y() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixShearY();
|
||||
}
|
||||
|
||||
void SpineTransformConstraint::set_mix_shear_y(float v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixShearY(v);
|
||||
Ref<SpineTransformConstraintPose> SpineTransformConstraint::get_applied_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_object()->getAppliedPose();
|
||||
Ref<SpineTransformConstraintPose> pose_ref(memnew(SpineTransformConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
bool SpineTransformConstraint::is_active() {
|
||||
|
||||
@ -35,6 +35,8 @@
|
||||
#include "SpineBone.h"
|
||||
#include <spine/TransformConstraint.h>
|
||||
|
||||
class SpineTransformConstraintPose;
|
||||
|
||||
class SpineTransformConstraint : public SpineSpriteOwnedObject<spine::TransformConstraint> {
|
||||
GDCLASS(SpineTransformConstraint, SpineObjectWrapper)
|
||||
|
||||
@ -48,33 +50,13 @@ public:
|
||||
|
||||
Array get_bones();
|
||||
|
||||
Ref<SpineBone> get_target();
|
||||
Ref<SpineBone> get_source();
|
||||
|
||||
void set_target(Ref<SpineBone> v);
|
||||
void set_source(Ref<SpineBone> v);
|
||||
|
||||
float get_mix_rotate();
|
||||
Ref<SpineTransformConstraintPose> get_pose();
|
||||
|
||||
void set_mix_rotate(float v);
|
||||
|
||||
float get_mix_x();
|
||||
|
||||
void set_mix_x(float v);
|
||||
|
||||
float get_mix_y();
|
||||
|
||||
void set_mix_y(float v);
|
||||
|
||||
float get_mix_scale_x();
|
||||
|
||||
void set_mix_scale_x(float v);
|
||||
|
||||
float get_mix_scale_y();
|
||||
|
||||
void set_mix_scale_y(float v);
|
||||
|
||||
float get_mix_shear_y();
|
||||
|
||||
void set_mix_shear_y(float v);
|
||||
Ref<SpineTransformConstraintPose> get_applied_pose();
|
||||
|
||||
bool is_active();
|
||||
|
||||
|
||||
@ -28,23 +28,21 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SpineTransformConstraintData.h"
|
||||
#include "SpineTransformConstraintPose.h"
|
||||
#include "SpineCommon.h"
|
||||
|
||||
void SpineTransformConstraintData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_bones"), &SpineTransformConstraintData::get_bones);
|
||||
ClassDB::bind_method(D_METHOD("get_target"), &SpineTransformConstraintData::get_target);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_rotate"), &SpineTransformConstraintData::get_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_x"), &SpineTransformConstraintData::get_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_y"), &SpineTransformConstraintData::get_mix_y);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_scale_x"), &SpineTransformConstraintData::get_mix_scale_x);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_scale_y"), &SpineTransformConstraintData::get_mix_scale_y);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_shear_y"), &SpineTransformConstraintData::get_mix_shear_y);
|
||||
ClassDB::bind_method(D_METHOD("get_source"), &SpineTransformConstraintData::get_source);
|
||||
ClassDB::bind_method(D_METHOD("get_offset_rotation"), &SpineTransformConstraintData::get_offset_rotation);
|
||||
ClassDB::bind_method(D_METHOD("get_offset_x"), &SpineTransformConstraintData::get_offset_x);
|
||||
ClassDB::bind_method(D_METHOD("get_offset_y"), &SpineTransformConstraintData::get_offset_y);
|
||||
ClassDB::bind_method(D_METHOD("get_offset_scale_x"), &SpineTransformConstraintData::get_offset_scale_x);
|
||||
ClassDB::bind_method(D_METHOD("get_offset_scale_y"), &SpineTransformConstraintData::get_offset_scale_y);
|
||||
ClassDB::bind_method(D_METHOD("get_offset_shear_y"), &SpineTransformConstraintData::get_offset_shear_y);
|
||||
ClassDB::bind_method(D_METHOD("is_relative"), &SpineTransformConstraintData::is_relative);
|
||||
ClassDB::bind_method(D_METHOD("is_local"), &SpineTransformConstraintData::is_local);
|
||||
ClassDB::bind_method(D_METHOD("get_setup_pose"), &SpineTransformConstraintData::get_setup_pose);
|
||||
}
|
||||
|
||||
Array SpineTransformConstraintData::get_bones() {
|
||||
@ -60,45 +58,15 @@ Array SpineTransformConstraintData::get_bones() {
|
||||
return result;
|
||||
}
|
||||
|
||||
Ref<SpineBoneData> SpineTransformConstraintData::get_target() {
|
||||
Ref<SpineBoneData> SpineTransformConstraintData::get_source() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), nullptr)
|
||||
auto bone = get_spine_constraint_data()->getTarget();
|
||||
auto bone = &get_spine_constraint_data()->getSource();
|
||||
if (!bone) return nullptr;
|
||||
Ref<SpineBoneData> slot_ref(memnew(SpineBoneData));
|
||||
slot_ref->set_spine_object(get_spine_owner(), bone);
|
||||
return slot_ref;
|
||||
}
|
||||
|
||||
float SpineTransformConstraintData::get_mix_rotate() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMixRotate();
|
||||
}
|
||||
|
||||
float SpineTransformConstraintData::get_mix_x() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMixX();
|
||||
}
|
||||
|
||||
float SpineTransformConstraintData::get_mix_y() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMixY();
|
||||
}
|
||||
|
||||
float SpineTransformConstraintData::get_mix_scale_x() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMixScaleX();
|
||||
}
|
||||
|
||||
float SpineTransformConstraintData::get_mix_scale_y() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMixScaleY();
|
||||
}
|
||||
|
||||
float SpineTransformConstraintData::get_mix_shear_y() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getSetupPose().getMixShearY();
|
||||
}
|
||||
|
||||
float SpineTransformConstraintData::get_offset_rotation() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getOffsetRotation();
|
||||
@ -128,3 +96,21 @@ float SpineTransformConstraintData::get_offset_shear_y() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), 0)
|
||||
return get_spine_constraint_data()->getOffsetShearY();
|
||||
}
|
||||
|
||||
bool SpineTransformConstraintData::is_relative() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), false)
|
||||
return get_spine_constraint_data()->getRelative();
|
||||
}
|
||||
|
||||
bool SpineTransformConstraintData::is_local() {
|
||||
SPINE_CHECK(get_spine_constraint_data(), false)
|
||||
return get_spine_constraint_data()->getLocal();
|
||||
}
|
||||
|
||||
Ref<SpineTransformConstraintPose> SpineTransformConstraintData::get_setup_pose() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
auto &pose = get_spine_constraint_data()->getSetupPose();
|
||||
Ref<SpineTransformConstraintPose> pose_ref(memnew(SpineTransformConstraintPose));
|
||||
pose_ref->set_spine_object(get_spine_owner(), &pose);
|
||||
return pose_ref;
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
#include "SpineBoneData.h"
|
||||
#include <spine/TransformConstraintData.h>
|
||||
|
||||
class SpineTransformConstraintPose;
|
||||
|
||||
class SpineTransformConstraintData : public SpineConstraintData {
|
||||
GDCLASS(SpineTransformConstraintData, SpineConstraintData)
|
||||
|
||||
@ -46,19 +48,7 @@ protected:
|
||||
public:
|
||||
Array get_bones();
|
||||
|
||||
Ref<SpineBoneData> get_target();
|
||||
|
||||
float get_mix_rotate();
|
||||
|
||||
float get_mix_x();
|
||||
|
||||
float get_mix_y();
|
||||
|
||||
float get_mix_scale_x();
|
||||
|
||||
float get_mix_scale_y();
|
||||
|
||||
float get_mix_shear_y();
|
||||
Ref<SpineBoneData> get_source();
|
||||
|
||||
float get_offset_rotation();
|
||||
|
||||
@ -75,4 +65,6 @@ public:
|
||||
bool is_relative();
|
||||
|
||||
bool is_local();
|
||||
|
||||
Ref<SpineTransformConstraintPose> get_setup_pose();
|
||||
};
|
||||
|
||||
106
spine-godot/spine_godot/SpineTransformConstraintPose.cpp
Normal file
106
spine-godot/spine_godot/SpineTransformConstraintPose.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, 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 "SpineTransformConstraintPose.h"
|
||||
#include "SpineCommon.h"
|
||||
|
||||
void SpineTransformConstraintPose::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_mix_rotate"), &SpineTransformConstraintPose::get_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_rotate", "value"), &SpineTransformConstraintPose::set_mix_rotate);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_x"), &SpineTransformConstraintPose::get_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_x", "value"), &SpineTransformConstraintPose::set_mix_x);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_y"), &SpineTransformConstraintPose::get_mix_y);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_y", "value"), &SpineTransformConstraintPose::set_mix_y);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_scale_x"), &SpineTransformConstraintPose::get_mix_scale_x);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_scale_x", "value"), &SpineTransformConstraintPose::set_mix_scale_x);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_scale_y"), &SpineTransformConstraintPose::get_mix_scale_y);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_scale_y", "value"), &SpineTransformConstraintPose::set_mix_scale_y);
|
||||
ClassDB::bind_method(D_METHOD("get_mix_shear_y"), &SpineTransformConstraintPose::get_mix_shear_y);
|
||||
ClassDB::bind_method(D_METHOD("set_mix_shear_y", "value"), &SpineTransformConstraintPose::set_mix_shear_y);
|
||||
}
|
||||
|
||||
float SpineTransformConstraintPose::get_mix_rotate() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixRotate();
|
||||
}
|
||||
|
||||
void SpineTransformConstraintPose::set_mix_rotate(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixRotate(value);
|
||||
}
|
||||
|
||||
float SpineTransformConstraintPose::get_mix_x() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixX();
|
||||
}
|
||||
|
||||
void SpineTransformConstraintPose::set_mix_x(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixX(value);
|
||||
}
|
||||
|
||||
float SpineTransformConstraintPose::get_mix_y() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixY();
|
||||
}
|
||||
|
||||
void SpineTransformConstraintPose::set_mix_y(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixY(value);
|
||||
}
|
||||
|
||||
float SpineTransformConstraintPose::get_mix_scale_x() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixScaleX();
|
||||
}
|
||||
|
||||
void SpineTransformConstraintPose::set_mix_scale_x(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixScaleX(value);
|
||||
}
|
||||
|
||||
float SpineTransformConstraintPose::get_mix_scale_y() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixScaleY();
|
||||
}
|
||||
|
||||
void SpineTransformConstraintPose::set_mix_scale_y(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixScaleY(value);
|
||||
}
|
||||
|
||||
float SpineTransformConstraintPose::get_mix_shear_y() {
|
||||
SPINE_CHECK(get_spine_object(), 0)
|
||||
return get_spine_object()->getMixShearY();
|
||||
}
|
||||
|
||||
void SpineTransformConstraintPose::set_mix_shear_y(float value) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setMixShearY(value);
|
||||
}
|
||||
71
spine-godot/spine_godot/SpineTransformConstraintPose.h
Normal file
71
spine-godot/spine_godot/SpineTransformConstraintPose.h
Normal file
@ -0,0 +1,71 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SpineCommon.h"
|
||||
#include "spine-cpp/include/spine/TransformConstraintPose.h"
|
||||
#include <spine/TransformConstraintPose.h>
|
||||
|
||||
class SpineSprite;
|
||||
|
||||
class SpineTransformConstraintPose : public SpineObjectWrapper {
|
||||
GDCLASS(SpineTransformConstraintPose, SpineObjectWrapper)
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
// Can be used by both SpineSprite and SpineSkeletonDataResource
|
||||
void set_spine_object(void *owner, spine::TransformConstraintPose *object) {
|
||||
_set_spine_object_internal(owner, object);
|
||||
}
|
||||
|
||||
spine::TransformConstraintPose *get_spine_object() {
|
||||
return (spine::TransformConstraintPose *) _get_spine_object_internal();
|
||||
}
|
||||
|
||||
float get_mix_rotate();
|
||||
void set_mix_rotate(float value);
|
||||
|
||||
float get_mix_x();
|
||||
void set_mix_x(float value);
|
||||
|
||||
float get_mix_y();
|
||||
void set_mix_y(float value);
|
||||
|
||||
float get_mix_scale_x();
|
||||
void set_mix_scale_x(float value);
|
||||
|
||||
float get_mix_scale_y();
|
||||
void set_mix_scale_y(float value);
|
||||
|
||||
float get_mix_shear_y();
|
||||
void set_mix_shear_y(float value);
|
||||
};
|
||||
@ -52,9 +52,18 @@
|
||||
#include "SpineConstraintData.h"
|
||||
#include "SpineSkin.h"
|
||||
#include "SpineIkConstraintData.h"
|
||||
#include "SpineIkConstraint.h"
|
||||
#include "SpineIkConstraintPose.h"
|
||||
#include "SpineTransformConstraintData.h"
|
||||
#include "SpineTransformConstraint.h"
|
||||
#include "SpineTransformConstraintPose.h"
|
||||
#include "SpinePathConstraintData.h"
|
||||
#include "SpinePathConstraint.h"
|
||||
#include "SpinePathConstraintPose.h"
|
||||
#include "SpinePhysicsConstraintData.h"
|
||||
#include "SpinePhysicsConstraint.h"
|
||||
#include "SpinePhysicsConstraintPose.h"
|
||||
#include "SpineSliderPose.h"
|
||||
#include "SpineTimeline.h"
|
||||
#include "SpineConstant.h"
|
||||
#include "SpineSlotNode.h"
|
||||
@ -147,9 +156,14 @@ void register_spine_godot_types() {
|
||||
GDREGISTER_CLASS(SpineBonePose);
|
||||
GDREGISTER_CLASS(SpineSlot);
|
||||
GDREGISTER_CLASS(SpineIkConstraint);
|
||||
GDREGISTER_CLASS(SpineIkConstraintPose);
|
||||
GDREGISTER_CLASS(SpinePathConstraint);
|
||||
GDREGISTER_CLASS(SpinePathConstraintPose);
|
||||
GDREGISTER_CLASS(SpineTransformConstraint);
|
||||
GDREGISTER_CLASS(SpineTransformConstraintPose);
|
||||
GDREGISTER_CLASS(SpinePhysicsConstraint);
|
||||
GDREGISTER_CLASS(SpinePhysicsConstraintPose);
|
||||
GDREGISTER_CLASS(SpineSliderPose);
|
||||
GDREGISTER_CLASS(SpineTimeline);
|
||||
GDREGISTER_CLASS(SpineConstant);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user