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
|
|
@ -32,9 +32,9 @@
|
|||
#include "skeleton_3d.compat.inc"
|
||||
|
||||
#include "scene/3d/skeleton_modifier_3d.h"
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
#include "scene/3d/physical_bone_simulator_3d.h"
|
||||
#endif // _DISABLE_DEPRECATED
|
||||
#if !defined(DISABLE_DEPRECATED) && !defined(PHYSICS_3D_DISABLED)
|
||||
#include "scene/3d/physics/physical_bone_simulator_3d.h"
|
||||
#endif // _DISABLE_DEPRECATED && PHYSICS_3D_DISABLED
|
||||
|
||||
void SkinReference::_skin_changed() {
|
||||
if (skeleton_node) {
|
||||
|
|
@ -67,12 +67,12 @@ SkinReference::~SkinReference() {
|
|||
///////////////////////////////////////
|
||||
|
||||
bool Skeleton3D::_set(const StringName &p_path, const Variant &p_value) {
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
#if !defined(DISABLE_DEPRECATED) && !defined(PHYSICS_3D_DISABLED)
|
||||
if (p_path == SNAME("animate_physical_bones")) {
|
||||
set_animate_physical_bones(p_value);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif // _DISABLE_DEPRECATED && PHYSICS_3D_DISABLED
|
||||
String path = p_path;
|
||||
|
||||
if (!path.begins_with("bones/")) {
|
||||
|
|
@ -139,12 +139,12 @@ bool Skeleton3D::_set(const StringName &p_path, const Variant &p_value) {
|
|||
}
|
||||
|
||||
bool Skeleton3D::_get(const StringName &p_path, Variant &r_ret) const {
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
#if !defined(DISABLE_DEPRECATED) && !defined(PHYSICS_3D_DISABLED)
|
||||
if (p_path == SNAME("animate_physical_bones")) {
|
||||
r_ret = get_animate_physical_bones();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif // _DISABLE_DEPRECATED && PHYSICS_3D_DISABLED
|
||||
String path = p_path;
|
||||
|
||||
if (!path.begins_with("bones/")) {
|
||||
|
|
@ -297,7 +297,7 @@ StringName Skeleton3D::get_concatenated_bone_names() const {
|
|||
return concatenated_bone_names;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
#if !defined(DISABLE_DEPRECATED) && !defined(PHYSICS_3D_DISABLED)
|
||||
void Skeleton3D::setup_simulator() {
|
||||
if (simulator && simulator->get_parent() == this) {
|
||||
remove_child(simulator);
|
||||
|
|
@ -310,7 +310,7 @@ void Skeleton3D::setup_simulator() {
|
|||
add_child(simulator, false, INTERNAL_MODE_BACK);
|
||||
set_animate_physical_bones(animate_physical_bones);
|
||||
}
|
||||
#endif // _DISABLE_DEPRECATED
|
||||
#endif // _DISABLE_DEPRECATED && PHYSICS_3D_DISABLED
|
||||
|
||||
void Skeleton3D::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
|
|
@ -319,9 +319,9 @@ void Skeleton3D::_notification(int p_what) {
|
|||
_make_dirty();
|
||||
_make_modifiers_dirty();
|
||||
force_update_all_dirty_bones();
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
#if !defined(DISABLE_DEPRECATED) && !defined(PHYSICS_3D_DISABLED)
|
||||
setup_simulator();
|
||||
#endif // _DISABLE_DEPRECATED
|
||||
#endif // _DISABLE_DEPRECATED && PHYSICS_3D_DISABLED
|
||||
update_flags = UPDATE_FLAG_POSE;
|
||||
_notification(NOTIFICATION_UPDATE_SKELETON);
|
||||
} break;
|
||||
|
|
@ -357,7 +357,9 @@ void Skeleton3D::_notification(int p_what) {
|
|||
// Store dirty flags for global bone poses.
|
||||
bone_global_pose_dirty_backup = bone_global_pose_dirty;
|
||||
|
||||
_process_modifiers();
|
||||
if (update_flags & UPDATE_FLAG_MODIFIER) {
|
||||
_process_modifiers();
|
||||
}
|
||||
}
|
||||
|
||||
// Abort if pose is not changed.
|
||||
|
|
@ -438,13 +440,20 @@ void Skeleton3D::_notification(int p_what) {
|
|||
updating = false;
|
||||
update_flags = UPDATE_FLAG_NONE;
|
||||
} break;
|
||||
case NOTIFICATION_INTERNAL_PROCESS:
|
||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||
_find_modifiers();
|
||||
if (!modifiers.is_empty()) {
|
||||
_update_deferred(UPDATE_FLAG_MODIFIER);
|
||||
}
|
||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||
advance(get_process_delta_time());
|
||||
} break;
|
||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||
advance(get_physics_process_delta_time());
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void Skeleton3D::advance(double p_delta) {
|
||||
_find_modifiers();
|
||||
if (!modifiers.is_empty()) {
|
||||
update_delta += p_delta; // Accumulate delta for manual advance as it needs to process in deferred update.
|
||||
_update_deferred(UPDATE_FLAG_MODIFIER);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -467,6 +476,9 @@ void Skeleton3D::_process_changed() {
|
|||
} else if (modifier_callback_mode_process == MODIFIER_CALLBACK_MODE_PROCESS_PHYSICS) {
|
||||
set_process_internal(false);
|
||||
set_physics_process_internal(true);
|
||||
} else {
|
||||
set_process_internal(false);
|
||||
set_physics_process_internal(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -838,6 +850,13 @@ bool Skeleton3D::is_show_rest_only() const {
|
|||
void Skeleton3D::clear_bones() {
|
||||
bones.clear();
|
||||
name_to_bone_index.clear();
|
||||
|
||||
// All these structures contain references to now invalid bone indices.
|
||||
skin_bindings.clear();
|
||||
bone_global_pose_dirty.clear();
|
||||
parentless_bones.clear();
|
||||
nested_set_offset_to_bone_index.clear();
|
||||
|
||||
process_order_dirty = true;
|
||||
version++;
|
||||
_make_dirty();
|
||||
|
|
@ -1091,6 +1110,8 @@ void Skeleton3D::_force_update_bone_children_transforms(int p_bone_idx) const {
|
|||
const int bone_size = bones.size();
|
||||
ERR_FAIL_INDEX(p_bone_idx, bone_size);
|
||||
|
||||
_update_process_order();
|
||||
|
||||
Bone *bonesptr = bones.ptr();
|
||||
|
||||
// Loop through nested set.
|
||||
|
|
@ -1185,7 +1206,7 @@ void Skeleton3D::_process_modifiers() {
|
|||
for (int i = 0; i < get_bone_count(); i++) {
|
||||
old_poses.push_back(get_bone_pose(i));
|
||||
}
|
||||
mod->process_modification();
|
||||
mod->process_modification(update_delta);
|
||||
LocalVector<Transform3D> new_poses;
|
||||
for (int i = 0; i < get_bone_count(); i++) {
|
||||
new_poses.push_back(get_bone_pose(i));
|
||||
|
|
@ -1197,10 +1218,11 @@ void Skeleton3D::_process_modifiers() {
|
|||
set_bone_pose(i, old_poses[i].interpolate_with(new_poses[i], influence));
|
||||
}
|
||||
} else {
|
||||
mod->process_modification();
|
||||
mod->process_modification(update_delta);
|
||||
}
|
||||
force_update_all_dirty_bones();
|
||||
}
|
||||
update_delta = 0; // Reset accumulated delta.
|
||||
}
|
||||
|
||||
void Skeleton3D::add_child_notify(Node *p_child) {
|
||||
|
|
@ -1288,11 +1310,13 @@ void Skeleton3D::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_modifier_callback_mode_process", "mode"), &Skeleton3D::set_modifier_callback_mode_process);
|
||||
ClassDB::bind_method(D_METHOD("get_modifier_callback_mode_process"), &Skeleton3D::get_modifier_callback_mode_process);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("advance", "delta"), &Skeleton3D::advance);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "motion_scale", PROPERTY_HINT_RANGE, "0.001,10,0.001,or_greater"), "set_motion_scale", "get_motion_scale");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_rest_only"), "set_show_rest_only", "is_show_rest_only");
|
||||
|
||||
ADD_GROUP("Modifier", "modifier_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "modifier_callback_mode_process", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_modifier_callback_mode_process", "get_modifier_callback_mode_process");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "modifier_callback_mode_process", PROPERTY_HINT_ENUM, "Physics,Idle,Manual"), "set_modifier_callback_mode_process", "get_modifier_callback_mode_process");
|
||||
|
||||
ADD_SIGNAL(MethodInfo("rest_updated"));
|
||||
ADD_SIGNAL(MethodInfo("pose_updated"));
|
||||
|
|
@ -1304,6 +1328,7 @@ void Skeleton3D::_bind_methods() {
|
|||
BIND_CONSTANT(NOTIFICATION_UPDATE_SKELETON);
|
||||
BIND_ENUM_CONSTANT(MODIFIER_CALLBACK_MODE_PROCESS_PHYSICS);
|
||||
BIND_ENUM_CONSTANT(MODIFIER_CALLBACK_MODE_PROCESS_IDLE);
|
||||
BIND_ENUM_CONSTANT(MODIFIER_CALLBACK_MODE_PROCESS_MANUAL);
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
ClassDB::bind_method(D_METHOD("clear_bones_global_pose_override"), &Skeleton3D::clear_bones_global_pose_override);
|
||||
|
|
@ -1311,6 +1336,7 @@ void Skeleton3D::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_bone_global_pose_override", "bone_idx"), &Skeleton3D::get_bone_global_pose_override);
|
||||
ClassDB::bind_method(D_METHOD("get_bone_global_pose_no_override", "bone_idx"), &Skeleton3D::get_bone_global_pose_no_override);
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("set_animate_physical_bones", "enabled"), &Skeleton3D::set_animate_physical_bones);
|
||||
ClassDB::bind_method(D_METHOD("get_animate_physical_bones"), &Skeleton3D::get_animate_physical_bones);
|
||||
ClassDB::bind_method(D_METHOD("physical_bones_stop_simulation"), &Skeleton3D::physical_bones_stop_simulation);
|
||||
|
|
@ -1320,6 +1346,7 @@ void Skeleton3D::_bind_methods() {
|
|||
|
||||
ADD_GROUP("Deprecated", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "animate_physical_bones"), "set_animate_physical_bones", "get_animate_physical_bones");
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
#endif // _DISABLE_DEPRECATED
|
||||
}
|
||||
|
||||
|
|
@ -1356,6 +1383,7 @@ Transform3D Skeleton3D::get_bone_global_pose_no_override(int p_bone) const {
|
|||
return bones[p_bone].pose_global_no_override;
|
||||
}
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
Node *Skeleton3D::get_simulator() {
|
||||
return simulator;
|
||||
}
|
||||
|
|
@ -1406,6 +1434,7 @@ void Skeleton3D::physical_bones_remove_collision_exception(RID p_exception) {
|
|||
}
|
||||
sim->physical_bones_remove_collision_exception(p_exception);
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
#endif // _DISABLE_DEPRECATED
|
||||
|
||||
Skeleton3D::Skeleton3D() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue