Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions scene/3d/physics/physical_bone_simulator_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void PhysicalBoneSimulator3D::_pose_updated() {
return;
}
// If this triggers that means that we likely haven't rebuilt the bone list yet.
if (skeleton->get_bone_count() != bones.size()) {
if (skeleton->get_bone_count() != (int)bones.size()) {
// NOTE: this is re-entrant and will call _pose_updated again.
_bone_list_changed();
} else {
Expand All @@ -85,8 +85,8 @@ void PhysicalBoneSimulator3D::_pose_updated() {
}

void PhysicalBoneSimulator3D::_bone_pose_updated(Skeleton3D *p_skeleton, int p_bone_id) {
ERR_FAIL_INDEX(p_bone_id, bones.size());
bones.write[p_bone_id].global_pose = p_skeleton->get_bone_global_pose(p_bone_id);
ERR_FAIL_UNSIGNED_INDEX((uint32_t)p_bone_id, bones.size());
bones[p_bone_id].global_pose = p_skeleton->get_bone_global_pose(p_bone_id);
}

void PhysicalBoneSimulator3D::_set_active(bool p_active) {
Expand All @@ -96,7 +96,7 @@ void PhysicalBoneSimulator3D::_set_active(bool p_active) {
}

void PhysicalBoneSimulator3D::_reset_physical_bones_state() {
for (int i = 0; i < bones.size(); i += 1) {
for (uint32_t i = 0; i < bones.size(); i += 1) {
if (bones[i].physical_bone) {
bones[i].physical_bone->reset_physics_simulation_state();
}
Expand Down Expand Up @@ -140,15 +140,15 @@ void PhysicalBoneSimulator3D::bind_physical_bone_to_bone(int p_bone, PhysicalBon
ERR_FAIL_INDEX(p_bone, bone_size);
ERR_FAIL_COND(bones[p_bone].physical_bone);
ERR_FAIL_NULL(p_physical_bone);
bones.write[p_bone].physical_bone = p_physical_bone;
bones[p_bone].physical_bone = p_physical_bone;

_rebuild_physical_bones_cache();
}

void PhysicalBoneSimulator3D::unbind_physical_bone_from_bone(int p_bone) {
const int bone_size = bones.size();
ERR_FAIL_INDEX(p_bone, bone_size);
bones.write[p_bone].physical_bone = nullptr;
bones[p_bone].physical_bone = nullptr;

_rebuild_physical_bones_cache();
}
Expand Down Expand Up @@ -193,7 +193,7 @@ void PhysicalBoneSimulator3D::_rebuild_physical_bones_cache() {
for (int i = 0; i < b_size; ++i) {
PhysicalBone3D *parent_pb = _get_physical_bone_parent(i);
if (parent_pb != bones[i].cache_parent_physical_bone) {
bones.write[i].cache_parent_physical_bone = parent_pb;
bones[i].cache_parent_physical_bone = parent_pb;
if (bones[i].physical_bone) {
bones[i].physical_bone->_on_bone_parent_changed();
}
Expand Down Expand Up @@ -361,15 +361,15 @@ Transform3D PhysicalBoneSimulator3D::get_bone_global_pose(int p_bone) const {
void PhysicalBoneSimulator3D::set_bone_global_pose(int p_bone, const Transform3D &p_pose) {
const int bone_size = bones.size();
ERR_FAIL_INDEX(p_bone, bone_size);
bones.write[p_bone].global_pose = p_pose;
bones[p_bone].global_pose = p_pose;
}

void PhysicalBoneSimulator3D::_process_modification(double p_delta) {
Skeleton3D *skeleton = get_skeleton();
if (!skeleton) {
return;
}
ERR_FAIL_COND(skeleton->get_bone_count() != bones.size());
ERR_FAIL_COND(skeleton->get_bone_count() != (int)bones.size());
for (int i = 0; i < skeleton->get_bone_count(); i++) {
if (!bones[i].physical_bone) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/physics/physical_bone_simulator_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class PhysicalBoneSimulator3D : public SkeletonModifier3D {
}
};

Vector<SimulatedBone> bones;
LocalVector<SimulatedBone> bones;

/// This is a slow API, so it's cached
PhysicalBone3D *_get_physical_bone_parent(int p_bone);
Expand Down
8 changes: 4 additions & 4 deletions scene/animation/animation_mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,10 @@ void AnimationMixer::_create_track_num_to_track_cache_for_animation(Ref<Animatio
return;
}
LocalVector<TrackCache *> &track_num_to_track_cache = animation_track_num_to_track_cache.insert_new(p_animation, LocalVector<TrackCache *>())->value;
const Vector<Animation::Track *> &tracks = p_animation->get_tracks();
const LocalVector<Animation::Track *> &tracks = p_animation->get_tracks();

track_num_to_track_cache.resize(tracks.size());
for (int i = 0; i < tracks.size(); i++) {
for (uint32_t i = 0; i < tracks.size(); i++) {
TrackCache **track_ptr = track_cache.getptr(tracks[i]->thash);
if (track_ptr == nullptr) {
track_num_to_track_cache[i] = nullptr;
Expand Down Expand Up @@ -1133,7 +1133,7 @@ void AnimationMixer::_blend_calc_total_weight() {
LocalVector<TrackCache *> &track_num_to_track_cache = animation_track_num_to_track_cache[a];
thread_local HashSet<Animation::TypeHash, HashHasher> processed_hashes;
processed_hashes.clear();
const Vector<Animation::Track *> tracks = a->get_tracks();
const LocalVector<Animation::Track *> &tracks = a->get_tracks();
Animation::Track *const *tracks_ptr = tracks.ptr();
int count = tracks.size();
for (int i = 0; i < count; i++) {
Expand Down Expand Up @@ -1181,7 +1181,7 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) {
#endif // _3D_DISABLED
ERR_CONTINUE_EDMSG(!animation_track_num_to_track_cache.has(a), "No animation in cache.");
LocalVector<TrackCache *> &track_num_to_track_cache = animation_track_num_to_track_cache[a];
const Vector<Animation::Track *> tracks = a->get_tracks();
const LocalVector<Animation::Track *> &tracks = a->get_tracks();
Animation::Track *const *tracks_ptr = tracks.ptr();
real_t a_length = a->get_length();
int count = tracks.size();
Expand Down
Loading
Loading