Commit: 7941ea02f8dab19f698dbd89922377db3bd00ac0
Author: Pablo Dobarro
Date:   Fri Mar 13 02:09:23 2020 +0100
Branches: master
https://developer.blender.org/rB7941ea02f8dab19f698dbd89922377db3bd00ac0

Update viewport rotation origin when changing Face Set visibility

Small UX fix. When hidding everything but the active face set with H,
the last stroke lotation center can be in a part of the model that is
hidden, so viewport navigation becomes confusing until you start a new
stroke on the visible face set. Now the viewport navigation rotation
center is updated to the active vertex when using a visibility operation
that uses it, so it always rotates using the visible face set as the
origin.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7137

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

M       source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 68d44472dc5..79c4becd405 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -11042,6 +11042,18 @@ static int 
sculpt_face_sets_change_visibility_invoke(bContext *C,
     SCULPT_face_sets_visibility_invert(ss);
   }
 
+  /* For modes that use the cursor active vertex, update the rotation origin 
for viewport
+   * navigation. */
+  if (ELEM(mode, SCULPT_FACE_SET_VISIBILITY_TOGGLE, 
SCULPT_FACE_SET_VISIBILITY_SHOW_ACTIVE)) {
+    UnifiedPaintSettings *ups = 
&CTX_data_tool_settings(C)->unified_paint_settings;
+    float location[3];
+    copy_v3_v3(location, SCULPT_active_vertex_co_get(ss));
+    mul_m4_v3(ob->obmat, location);
+    copy_v3_v3(ups->average_stroke_accum, location);
+    ups->average_stroke_counter = 1;
+    ups->last_stroke_valid = true;
+  }
+
   /* Sync face sets visibility and vertex visibility. */
   SCULPT_visibility_sync_all_face_sets_to_vertices(ss);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to