diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-13 04:09:23 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-16 19:42:52 +0300 |
commit | 7941ea02f8dab19f698dbd89922377db3bd00ac0 (patch) | |
tree | 55e1676d47a326b1096d89f6e8ebb904d13696ce /source/blender/editors | |
parent | ba26adee0c5caa6d4f3ffbda9c7038e807e3f9d2 (diff) |
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
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 12 |
1 files changed, 12 insertions, 0 deletions
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); |