diff options
6 files changed, 14 insertions, 26 deletions
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc index f5ed21af19a..47f7bb00b8f 100644 --- a/source/blender/blenkernel/intern/geometry_component_mesh.cc +++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc @@ -1187,8 +1187,7 @@ class NormalAttributeProvider final : public BuiltinAttributeProvider { static ComponentAttributeProviders create_attribute_providers_for_mesh() { static auto update_custom_data_pointers = [](GeometryComponent &component) { - Mesh *mesh = get_mesh_from_component_for_write(component); - if (mesh != nullptr) { + if (Mesh *mesh = get_mesh_from_component_for_write(component)) { BKE_mesh_update_customdata_pointers(mesh, false); } }; diff --git a/source/blender/blenkernel/intern/geometry_component_pointcloud.cc b/source/blender/blenkernel/intern/geometry_component_pointcloud.cc index 3db4db307a3..400e0ea5e15 100644 --- a/source/blender/blenkernel/intern/geometry_component_pointcloud.cc +++ b/source/blender/blenkernel/intern/geometry_component_pointcloud.cc @@ -125,8 +125,7 @@ static ComponentAttributeProviders create_attribute_providers_for_point_cloud() { static auto update_custom_data_pointers = [](GeometryComponent &component) { PointCloudComponent &pointcloud_component = static_cast<PointCloudComponent &>(component); - PointCloud *pointcloud = pointcloud_component.get_for_write(); - if (pointcloud != nullptr) { + if (PointCloud *pointcloud = pointcloud_component.get_for_write()) { BKE_pointcloud_update_customdata_pointers(pointcloud); } }; diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc index 0b08acf92a3..fc758e12c70 100644 --- a/source/blender/blenkernel/intern/geometry_set.cc +++ b/source/blender/blenkernel/intern/geometry_set.cc @@ -176,20 +176,16 @@ Vector<const GeometryComponent *> GeometrySet::get_components_for_read() const bool GeometrySet::compute_boundbox_without_instances(float3 *r_min, float3 *r_max) const { bool have_minmax = false; - const PointCloud *pointcloud = this->get_pointcloud_for_read(); - if (pointcloud != nullptr) { + if (const PointCloud *pointcloud = this->get_pointcloud_for_read()) { have_minmax |= BKE_pointcloud_minmax(pointcloud, *r_min, *r_max); } - const Mesh *mesh = this->get_mesh_for_read(); - if (mesh != nullptr) { + if (const Mesh *mesh = this->get_mesh_for_read()) { have_minmax |= BKE_mesh_wrapper_minmax(mesh, *r_min, *r_max); } - const Volume *volume = this->get_volume_for_read(); - if (volume != nullptr) { + if (const Volume *volume = this->get_volume_for_read()) { have_minmax |= BKE_volume_min_max(volume, *r_min, *r_max); } - const Curves *curves = this->get_curves_for_read(); - if (curves != nullptr) { + if (const Curves *curves = this->get_curves_for_read()) { std::unique_ptr<CurveEval> curve = curves_to_curve_eval(*curves); /* Using the evaluated positions is somewhat arbitrary, but it is probably expected. */ have_minmax |= curve->bounds_min_max(*r_min, *r_max, true); diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc index 327035971d5..0ae8f144583 100644 --- a/source/blender/blenkernel/intern/object_dupli.cc +++ b/source/blender/blenkernel/intern/object_dupli.cc @@ -776,32 +776,27 @@ static void make_duplis_geometry_set_impl(const DupliContext *ctx, { int component_index = 0; if (ctx->object->type != OB_MESH || geometry_set_is_instance) { - const Mesh *mesh = geometry_set.get_mesh_for_read(); - if (mesh != nullptr) { + if (const Mesh *mesh = geometry_set.get_mesh_for_read()) { DupliObject *dupli = make_dupli(ctx, ctx->object, parent_transform, component_index++); dupli->ob_data = (ID *)mesh; } } if (ctx->object->type != OB_VOLUME || geometry_set_is_instance) { - const Volume *volume = geometry_set.get_volume_for_read(); - if (volume != nullptr) { + if (const Volume *volume = geometry_set.get_volume_for_read()) { DupliObject *dupli = make_dupli(ctx, ctx->object, parent_transform, component_index++); dupli->ob_data = (ID *)volume; } } if (!ELEM(ctx->object->type, OB_CURVES_LEGACY, OB_FONT) || geometry_set_is_instance) { - const CurveComponent *curve_component = geometry_set.get_component_for_read<CurveComponent>(); - if (curve_component != nullptr) { - const Curve *curve = curve_component->get_curve_for_render(); - if (curve != nullptr) { + if (const CurveComponent *component = geometry_set.get_component_for_read<CurveComponent>()) { + if (const Curve *curve = component->get_curve_for_render()) { DupliObject *dupli = make_dupli(ctx, ctx->object, parent_transform, component_index++); dupli->ob_data = (ID *)curve; } } } if (ctx->object->type != OB_POINTCLOUD || geometry_set_is_instance) { - const PointCloud *pointcloud = geometry_set.get_pointcloud_for_read(); - if (pointcloud != nullptr) { + if (const PointCloud *pointcloud = geometry_set.get_pointcloud_for_read()) { DupliObject *dupli = make_dupli(ctx, ctx->object, parent_transform, component_index++); dupli->ob_data = (ID *)pointcloud; } diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc index cc1204abbfb..d6381bf3f18 100644 --- a/source/blender/blenkernel/intern/scene.cc +++ b/source/blender/blenkernel/intern/scene.cc @@ -1225,7 +1225,7 @@ static void scene_blend_read_data(BlendDataReader *reader, ID *id) } /* Active channels root pointer. */ - if (ed->displayed_channels == old_displayed_channels || ed->displayed_channels == NULL) { + if (ed->displayed_channels == old_displayed_channels || ed->displayed_channels == nullptr) { ed->displayed_channels = &ed->channels; } else { @@ -1260,7 +1260,7 @@ static void scene_blend_read_data(BlendDataReader *reader, ID *id) } } - if (ms->old_channels == old_displayed_channels || ms->old_channels == NULL) { + if (ms->old_channels == old_displayed_channels || ms->old_channels == nullptr) { ms->old_channels = &ed->channels; } else { diff --git a/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc b/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc index cfa1d332f85..546982b11af 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc @@ -28,8 +28,7 @@ static void node_geo_exec(GeoNodeExecParams params) GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"); geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) { - Mesh *mesh = geometry_set.get_mesh_for_write(); - if (mesh != nullptr) { + if (Mesh *mesh = geometry_set.get_mesh_for_write()) { for (const int i : IndexRange(mesh->totcol)) { if (mesh->mat[i] == old_material) { mesh->mat[i] = new_material; |