[Bf-blender-cvs] [e00a00db527] master: Cleanup: rename some sculpt variables for clarity

Brecht Van Lommel noreply at git.blender.org
Mon Oct 7 17:39:19 CEST 2019


Commit: e00a00db527490c3a33ab775fc1757adadd2cc2d
Author: Brecht Van Lommel
Date:   Mon Oct 7 17:27:56 2019 +0200
Branches: master
https://developer.blender.org/rBe00a00db527490c3a33ab775fc1757adadd2cc2d

Cleanup: rename some sculpt variables for clarity

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

M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/intern/paint.c
M	source/blender/draw/modes/sculpt_mode.c
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_undo.c

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

diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 8580aefcfbc..77d13d3cae9 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -220,7 +220,7 @@ typedef struct SculptSession {
   struct MPoly *mpoly;
   struct MLoop *mloop;
   int totvert, totpoly;
-  struct KeyBlock *kb;
+  struct KeyBlock *shapekey_active;
   float *vmask;
 
   /* Mesh connectivity */
@@ -243,10 +243,10 @@ typedef struct SculptSession {
   bool show_mask;
 
   /* Painting on deformed mesh */
-  bool modifiers_active;       /* object is deformed with some modifiers */
-  float (*orig_cos)[3];        /* coords of undeformed mesh */
-  float (*deform_cos)[3];      /* coords of deformed mesh but without stroke displacement */
-  float (*deform_imats)[3][3]; /* crazyspace deformation matrices */
+  bool deform_modifiers_active; /* object is deformed with some modifiers */
+  float (*orig_cos)[3];            /* coords of undeformed mesh */
+  float (*deform_cos)[3];          /* coords of deformed mesh but without stroke displacement */
+  float (*deform_imats)[3][3];     /* crazyspace deformation matrices */
 
   /* Used to cache the render of the active texture */
   unsigned int texcache_side, *texcache, texcache_actual;
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 143b8debce7..2c67761126a 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1184,7 +1184,7 @@ static void sculpt_update_object(
   Mesh *me = BKE_object_get_original_mesh(ob);
   MultiresModifierData *mmd = BKE_sculpt_multires_active(scene, ob);
 
-  ss->modifiers_active = sculpt_modifiers_active(scene, sd, ob);
+  ss->deform_modifiers_active = sculpt_modifiers_active(scene, sd, ob);
   ss->show_mask = (sd->flags & SCULPT_HIDE_MASK) == 0;
 
   ss->building_vp_handle = false;
@@ -1205,7 +1205,7 @@ static void sculpt_update_object(
   /* tessfaces aren't used and will become invalid */
   BKE_mesh_tessface_clear(me);
 
-  ss->kb = (mmd == NULL) ? BKE_keyblock_from_object(ob) : NULL;
+  ss->shapekey_active = (mmd == NULL) ? BKE_keyblock_from_object(ob) : NULL;
 
   /* NOTE: Weight pPaint require mesh info for loop lookup, but it never uses multires code path,
    * so no extra checks is needed here. */
@@ -1240,14 +1240,15 @@ static void sculpt_update_object(
 
   pbvh_show_mask_set(ss->pbvh, ss->show_mask);
 
-  if (ss->modifiers_active) {
+  if (ss->deform_modifiers_active) {
     if (!ss->orig_cos) {
       int a;
 
       BKE_sculptsession_free_deformMats(ss);
 
-      ss->orig_cos = (ss->kb) ? BKE_keyblock_convert_to_vertcos(ob, ss->kb) :
-                                BKE_mesh_vert_coords_alloc(me, NULL);
+      ss->orig_cos = (ss->shapekey_active) ?
+                         BKE_keyblock_convert_to_vertcos(ob, ss->shapekey_active) :
+                         BKE_mesh_vert_coords_alloc(me, NULL);
 
       BKE_crazyspace_build_sculpt(depsgraph, scene, ob, &ss->deform_imats, &ss->deform_cos);
       BKE_pbvh_vert_coords_apply(ss->pbvh, ss->deform_cos, me->totvert);
@@ -1261,15 +1262,15 @@ static void sculpt_update_object(
     BKE_sculptsession_free_deformMats(ss);
   }
 
-  if (ss->kb != NULL && ss->deform_cos == NULL) {
-    ss->deform_cos = BKE_keyblock_convert_to_vertcos(ob, ss->kb);
+  if (ss->shapekey_active != NULL && ss->deform_cos == NULL) {
+    ss->deform_cos = BKE_keyblock_convert_to_vertcos(ob, ss->shapekey_active);
   }
 
   /* if pbvh is deformed, key block is already applied to it */
-  if (ss->kb) {
+  if (ss->shapekey_active) {
     bool pbvh_deformed = BKE_pbvh_is_deformed(ss->pbvh);
     if (!pbvh_deformed || ss->deform_cos == NULL) {
-      float(*vertCos)[3] = BKE_keyblock_convert_to_vertcos(ob, ss->kb);
+      float(*vertCos)[3] = BKE_keyblock_convert_to_vertcos(ob, ss->shapekey_active);
 
       if (vertCos) {
         if (!pbvh_deformed) {
@@ -1448,17 +1449,17 @@ static bool check_sculpt_object_deformed(Object *object, const bool for_construc
    * on birth of PBVH and sculpt "layer" levels, so use PBVH only for internal brush
    * stuff and show final evaluated mesh so user would see actual object shape.
    */
-  deformed |= object->sculpt->modifiers_active;
+  deformed |= object->sculpt->deform_modifiers_active;
 
   if (for_construction) {
-    deformed |= object->sculpt->kb != NULL;
+    deformed |= object->sculpt->shapekey_active != NULL;
   }
   else {
     /* As in case with modifiers, we can't synchronize deformation made against
      * PBVH and non-locked keyblock, so also use PBVH only for brushes and
      * final DM to give final result to user.
      */
-    deformed |= object->sculpt->kb && (object->shapeflag & OB_SHAPE_LOCK) == 0;
+    deformed |= object->sculpt->shapekey_active && (object->shapeflag & OB_SHAPE_LOCK) == 0;
   }
 
   return deformed;
@@ -1587,7 +1588,7 @@ bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const View3D *v3d)
   if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
     /* Regular mesh only draws from PBVH without modifiers and shape keys. */
     const bool full_shading = (v3d && (v3d->shading.type > OB_SOLID));
-    return !(ss->kb || ss->modifiers_active || full_shading);
+    return !(ss->shapekey_active || ss->deform_modifiers_active || full_shading);
   }
   else {
     /* Multires and dyntopo always draw directly from the PBVH. */
diff --git a/source/blender/draw/modes/sculpt_mode.c b/source/blender/draw/modes/sculpt_mode.c
index 1b196cd8bb7..f83a8f542c6 100644
--- a/source/blender/draw/modes/sculpt_mode.c
+++ b/source/blender/draw/modes/sculpt_mode.c
@@ -155,8 +155,8 @@ static void SCULPT_cache_populate(void *vedata, Object *ob)
   if (ob->sculpt) {
     const DRWContextState *draw_ctx = DRW_context_state_get();
 
-    if ((ob == draw_ctx->obact) &&
-        (BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) || !ob->sculpt->modifiers_active)) {
+    if ((ob == draw_ctx->obact) && (BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) ||
+                                    !ob->sculpt->deform_modifiers_active)) {
       PBVH *pbvh = ob->sculpt->pbvh;
       if (pbvh && pbvh_has_mask(pbvh)) {
         DRW_shgroup_call_sculpt(stl->g_data->mask_overlay_grp, ob, false, true, false);
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 16f07923a3a..b4956864723 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1439,7 +1439,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
           GPU_matrix_mul(vc.obact->obmat);
           if (brush->sculpt_tool == SCULPT_TOOL_GRAB && (brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) &&
               !is_multires) {
-            if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES && ss->modifiers_active) {
+            if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES && ss->deform_modifiers_active) {
               sculpt_geometry_preview_lines_update(C, ss, rds);
               sculpt_geometry_preview_lines_draw(pos, ss);
             }
@@ -1492,7 +1492,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
           /* Draw cached dynamic mesh preview lines */
           if (brush->sculpt_tool == SCULPT_TOOL_GRAB && (brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) &&
               !is_multires) {
-            if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES && ss->modifiers_active) {
+            if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES && ss->deform_modifiers_active) {
               GPU_matrix_push_projection();
               ED_view3d_draw_setup_view(CTX_wm_window(C),
                                         CTX_data_depsgraph_pointer(C),
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index cfbf3130e30..2498f3c270c 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5459,7 +5459,7 @@ static void sculpt_flush_pbvhvert_deform(Object *ob, PBVHVertexIter *vd)
   copy_v3_v3(ss->deform_cos[index], vd->co);
   copy_v3_v3(ss->orig_cos[index], newco);
 
-  if (!ss->kb) {
+  if (!ss->shapekey_active) {
     copy_v3_v3(me->mvert[index].co, newco);
   }
 }
@@ -5515,7 +5515,7 @@ static void sculpt_combine_proxies_task_cb(void *__restrict userdata,
 
     sculpt_clip(sd, ss, vd.co, val);
 
-    if (ss->modifiers_active) {
+    if (ss->deform_modifiers_active) {
       sculpt_flush_pbvhvert_deform(ob, &vd);
     }
   }
@@ -5566,7 +5566,7 @@ static void sculpt_update_keyblock(Object *ob)
   }
 
   if (vertCos) {
-    sculpt_vertcos_to_key(ob, ss->kb, vertCos);
+    sculpt_vertcos_to_key(ob, ss->shapekey_active, vertCos);
 
     if (vertCos != ss->orig_cos) {
       MEM_freeN(vertCos);
@@ -5612,7 +5612,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_use
     PBVHNode **nodes;
     float(*vertCos)[3] = NULL;
 
-    if (ss->kb) {
+    if (ss->shapekey_active) {
       vertCos = MEM_mallocN(sizeof(*vertCos) * me->totvert, "flushStrokeDeofrm keyVerts");
 
       /* mesh could have isolated verts which wouldn't be in BVH,
@@ -5637,7 +5637,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_use
     BLI_task_parallel_range(0, totnode, &data, sculpt_flush_stroke_deform_task_cb, &settings);
 
     if (vertCos) {
-      sculpt_vertcos_to_key(ob, ss->kb, vertCos);
+      sculpt_vertcos_to_key(ob, ss->shapekey_active, vertCos);
       MEM_freeN(vertCos);
     }
 
@@ -5648,7 +5648,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_use
      * after applying coords from keyblock on base mesh */
     BKE_mesh_calc_normals(me);
   }
-  else if (ss->kb) {
+  else if (ss->shapekey_active) {
     sculpt_update_keyblock(ob);
   }
 }
@@ -6412,7 +6412,8 @@ static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob, const B
   View3D *v3d = CTX_wm_view3d(C);
 
   bool need_pmap = sculpt_needs_conectivity_info(brush, ss, 0);
-  if (ss->kb || ss->modifiers_active || (!BKE_sculptsession_use_pbvh_draw(ob, v3d) && need_pmap)) {
+  if (ss->shapekey_active || s

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list