Remove SkeletonModificationStack3D, and Skeleton3D api cleanup
Removes all 3D modification resources. SkeletonIK3D is a node and still supported. Remove deprecated Skeleton3D functionality for 4.0, so we can add it back in 4.x. Remove local_pose_override feature from Skeleton3D and BoneAttachment3D. Expose Skeleton3D::get_version() so IK scripts/extensions can cache bones. Note: This change only affects 3D. SkeletonModification2D will work as before.
This commit is contained in:
+1
-54
@@ -32,7 +32,6 @@
|
||||
#define SKELETON_3D_H
|
||||
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/resources/skeleton_modification_3d.h"
|
||||
#include "scene/resources/skin.h"
|
||||
|
||||
typedef int BoneId;
|
||||
@@ -64,8 +63,6 @@ public:
|
||||
~SkinReference();
|
||||
};
|
||||
|
||||
class SkeletonModificationStack3D;
|
||||
|
||||
class Skeleton3D : public Node3D {
|
||||
GDCLASS(Skeleton3D, Node3D);
|
||||
|
||||
@@ -104,17 +101,8 @@ private:
|
||||
PhysicalBone3D *physical_bone = nullptr;
|
||||
PhysicalBone3D *cache_parent_physical_bone = nullptr;
|
||||
|
||||
real_t local_pose_override_amount;
|
||||
bool local_pose_override_reset;
|
||||
Transform3D local_pose_override;
|
||||
|
||||
Vector<int> child_bones;
|
||||
|
||||
// The forward direction vector and rest bone forward axis are cached because they do not change
|
||||
// 99% of the time, but recalculating them can be expensive on models with many bones.
|
||||
Vector3 rest_bone_forward_vector;
|
||||
int rest_bone_forward_axis = -1;
|
||||
|
||||
Bone() {
|
||||
parent = -1;
|
||||
enabled = true;
|
||||
@@ -124,12 +112,7 @@ private:
|
||||
physical_bone = nullptr;
|
||||
cache_parent_physical_bone = nullptr;
|
||||
#endif // _3D_DISABLED
|
||||
local_pose_override_amount = 0;
|
||||
local_pose_override_reset = false;
|
||||
child_bones = Vector<int>();
|
||||
|
||||
rest_bone_forward_vector = Vector3(0, 0, 0);
|
||||
rest_bone_forward_axis = -1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -162,25 +145,13 @@ protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
Ref<SkeletonModificationStack3D> modification_stack;
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
public:
|
||||
enum Bone_Forward_Axis {
|
||||
BONE_AXIS_X_FORWARD = 0,
|
||||
BONE_AXIS_Y_FORWARD = 1,
|
||||
BONE_AXIS_Z_FORWARD = 2,
|
||||
BONE_AXIS_NEGATIVE_X_FORWARD = 3,
|
||||
BONE_AXIS_NEGATIVE_Y_FORWARD = 4,
|
||||
BONE_AXIS_NEGATIVE_Z_FORWARD = 5,
|
||||
};
|
||||
|
||||
enum {
|
||||
NOTIFICATION_UPDATE_SKELETON = 50
|
||||
};
|
||||
|
||||
// skeleton creation api
|
||||
uint64_t get_version() const;
|
||||
void add_bone(const String &p_name);
|
||||
int find_bone(const String &p_name) const;
|
||||
String get_bone_name(int p_bone) const;
|
||||
@@ -233,10 +204,6 @@ public:
|
||||
Transform3D get_bone_global_pose_override(int p_bone) const;
|
||||
void set_bone_global_pose_override(int p_bone, const Transform3D &p_pose, real_t p_amount, bool p_persistent = false);
|
||||
|
||||
void clear_bones_local_pose_override();
|
||||
Transform3D get_bone_local_pose_override(int p_bone) const;
|
||||
void set_bone_local_pose_override(int p_bone, const Transform3D &p_pose, real_t p_amount, bool p_persistent = false);
|
||||
|
||||
void localize_rests(); // used for loaders and tools
|
||||
|
||||
Ref<Skin> create_skin_from_rest_transforms();
|
||||
@@ -247,26 +214,6 @@ public:
|
||||
void force_update_all_bone_transforms();
|
||||
void force_update_bone_children_transforms(int bone_idx);
|
||||
|
||||
void update_bone_rest_forward_vector(int p_bone, bool p_force_update = false);
|
||||
void update_bone_rest_forward_axis(int p_bone, bool p_force_update = false);
|
||||
Vector3 get_bone_axis_forward_vector(int p_bone);
|
||||
int get_bone_axis_forward_enum(int p_bone);
|
||||
|
||||
// Helper functions
|
||||
Transform3D global_pose_to_world_transform(Transform3D p_global_pose);
|
||||
Transform3D world_transform_to_global_pose(Transform3D p_transform);
|
||||
Transform3D global_pose_to_local_pose(int p_bone_idx, Transform3D p_global_pose);
|
||||
Transform3D local_pose_to_global_pose(int p_bone_idx, Transform3D p_local_pose);
|
||||
|
||||
Basis global_pose_z_forward_to_bone_forward(int p_bone_idx, Basis p_basis);
|
||||
|
||||
// Modifications
|
||||
#ifndef _3D_DISABLED
|
||||
Ref<SkeletonModificationStack3D> get_modification_stack();
|
||||
void set_modification_stack(Ref<SkeletonModificationStack3D> p_stack);
|
||||
void execute_modifications(real_t p_delta, int p_execution_mode);
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
// Physical bone API
|
||||
|
||||
void set_animate_physical_bones(bool p_enabled);
|
||||
|
||||
Reference in New Issue
Block a user