[Bf-blender-cvs] [b408a9b6d1f] refactor-mesh-remove-pointers: Adjust order of data retrieval in curves sculpt mode

Hans Goudey noreply at git.blender.org
Fri Sep 2 01:12:16 CEST 2022


Commit: b408a9b6d1f343965fd8821aea2bd7377fcedb34
Author: Hans Goudey
Date:   Thu Sep 1 17:34:11 2022 -0500
Branches: refactor-mesh-remove-pointers
https://developer.blender.org/rBb408a9b6d1f343965fd8821aea2bd7377fcedb34

Adjust order of data retrieval in curves sculpt mode

===================================================================

M	source/blender/editors/sculpt_paint/curves_sculpt_add.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_slide.cc

===================================================================

diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
index c53d06b3937..3b13575f7bb 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
@@ -138,16 +138,16 @@ struct AddOperationExecutor {
       return;
     }
     surface_eval_ = BKE_object_get_evaluated_mesh(surface_ob_eval_);
+    if (surface_eval_->totpoly == 0) {
+      report_empty_evaluated_surface(stroke_extension.reports);
+      return;
+    }
     surface_verts_eval_ = surface_eval_->vertices();
     surface_loops_eval_ = surface_eval_->loops();
     surface_looptris_eval_ = {BKE_mesh_runtime_looptri_ensure(surface_eval_),
                               BKE_mesh_runtime_looptri_len(surface_eval_)};
     BKE_bvhtree_from_mesh_get(&surface_bvh_eval_, surface_eval_, BVHTREE_FROM_LOOPTRI, 2);
     BLI_SCOPED_DEFER([&]() { free_bvhtree_from_mesh(&surface_bvh_eval_); });
-    if (surface_eval_->totpoly == 0) {
-      report_empty_evaluated_surface(stroke_extension.reports);
-      return;
-    }
 
     curves_sculpt_ = ctx_.scene->toolsettings->curves_sculpt;
     brush_ = BKE_paint_brush_for_read(&curves_sculpt_->paint);
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc b/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc
index e884d7c4fd9..3ba53563d13 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc
@@ -199,15 +199,14 @@ struct SlideOperationExecutor {
     if (surface_eval_ == nullptr) {
       return;
     }
-    surface_looptris_eval_ = {BKE_mesh_runtime_looptri_ensure(surface_eval_),
-                              BKE_mesh_runtime_looptri_len(surface_eval_)};
-    surface_verts_eval_ = surface_eval_->vertices();
-    surface_loops_eval_ = surface_eval_->loops();
     if (surface_eval_->totpoly == 0) {
       report_empty_evaluated_surface(stroke_extension.reports);
       return;
     }
-
+    surface_looptris_eval_ = {BKE_mesh_runtime_looptri_ensure(surface_eval_),
+                              BKE_mesh_runtime_looptri_len(surface_eval_)};
+    surface_verts_eval_ = surface_eval_->vertices();
+    surface_loops_eval_ = surface_eval_->loops();
     surface_uv_map_eval_ =
         bke::mesh_attributes(*surface_eval_).lookup<float2>(uv_map_name, ATTR_DOMAIN_CORNER);
     if (surface_uv_map_eval_.is_empty()) {



More information about the Bf-blender-cvs mailing list