From 28870a8f890b503c7dd5df9f949fc7030d56e8e4 Mon Sep 17 00:00:00 2001 From: Jesse Yurkovich Date: Mon, 22 Nov 2021 23:47:26 -0800 Subject: Cleanup: Use new CollectionRef::empty() method Use the new CollectionRef::empty() method in all locations where appropriate. Differential Revision: https://developer.blender.org/D13276 --- intern/cycles/blender/curves.cpp | 4 ++-- intern/cycles/blender/mesh.cpp | 6 +++--- intern/cycles/blender/util.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/intern/cycles/blender/curves.cpp b/intern/cycles/blender/curves.cpp index ffe0c553738..c96d01a8ffb 100644 --- a/intern/cycles/blender/curves.cpp +++ b/intern/cycles/blender/curves.cpp @@ -199,7 +199,7 @@ static bool ObtainCacheParticleUV(Hair *hair, b_mesh->uv_layers.begin(l); float2 uv = zero_float2(); - if (b_mesh->uv_layers.length()) + if (!b_mesh->uv_layers.empty()) b_psys.uv_on_emitter(psmd, *b_pa, pa_no, uv_num, &uv.x); CData->curve_uv.push_back_slow(uv); @@ -261,7 +261,7 @@ static bool ObtainCacheParticleVcol(Hair *hair, b_mesh->vertex_colors.begin(l); float4 vcol = make_float4(0.0f, 0.0f, 0.0f, 1.0f); - if (b_mesh->vertex_colors.length()) + if (!b_mesh->vertex_colors.empty()) b_psys.mcol_on_emitter(psmd, *b_pa, pa_no, vcol_num, &vcol.x); CData->curve_vcol.push_back_slow(vcol); diff --git a/intern/cycles/blender/mesh.cpp b/intern/cycles/blender/mesh.cpp index b69bf88c213..bb17cfdcb45 100644 --- a/intern/cycles/blender/mesh.cpp +++ b/intern/cycles/blender/mesh.cpp @@ -555,7 +555,7 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, /* Create uv map attributes. */ static void attr_create_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh) { - if (b_mesh.uv_layers.length() != 0) { + if (!b_mesh.uv_layers.empty()) { for (BL::MeshUVLoopLayer &l : b_mesh.uv_layers) { const bool active_render = l.active_render(); AttributeStandard uv_std = (active_render) ? ATTR_STD_UV : ATTR_STD_NONE; @@ -619,7 +619,7 @@ static void attr_create_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh) static void attr_create_subd_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, bool subdivide_uvs) { - if (b_mesh.uv_layers.length() != 0) { + if (!b_mesh.uv_layers.empty()) { BL::Mesh::uv_layers_iterator l; int i = 0; @@ -951,7 +951,7 @@ static void create_mesh(Scene *scene, N = attr_N->data_float3(); /* create generated coordinates from undeformed coordinates */ - const bool need_default_tangent = (subdivision == false) && (b_mesh.uv_layers.length() == 0) && + const bool need_default_tangent = (subdivision == false) && (b_mesh.uv_layers.empty()) && (mesh->need_attribute(scene, ATTR_STD_UV_TANGENT)); if (mesh->need_attribute(scene, ATTR_STD_GENERATED) || need_default_tangent) { Attribute *attr = attributes.add(ATTR_STD_GENERATED); diff --git a/intern/cycles/blender/util.h b/intern/cycles/blender/util.h index 33fd2c416c8..be36bcdaaa8 100644 --- a/intern/cycles/blender/util.h +++ b/intern/cycles/blender/util.h @@ -303,7 +303,7 @@ static inline string image_user_file_path(BL::ImageUser &iuser, string filepath_str = string(filepath); if (load_tiled && ima.source() == BL::Image::source_TILED) { string udim; - if (ima.tiles.length() > 0) { + if (!ima.tiles.empty()) { udim = to_string(ima.tiles[0].number()); } string_replace(filepath_str, udim, ""); @@ -647,7 +647,7 @@ static inline Mesh::SubdivisionType object_subdivision_type(BL::Object &b_ob, { PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles"); - if (cobj.data && b_ob.modifiers.length() > 0 && experimental) { + if (cobj.data && !b_ob.modifiers.empty() && experimental) { BL::Modifier mod = b_ob.modifiers[b_ob.modifiers.length() - 1]; bool enabled = preview ? mod.show_viewport() : mod.show_render(); -- cgit v1.2.3