/****************************************************************************** * 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 "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("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); ClassDB::bind_method(D_METHOD("is_mass_global"), &SpinePhysicsConstraintData::is_mass_global); 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); } Ref SpinePhysicsConstraintData::get_bone() { SPINE_CHECK(get_spine_constraint_data(), nullptr) auto bone = &get_spine_constraint_data()->getBone(); if (!bone) return nullptr; Ref slot_ref(memnew(SpineBoneData)); slot_ref->set_spine_object(get_spine_owner(), bone); return slot_ref; } float SpinePhysicsConstraintData::get_scale_x() { SPINE_CHECK(get_spine_constraint_data(), 0) return get_spine_constraint_data()->getScaleX(); } float SpinePhysicsConstraintData::get_shear_x() { SPINE_CHECK(get_spine_constraint_data(), 0) return get_spine_constraint_data()->getShearX(); } float SpinePhysicsConstraintData::get_limit() { SPINE_CHECK(get_spine_constraint_data(), 0) return get_spine_constraint_data()->getLimit(); } float SpinePhysicsConstraintData::get_step() { SPINE_CHECK(get_spine_constraint_data(), 0) return get_spine_constraint_data()->getStep(); } float SpinePhysicsConstraintData::get_x() { SPINE_CHECK(get_spine_constraint_data(), 0) return get_spine_constraint_data()->getX(); } float SpinePhysicsConstraintData::get_y() { SPINE_CHECK(get_spine_constraint_data(), 0) return get_spine_constraint_data()->getY(); } float SpinePhysicsConstraintData::get_rotate() { SPINE_CHECK(get_spine_constraint_data(), 0) return get_spine_constraint_data()->getRotate(); } bool SpinePhysicsConstraintData::is_inertia_global() { SPINE_CHECK(get_spine_constraint_data(), false) return get_spine_constraint_data()->getInertiaGlobal(); } bool SpinePhysicsConstraintData::is_strength_global() { SPINE_CHECK(get_spine_constraint_data(), false) return get_spine_constraint_data()->getStrengthGlobal(); } bool SpinePhysicsConstraintData::is_damping_global() { SPINE_CHECK(get_spine_constraint_data(), false) return get_spine_constraint_data()->getDampingGlobal(); } bool SpinePhysicsConstraintData::is_mass_global() { SPINE_CHECK(get_spine_constraint_data(), false) return get_spine_constraint_data()->getMassGlobal(); } bool SpinePhysicsConstraintData::is_wind_global() { SPINE_CHECK(get_spine_constraint_data(), false) return get_spine_constraint_data()->getWindGlobal(); } bool SpinePhysicsConstraintData::is_gravity_global() { SPINE_CHECK(get_spine_constraint_data(), false) return get_spine_constraint_data()->getGravityGlobal(); } bool SpinePhysicsConstraintData::is_mix_global() { SPINE_CHECK(get_spine_constraint_data(), false) return get_spine_constraint_data()->getMixGlobal(); } Ref SpinePhysicsConstraintData::get_setup_pose() { SPINE_CHECK(get_spine_object(), nullptr) auto &pose = get_spine_constraint_data()->getSetupPose(); Ref pose_ref(memnew(SpinePhysicsConstraintPose)); pose_ref->set_spine_object(get_spine_owner(), &pose); return pose_ref; }