summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorAaron Record <aaronjrecord@gmail.com>2022-05-18 17:43:40 -0600
committerAaron Record <aaronjrecord@gmail.com>2022-05-19 12:09:16 +0200
commit900c676b0282bed83d00834e3c280ac89c2bc94d (patch)
treeb6bf869a55440a666f4bcc17d5e9cd93ff26dbdc /scene/3d
parent71c40ff4da85a4770958533cdc65f2c9f7ddeaff (diff)
Use range iterators for RBSet in most cases
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/collision_object_3d.cpp6
-rw-r--r--scene/3d/skeleton_3d.cpp40
2 files changed, 23 insertions, 23 deletions
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp
index 70cab77eda..a36357555a 100644
--- a/scene/3d/collision_object_3d.cpp
+++ b/scene/3d/collision_object_3d.cpp
@@ -345,9 +345,9 @@ void CollisionObject3D::_update_debug_shapes() {
return;
}
- for (RBSet<uint32_t>::Element *shapedata_idx = debug_shapes_to_update.front(); shapedata_idx; shapedata_idx = shapedata_idx->next()) {
- if (shapes.has(shapedata_idx->get())) {
- ShapeData &shapedata = shapes[shapedata_idx->get()];
+ for (const uint32_t &shapedata_idx : debug_shapes_to_update) {
+ if (shapes.has(shapedata_idx)) {
+ ShapeData &shapedata = shapes[shapedata_idx];
ShapeData::ShapeBase *shapes = shapedata.shapes.ptrw();
for (int i = 0; i < shapedata.shapes.size(); i++) {
ShapeData::ShapeBase &s = shapes[i];
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index 3f2fb89548..ba2029788e 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -263,19 +263,19 @@ void Skeleton3D::_notification(int p_what) {
force_update_all_bone_transforms();
// Update skins.
- for (RBSet<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) {
- const Skin *skin = E->get()->skin.operator->();
- RID skeleton = E->get()->skeleton;
+ for (SkinReference *E : skin_bindings) {
+ const Skin *skin = E->skin.operator->();
+ RID skeleton = E->skeleton;
uint32_t bind_count = skin->get_bind_count();
- if (E->get()->bind_count != bind_count) {
+ if (E->bind_count != bind_count) {
RS::get_singleton()->skeleton_allocate_data(skeleton, bind_count);
- E->get()->bind_count = bind_count;
- E->get()->skin_bone_indices.resize(bind_count);
- E->get()->skin_bone_indices_ptrs = E->get()->skin_bone_indices.ptrw();
+ E->bind_count = bind_count;
+ E->skin_bone_indices.resize(bind_count);
+ E->skin_bone_indices_ptrs = E->skin_bone_indices.ptrw();
}
- if (E->get()->skeleton_version != version) {
+ if (E->skeleton_version != version) {
for (uint32_t i = 0; i < bind_count; i++) {
StringName bind_name = skin->get_bind_name(i);
@@ -284,7 +284,7 @@ void Skeleton3D::_notification(int p_what) {
bool found = false;
for (int j = 0; j < len; j++) {
if (bonesptr[j].name == bind_name) {
- E->get()->skin_bone_indices_ptrs[i] = j;
+ E->skin_bone_indices_ptrs[i] = j;
found = true;
break;
}
@@ -292,27 +292,27 @@ void Skeleton3D::_notification(int p_what) {
if (!found) {
ERR_PRINT("Skin bind #" + itos(i) + " contains named bind '" + String(bind_name) + "' but Skeleton3D has no bone by that name.");
- E->get()->skin_bone_indices_ptrs[i] = 0;
+ E->skin_bone_indices_ptrs[i] = 0;
}
} else if (skin->get_bind_bone(i) >= 0) {
int bind_index = skin->get_bind_bone(i);
if (bind_index >= len) {
ERR_PRINT("Skin bind #" + itos(i) + " contains bone index bind: " + itos(bind_index) + " , which is greater than the skeleton bone count: " + itos(len) + ".");
- E->get()->skin_bone_indices_ptrs[i] = 0;
+ E->skin_bone_indices_ptrs[i] = 0;
} else {
- E->get()->skin_bone_indices_ptrs[i] = bind_index;
+ E->skin_bone_indices_ptrs[i] = bind_index;
}
} else {
ERR_PRINT("Skin bind #" + itos(i) + " does not contain a name nor a bone index.");
- E->get()->skin_bone_indices_ptrs[i] = 0;
+ E->skin_bone_indices_ptrs[i] = 0;
}
}
- E->get()->skeleton_version = version;
+ E->skeleton_version = version;
}
for (uint32_t i = 0; i < bind_count; i++) {
- uint32_t bone_index = E->get()->skin_bone_indices_ptrs[i];
+ uint32_t bone_index = E->skin_bone_indices_ptrs[i];
ERR_CONTINUE(bone_index >= (uint32_t)len);
rs->skeleton_bone_set_transform(skeleton, i, bonesptr[bone_index].pose_global * skin->get_bind_pose(i));
}
@@ -1000,9 +1000,9 @@ Ref<Skin> Skeleton3D::create_skin_from_rest_transforms() {
Ref<SkinReference> Skeleton3D::register_skin(const Ref<Skin> &p_skin) {
ERR_FAIL_COND_V(p_skin.is_null(), Ref<SkinReference>());
- for (RBSet<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) {
- if (E->get()->skin == p_skin) {
- return Ref<SkinReference>(E->get());
+ for (const SkinReference *E : skin_bindings) {
+ if (E->skin == p_skin) {
+ return Ref<SkinReference>(E);
}
}
@@ -1303,7 +1303,7 @@ Skeleton3D::Skeleton3D() {
Skeleton3D::~Skeleton3D() {
// Some skins may remain bound.
- for (RBSet<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) {
- E->get()->skeleton_node = nullptr;
+ for (SkinReference *E : skin_bindings) {
+ E->skeleton_node = nullptr;
}
}