feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -77,11 +77,9 @@ bool AnimationMixer::_set(const StringName &p_name, const Variant &p_value) {
while (animation_libraries.size()) {
remove_animation_library(animation_libraries[0].name);
}
List<Variant> keys;
d.get_key_list(&keys);
for (const Variant &K : keys) {
Ref<AnimationLibrary> lib = d[K];
add_animation_library(K, lib);
for (const KeyValue<Variant, Variant> &kv : d) {
Ref<AnimationLibrary> lib = kv.value;
add_animation_library(kv.key, lib);
}
emit_signal(SNAME("animation_libraries_updated"));
@ -999,7 +997,7 @@ Variant AnimationMixer::_post_process_key_value(const Ref<Animation> &p_anim, in
switch (p_anim->track_get_type(p_track)) {
case Animation::TYPE_POSITION_3D: {
if (p_object_sub_idx >= 0) {
Skeleton3D *skel = Object::cast_to<Skeleton3D>(ObjectDB::get_instance(p_object_id));
Skeleton3D *skel = ObjectDB::get_instance<Skeleton3D>(p_object_id);
if (skel) {
return Vector3(p_value) * skel->get_motion_scale();
}
@ -1591,17 +1589,17 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) {
float rot_a = t->value;
float rot_b = value;
float rot_init = t->init_value;
rot_a = Math::fposmod(rot_a, (float)Math_TAU);
rot_b = Math::fposmod(rot_b, (float)Math_TAU);
rot_init = Math::fposmod(rot_init, (float)Math_TAU);
if (rot_init < Math_PI) {
rot_a = rot_a > rot_init + Math_PI ? rot_a - Math_TAU : rot_a;
rot_b = rot_b > rot_init + Math_PI ? rot_b - Math_TAU : rot_b;
rot_a = Math::fposmod(rot_a, (float)Math::TAU);
rot_b = Math::fposmod(rot_b, (float)Math::TAU);
rot_init = Math::fposmod(rot_init, (float)Math::TAU);
if (rot_init < Math::PI) {
rot_a = rot_a > rot_init + Math::PI ? rot_a - Math::TAU : rot_a;
rot_b = rot_b > rot_init + Math::PI ? rot_b - Math::TAU : rot_b;
} else {
rot_a = rot_a < rot_init - Math_PI ? rot_a + Math_TAU : rot_a;
rot_b = rot_b < rot_init - Math_PI ? rot_b + Math_TAU : rot_b;
rot_a = rot_a < rot_init - Math::PI ? rot_a + Math::TAU : rot_a;
rot_b = rot_b < rot_init - Math::PI ? rot_b + Math::TAU : rot_b;
}
t->value = Math::fposmod(rot_a + (rot_b - rot_init) * (float)blend, (float)Math_TAU);
t->value = Math::fposmod(rot_a + (rot_b - rot_init) * (float)blend, (float)Math::TAU);
} else {
value = Animation::cast_to_blendwise(value);
if (t->init_value.is_array()) {
@ -1869,7 +1867,7 @@ void AnimationMixer::_blend_apply() {
root_motion_rotation_accumulator = t->rot;
root_motion_scale_accumulator = t->scale;
} else if (t->skeleton_id.is_valid() && t->bone_idx >= 0) {
Skeleton3D *t_skeleton = Object::cast_to<Skeleton3D>(ObjectDB::get_instance(t->skeleton_id));
Skeleton3D *t_skeleton = ObjectDB::get_instance<Skeleton3D>(t->skeleton_id);
if (!t_skeleton) {
return;
}
@ -1884,7 +1882,7 @@ void AnimationMixer::_blend_apply() {
}
} else if (!t->skeleton_id.is_valid()) {
Node3D *t_node_3d = Object::cast_to<Node3D>(ObjectDB::get_instance(t->object_id));
Node3D *t_node_3d = ObjectDB::get_instance<Node3D>(t->object_id);
if (!t_node_3d) {
return;
}
@ -1904,7 +1902,7 @@ void AnimationMixer::_blend_apply() {
#ifndef _3D_DISABLED
TrackCacheBlendShape *t = static_cast<TrackCacheBlendShape *>(track);
MeshInstance3D *t_mesh_3d = Object::cast_to<MeshInstance3D>(ObjectDB::get_instance(t->object_id));
MeshInstance3D *t_mesh_3d = ObjectDB::get_instance<MeshInstance3D>(t->object_id);
if (t_mesh_3d) {
t_mesh_3d->set_blend_shape_value(t->shape_index, t->value);
}
@ -2000,7 +1998,7 @@ void AnimationMixer::_blend_apply() {
for (uint32_t erase_idx = 0; erase_idx < erase_streams.size(); erase_idx++) {
map.erase(erase_streams[erase_idx]);
}
if (map.size() == 0) {
if (map.is_empty()) {
erase_maps.push_back(L.key);
}
}
@ -2133,7 +2131,7 @@ void AnimationMixer::_build_backup_track_cache() {
if (t->root_motion) {
// Do nothing.
} else if (t->skeleton_id.is_valid() && t->bone_idx >= 0) {
Skeleton3D *t_skeleton = Object::cast_to<Skeleton3D>(ObjectDB::get_instance(t->skeleton_id));
Skeleton3D *t_skeleton = ObjectDB::get_instance<Skeleton3D>(t->skeleton_id);
if (!t_skeleton) {
return;
}
@ -2147,7 +2145,7 @@ void AnimationMixer::_build_backup_track_cache() {
t->scale = t_skeleton->get_bone_pose_scale(t->bone_idx);
}
} else if (!t->skeleton_id.is_valid()) {
Node3D *t_node_3d = Object::cast_to<Node3D>(ObjectDB::get_instance(t->object_id));
Node3D *t_node_3d = ObjectDB::get_instance<Node3D>(t->object_id);
if (!t_node_3d) {
return;
}
@ -2166,7 +2164,7 @@ void AnimationMixer::_build_backup_track_cache() {
case Animation::TYPE_BLEND_SHAPE: {
#ifndef _3D_DISABLED
TrackCacheBlendShape *t = static_cast<TrackCacheBlendShape *>(track);
MeshInstance3D *t_mesh_3d = Object::cast_to<MeshInstance3D>(ObjectDB::get_instance(t->object_id));
MeshInstance3D *t_mesh_3d = ObjectDB::get_instance<MeshInstance3D>(t->object_id);
if (t_mesh_3d) {
t->value = t_mesh_3d->get_blend_shape_value(t->shape_index);
}