feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
16
engine/scene/resources/2d/skeleton/SCsub
Normal file
16
engine/scene/resources/2d/skeleton/SCsub
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
from misc.utility.scons_hints import *
|
||||
|
||||
Import("env")
|
||||
|
||||
env.add_source_files(env.scene_sources, "skeleton_modification_2d.cpp")
|
||||
env.add_source_files(env.scene_sources, "skeleton_modification_2d_ccdik.cpp")
|
||||
env.add_source_files(env.scene_sources, "skeleton_modification_2d_fabrik.cpp")
|
||||
env.add_source_files(env.scene_sources, "skeleton_modification_2d_lookat.cpp")
|
||||
env.add_source_files(env.scene_sources, "skeleton_modification_2d_stackholder.cpp")
|
||||
env.add_source_files(env.scene_sources, "skeleton_modification_2d_twoboneik.cpp")
|
||||
env.add_source_files(env.scene_sources, "skeleton_modification_stack_2d.cpp")
|
||||
|
||||
if not env["disable_physics_2d"]:
|
||||
env.add_source_files(env.scene_sources, "skeleton_modification_2d_jiggle.cpp")
|
||||
env.add_source_files(env.scene_sources, "skeleton_modification_2d_physicalbones.cpp")
|
||||
|
|
@ -81,15 +81,15 @@ bool SkeletonModification2D::get_enabled() {
|
|||
float SkeletonModification2D::clamp_angle(float p_angle, float p_min_bound, float p_max_bound, bool p_invert) {
|
||||
// Map to the 0 to 360 range (in radians though) instead of the -180 to 180 range.
|
||||
if (p_angle < 0) {
|
||||
p_angle = Math_TAU + p_angle;
|
||||
p_angle = Math::TAU + p_angle;
|
||||
}
|
||||
|
||||
// Make min and max in the range of 0 to 360 (in radians), and make sure they are in the right order
|
||||
if (p_min_bound < 0) {
|
||||
p_min_bound = Math_TAU + p_min_bound;
|
||||
p_min_bound = Math::TAU + p_min_bound;
|
||||
}
|
||||
if (p_max_bound < 0) {
|
||||
p_max_bound = Math_TAU + p_max_bound;
|
||||
p_max_bound = Math::TAU + p_max_bound;
|
||||
}
|
||||
if (p_min_bound > p_max_bound) {
|
||||
SWAP(p_min_bound, p_max_bound);
|
||||
|
|
@ -130,10 +130,10 @@ void SkeletonModification2D::editor_draw_angle_constraints(Bone2D *p_operation_b
|
|||
float arc_angle_min = p_min_bound;
|
||||
float arc_angle_max = p_max_bound;
|
||||
if (arc_angle_min < 0) {
|
||||
arc_angle_min = (Math_PI * 2) + arc_angle_min;
|
||||
arc_angle_min = (Math::PI * 2) + arc_angle_min;
|
||||
}
|
||||
if (arc_angle_max < 0) {
|
||||
arc_angle_max = (Math_PI * 2) + arc_angle_max;
|
||||
arc_angle_max = (Math::PI * 2) + arc_angle_max;
|
||||
}
|
||||
if (arc_angle_min > arc_angle_max) {
|
||||
SWAP(arc_angle_min, arc_angle_max);
|
||||
|
|
@ -159,7 +159,7 @@ void SkeletonModification2D::editor_draw_angle_constraints(Bone2D *p_operation_b
|
|||
|
||||
if (p_constraint_inverted) {
|
||||
stack->skeleton->draw_arc(Vector2(0, 0), p_operation_bone->get_length(),
|
||||
arc_angle_min + (Math_PI * 2), arc_angle_max, 32, bone_ik_color, 1.0);
|
||||
arc_angle_min + (Math::PI * 2), arc_angle_max, 32, bone_ik_color, 1.0);
|
||||
} else {
|
||||
stack->skeleton->draw_arc(Vector2(0, 0), p_operation_bone->get_length(),
|
||||
arc_angle_min, arc_angle_max, 32, bone_ik_color, 1.0);
|
||||
|
|
@ -169,7 +169,7 @@ void SkeletonModification2D::editor_draw_angle_constraints(Bone2D *p_operation_b
|
|||
|
||||
} else {
|
||||
stack->skeleton->draw_set_transform(stack->skeleton->to_local(p_operation_bone->get_global_position()));
|
||||
stack->skeleton->draw_arc(Vector2(0, 0), p_operation_bone->get_length(), 0, Math_PI * 2, 32, bone_ik_color, 1.0);
|
||||
stack->skeleton->draw_arc(Vector2(0, 0), p_operation_bone->get_length(), 0, Math::PI * 2, 32, bone_ik_color, 1.0);
|
||||
stack->skeleton->draw_line(Vector2(0, 0), Vector2(1, 0) * p_operation_bone->get_length(), bone_ik_color, 1.0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SKELETON_MODIFICATION_2D_H
|
||||
#define SKELETON_MODIFICATION_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/2d/skeleton/skeleton_modification_stack_2d.h"
|
||||
|
||||
|
|
@ -85,5 +84,3 @@ public:
|
|||
|
||||
SkeletonModification2D();
|
||||
};
|
||||
|
||||
#endif // SKELETON_MODIFICATION_2D_H
|
||||
|
|
|
|||
|
|
@ -171,13 +171,13 @@ void SkeletonModification2DCCDIK::_execute(float p_delta) {
|
|||
return;
|
||||
}
|
||||
|
||||
Node2D *target = Object::cast_to<Node2D>(ObjectDB::get_instance(target_node_cache));
|
||||
Node2D *target = ObjectDB::get_instance<Node2D>(target_node_cache);
|
||||
if (!target || !target->is_inside_tree()) {
|
||||
ERR_PRINT_ONCE("Target node is not in the scene tree. Cannot execute modification!");
|
||||
return;
|
||||
}
|
||||
|
||||
Node2D *tip = Object::cast_to<Node2D>(ObjectDB::get_instance(tip_node_cache));
|
||||
Node2D *tip = ObjectDB::get_instance<Node2D>(tip_node_cache);
|
||||
if (!tip || !tip->is_inside_tree()) {
|
||||
ERR_PRINT_ONCE("Tip node is not in the scene tree. Cannot execute modification!");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SKELETON_MODIFICATION_2D_CCDIK_H
|
||||
#define SKELETON_MODIFICATION_2D_CCDIK_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/skeleton_2d.h"
|
||||
#include "scene/resources/2d/skeleton/skeleton_modification_2d.h"
|
||||
|
|
@ -50,7 +49,7 @@ private:
|
|||
|
||||
bool enable_constraint = false;
|
||||
float constraint_angle_min = 0;
|
||||
float constraint_angle_max = (2.0 * Math_PI);
|
||||
float constraint_angle_max = (2.0 * Math::PI);
|
||||
bool constraint_angle_invert = false;
|
||||
bool constraint_in_localspace = true;
|
||||
|
||||
|
|
@ -112,5 +111,3 @@ public:
|
|||
SkeletonModification2DCCDIK();
|
||||
~SkeletonModification2DCCDIK();
|
||||
};
|
||||
|
||||
#endif // SKELETON_MODIFICATION_2D_CCDIK_H
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ void SkeletonModification2DFABRIK::_execute(float p_delta) {
|
|||
return;
|
||||
}
|
||||
|
||||
Node2D *target = Object::cast_to<Node2D>(ObjectDB::get_instance(target_node_cache));
|
||||
Node2D *target = ObjectDB::get_instance<Node2D>(target_node_cache);
|
||||
if (!target || !target->is_inside_tree()) {
|
||||
ERR_PRINT_ONCE("Target node is not in the scene tree. Cannot execute modification!");
|
||||
return;
|
||||
|
|
@ -128,7 +128,7 @@ void SkeletonModification2DFABRIK::_execute(float p_delta) {
|
|||
WARN_PRINT("Bone2D cache for origin joint is out of date. Updating...");
|
||||
}
|
||||
|
||||
Bone2D *origin_bone2d_node = Object::cast_to<Bone2D>(ObjectDB::get_instance(fabrik_data_chain[0].bone2d_node_cache));
|
||||
Bone2D *origin_bone2d_node = ObjectDB::get_instance<Bone2D>(fabrik_data_chain[0].bone2d_node_cache);
|
||||
if (!origin_bone2d_node || !origin_bone2d_node->is_inside_tree()) {
|
||||
ERR_PRINT_ONCE("Origin joint's Bone2D node is not in the scene tree. Cannot execute modification!");
|
||||
return;
|
||||
|
|
@ -146,7 +146,7 @@ void SkeletonModification2DFABRIK::_execute(float p_delta) {
|
|||
WARN_PRINT_ONCE("Bone2D cache for joint " + itos(i) + " is out of date.. Attempting to update...");
|
||||
fabrik_joint_update_bone2d_cache(i);
|
||||
}
|
||||
Bone2D *joint_bone2d_node = Object::cast_to<Bone2D>(ObjectDB::get_instance(fabrik_data_chain[i].bone2d_node_cache));
|
||||
Bone2D *joint_bone2d_node = ObjectDB::get_instance<Bone2D>(fabrik_data_chain[i].bone2d_node_cache);
|
||||
if (!joint_bone2d_node) {
|
||||
ERR_PRINT_ONCE("FABRIK Joint " + itos(i) + " does not have a Bone2D node set! Cannot execute modification!");
|
||||
return;
|
||||
|
|
@ -154,7 +154,7 @@ void SkeletonModification2DFABRIK::_execute(float p_delta) {
|
|||
fabrik_transform_chain.write[i] = joint_bone2d_node->get_global_transform();
|
||||
}
|
||||
|
||||
Bone2D *final_bone2d_node = Object::cast_to<Bone2D>(ObjectDB::get_instance(fabrik_data_chain[fabrik_data_chain.size() - 1].bone2d_node_cache));
|
||||
Bone2D *final_bone2d_node = ObjectDB::get_instance<Bone2D>(fabrik_data_chain[fabrik_data_chain.size() - 1].bone2d_node_cache);
|
||||
float final_bone2d_angle = final_bone2d_node->get_global_rotation();
|
||||
if (fabrik_data_chain[fabrik_data_chain.size() - 1].use_target_rotation) {
|
||||
final_bone2d_angle = target_global_pose.get_rotation();
|
||||
|
|
@ -183,7 +183,7 @@ void SkeletonModification2DFABRIK::_execute(float p_delta) {
|
|||
|
||||
// Apply all of the saved transforms to the Bone2D nodes
|
||||
for (int i = 0; i < fabrik_data_chain.size(); i++) {
|
||||
Bone2D *joint_bone2d_node = Object::cast_to<Bone2D>(ObjectDB::get_instance(fabrik_data_chain[i].bone2d_node_cache));
|
||||
Bone2D *joint_bone2d_node = ObjectDB::get_instance<Bone2D>(fabrik_data_chain[i].bone2d_node_cache);
|
||||
if (!joint_bone2d_node) {
|
||||
ERR_PRINT_ONCE("FABRIK Joint " + itos(i) + " does not have a Bone2D node set!");
|
||||
continue;
|
||||
|
|
@ -214,7 +214,7 @@ void SkeletonModification2DFABRIK::_execute(float p_delta) {
|
|||
|
||||
void SkeletonModification2DFABRIK::chain_backwards() {
|
||||
int final_joint_index = fabrik_data_chain.size() - 1;
|
||||
Bone2D *final_bone2d_node = Object::cast_to<Bone2D>(ObjectDB::get_instance(fabrik_data_chain[final_joint_index].bone2d_node_cache));
|
||||
Bone2D *final_bone2d_node = ObjectDB::get_instance<Bone2D>(fabrik_data_chain[final_joint_index].bone2d_node_cache);
|
||||
Transform2D final_bone2d_trans = fabrik_transform_chain[final_joint_index];
|
||||
|
||||
// Apply magnet position
|
||||
|
|
@ -241,7 +241,7 @@ void SkeletonModification2DFABRIK::chain_backwards() {
|
|||
while (i >= 1) {
|
||||
Transform2D previous_pose = fabrik_transform_chain[i];
|
||||
i -= 1;
|
||||
Bone2D *current_bone2d_node = Object::cast_to<Bone2D>(ObjectDB::get_instance(fabrik_data_chain[i].bone2d_node_cache));
|
||||
Bone2D *current_bone2d_node = ObjectDB::get_instance<Bone2D>(fabrik_data_chain[i].bone2d_node_cache);
|
||||
Transform2D current_pose = fabrik_transform_chain[i];
|
||||
|
||||
// Apply magnet position
|
||||
|
|
@ -266,7 +266,7 @@ void SkeletonModification2DFABRIK::chain_forwards() {
|
|||
fabrik_transform_chain.write[0] = origin_bone2d_trans;
|
||||
|
||||
for (int i = 0; i < fabrik_data_chain.size() - 1; i++) {
|
||||
Bone2D *current_bone2d_node = Object::cast_to<Bone2D>(ObjectDB::get_instance(fabrik_data_chain[i].bone2d_node_cache));
|
||||
Bone2D *current_bone2d_node = ObjectDB::get_instance<Bone2D>(fabrik_data_chain[i].bone2d_node_cache);
|
||||
Transform2D current_pose = fabrik_transform_chain[i];
|
||||
Transform2D next_pose = fabrik_transform_chain[i + 1];
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SKELETON_MODIFICATION_2D_FABRIK_H
|
||||
#define SKELETON_MODIFICATION_2D_FABRIK_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/skeleton_2d.h"
|
||||
#include "scene/resources/2d/skeleton/skeleton_modification_2d.h"
|
||||
|
|
@ -104,5 +103,3 @@ public:
|
|||
SkeletonModification2DFABRIK();
|
||||
~SkeletonModification2DFABRIK();
|
||||
};
|
||||
|
||||
#endif // SKELETON_MODIFICATION_2D_FABRIK_H
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ void SkeletonModification2DJiggle::_execute(float p_delta) {
|
|||
update_target_cache();
|
||||
return;
|
||||
}
|
||||
Node2D *target = Object::cast_to<Node2D>(ObjectDB::get_instance(target_node_cache));
|
||||
Node2D *target = ObjectDB::get_instance<Node2D>(target_node_cache);
|
||||
if (!target || !target->is_inside_tree()) {
|
||||
ERR_PRINT_ONCE("Target node is not in the scene tree. Cannot execute modification!");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SKELETON_MODIFICATION_2D_JIGGLE_H
|
||||
#define SKELETON_MODIFICATION_2D_JIGGLE_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/skeleton_2d.h"
|
||||
#include "scene/resources/2d/skeleton/skeleton_modification_2d.h"
|
||||
|
|
@ -135,5 +134,3 @@ public:
|
|||
SkeletonModification2DJiggle();
|
||||
~SkeletonModification2DJiggle();
|
||||
};
|
||||
|
||||
#endif // SKELETON_MODIFICATION_2D_JIGGLE_H
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ void SkeletonModification2DLookAt::_execute(float p_delta) {
|
|||
}
|
||||
|
||||
if (target_node_reference == nullptr) {
|
||||
target_node_reference = Object::cast_to<Node2D>(ObjectDB::get_instance(target_node_cache));
|
||||
target_node_reference = ObjectDB::get_instance<Node2D>(target_node_cache);
|
||||
}
|
||||
if (!target_node_reference || !target_node_reference->is_inside_tree()) {
|
||||
ERR_PRINT_ONCE("Target node is not in the scene tree. Cannot execute modification!");
|
||||
|
|
@ -399,7 +399,7 @@ SkeletonModification2DLookAt::SkeletonModification2DLookAt() {
|
|||
additional_rotation = 0;
|
||||
enable_constraint = false;
|
||||
constraint_angle_min = 0;
|
||||
constraint_angle_max = Math_PI * 2;
|
||||
constraint_angle_max = Math::PI * 2;
|
||||
constraint_angle_invert = false;
|
||||
enabled = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SKELETON_MODIFICATION_2D_LOOKAT_H
|
||||
#define SKELETON_MODIFICATION_2D_LOOKAT_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/skeleton_2d.h"
|
||||
#include "scene/resources/2d/skeleton/skeleton_modification_2d.h"
|
||||
|
|
@ -53,7 +52,7 @@ private:
|
|||
float additional_rotation = 0;
|
||||
bool enable_constraint = false;
|
||||
float constraint_angle_min = 0;
|
||||
float constraint_angle_max = (2.0 * Math_PI);
|
||||
float constraint_angle_max = (2.0 * Math::PI);
|
||||
bool constraint_angle_invert = false;
|
||||
bool constraint_in_localspace = true;
|
||||
|
||||
|
|
@ -96,5 +95,3 @@ public:
|
|||
SkeletonModification2DLookAt();
|
||||
~SkeletonModification2DLookAt();
|
||||
};
|
||||
|
||||
#endif // SKELETON_MODIFICATION_2D_LOOKAT_H
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ void SkeletonModification2DPhysicalBones::_execute(float p_delta) {
|
|||
continue;
|
||||
}
|
||||
|
||||
PhysicalBone2D *physical_bone = Object::cast_to<PhysicalBone2D>(ObjectDB::get_instance(bone_data.physical_bone_node_cache));
|
||||
PhysicalBone2D *physical_bone = ObjectDB::get_instance<PhysicalBone2D>(bone_data.physical_bone_node_cache);
|
||||
if (!physical_bone) {
|
||||
ERR_PRINT_ONCE("PhysicalBone2D not found at index " + itos(i) + "!");
|
||||
return;
|
||||
|
|
@ -238,7 +238,7 @@ void SkeletonModification2DPhysicalBones::_update_simulation_state() {
|
|||
}
|
||||
_simulation_state_dirty = false;
|
||||
|
||||
if (_simulation_state_dirty_names.size() <= 0) {
|
||||
if (_simulation_state_dirty_names.is_empty()) {
|
||||
for (int i = 0; i < physical_bone_chain.size(); i++) {
|
||||
PhysicalBone2D *physical_bone = Object::cast_to<PhysicalBone2D>(stack->skeleton->get_node(physical_bone_chain[i].physical_bone_node));
|
||||
if (!physical_bone) {
|
||||
|
|
@ -249,7 +249,7 @@ void SkeletonModification2DPhysicalBones::_update_simulation_state() {
|
|||
}
|
||||
} else {
|
||||
for (int i = 0; i < physical_bone_chain.size(); i++) {
|
||||
PhysicalBone2D *physical_bone = Object::cast_to<PhysicalBone2D>(ObjectDB::get_instance(physical_bone_chain[i].physical_bone_node_cache));
|
||||
PhysicalBone2D *physical_bone = ObjectDB::get_instance<PhysicalBone2D>(physical_bone_chain[i].physical_bone_node_cache);
|
||||
if (!physical_bone) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SKELETON_MODIFICATION_2D_PHYSICALBONES_H
|
||||
#define SKELETON_MODIFICATION_2D_PHYSICALBONES_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/skeleton_2d.h"
|
||||
#include "scene/resources/2d/skeleton/skeleton_modification_2d.h"
|
||||
|
|
@ -78,5 +77,3 @@ public:
|
|||
SkeletonModification2DPhysicalBones();
|
||||
~SkeletonModification2DPhysicalBones();
|
||||
};
|
||||
|
||||
#endif // SKELETON_MODIFICATION_2D_PHYSICALBONES_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SKELETON_MODIFICATION_2D_STACKHOLDER_H
|
||||
#define SKELETON_MODIFICATION_2D_STACKHOLDER_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/skeleton_2d.h"
|
||||
#include "scene/resources/2d/skeleton/skeleton_modification_2d.h"
|
||||
|
|
@ -60,5 +59,3 @@ public:
|
|||
SkeletonModification2DStackHolder();
|
||||
~SkeletonModification2DStackHolder();
|
||||
};
|
||||
|
||||
#endif // SKELETON_MODIFICATION_2D_STACKHOLDER_H
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ void SkeletonModification2DTwoBoneIK::_execute(float p_delta) {
|
|||
update_joint_two_bone2d_cache();
|
||||
}
|
||||
|
||||
Node2D *target = Object::cast_to<Node2D>(ObjectDB::get_instance(target_node_cache));
|
||||
Node2D *target = ObjectDB::get_instance<Node2D>(target_node_cache);
|
||||
if (!target || !target->is_inside_tree()) {
|
||||
ERR_PRINT_ONCE("Target node is not in the scene tree. Cannot execute modification!");
|
||||
return;
|
||||
|
|
@ -178,7 +178,7 @@ void SkeletonModification2DTwoBoneIK::_execute(float p_delta) {
|
|||
// We cannot solve for this angle! Do nothing to avoid setting the rotation (and scale) to NaN.
|
||||
} else {
|
||||
joint_one_bone->set_global_rotation(angle_atan - angle_0 - joint_one_bone->get_bone_angle());
|
||||
joint_two_bone->set_rotation(-Math_PI - angle_1 - joint_two_bone->get_bone_angle() + joint_one_bone->get_bone_angle());
|
||||
joint_two_bone->set_rotation(-Math::PI - angle_1 - joint_two_bone->get_bone_angle() + joint_one_bone->get_bone_angle());
|
||||
}
|
||||
} else {
|
||||
joint_one_bone->set_global_rotation(angle_atan - joint_one_bone->get_bone_angle());
|
||||
|
|
@ -221,10 +221,10 @@ void SkeletonModification2DTwoBoneIK::_draw_editor_gizmo() {
|
|||
#endif // TOOLS_ENABLED
|
||||
|
||||
if (flip_bend_direction) {
|
||||
float angle = -(Math_PI * 0.5) + operation_bone_one->get_bone_angle();
|
||||
float angle = -(Math::PI * 0.5) + operation_bone_one->get_bone_angle();
|
||||
stack->skeleton->draw_line(Vector2(0, 0), Vector2(Math::cos(angle), sin(angle)) * (operation_bone_one->get_length() * 0.5), bone_ik_color, 2.0);
|
||||
} else {
|
||||
float angle = (Math_PI * 0.5) + operation_bone_one->get_bone_angle();
|
||||
float angle = (Math::PI * 0.5) + operation_bone_one->get_bone_angle();
|
||||
stack->skeleton->draw_line(Vector2(0, 0), Vector2(Math::cos(angle), sin(angle)) * (operation_bone_one->get_length() * 0.5), bone_ik_color, 2.0);
|
||||
}
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ void SkeletonModification2DTwoBoneIK::_draw_editor_gizmo() {
|
|||
Vector2 target_direction = Vector2(0, 1);
|
||||
if (target_node_cache.is_valid()) {
|
||||
stack->skeleton->draw_set_transform(Vector2(0, 0), 0.0);
|
||||
Node2D *target = Object::cast_to<Node2D>(ObjectDB::get_instance(target_node_cache));
|
||||
Node2D *target = ObjectDB::get_instance<Node2D>(target_node_cache);
|
||||
target_direction = operation_bone_one->get_global_position().direction_to(target->get_global_position());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SKELETON_MODIFICATION_2D_TWOBONEIK_H
|
||||
#define SKELETON_MODIFICATION_2D_TWOBONEIK_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/skeleton_2d.h"
|
||||
#include "scene/resources/2d/skeleton/skeleton_modification_2d.h"
|
||||
|
|
@ -103,5 +102,3 @@ public:
|
|||
SkeletonModification2DTwoBoneIK();
|
||||
~SkeletonModification2DTwoBoneIK();
|
||||
};
|
||||
|
||||
#endif // SKELETON_MODIFICATION_2D_TWOBONEIK_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SKELETON_MODIFICATION_STACK_2D_H
|
||||
#define SKELETON_MODIFICATION_STACK_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/resource.h"
|
||||
|
||||
|
|
@ -94,5 +93,3 @@ public:
|
|||
|
||||
SkeletonModificationStack2D();
|
||||
};
|
||||
|
||||
#endif // SKELETON_MODIFICATION_STACK_2D_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue