Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_cursor.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index b8af33fb7cc..a4101bdd89f 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1508,6 +1508,43 @@ static void paint_cursor_pose_brush_origins_draw(PaintCursorContext *pcontext)
}
}
+static void paint_cursor_preview_boundary_data_pivot_draw(PaintCursorContext *pcontext)
+{
+
+ if (!pcontext->ss->boundary_preview) {
+ /* There is no guarantee that a boundary preview exists as there may be no boundaries
+ * inside the brush radius. */
+ return;
+ }
+ immUniformColor4f(1.0f, 1.0f, 1.0f, 0.8f);
+ cursor_draw_point_screen_space(
+ pcontext->pos,
+ pcontext->region,
+ SCULPT_vertex_co_get(pcontext->ss, pcontext->ss->boundary_preview->pivot_vertex),
+ pcontext->vc.obact->obmat,
+ 3);
+}
+
+static void paint_cursor_preview_boundary_data_update(PaintCursorContext *pcontext,
+ const bool update_previews)
+{
+ SculptSession *ss = pcontext->ss;
+ if (!(update_previews || !ss->boundary_preview)) {
+ return;
+ }
+
+ /* Needed for updating the necessary SculptSession data in order to initialize the
+ * boundary data for the preview. */
+ BKE_sculpt_update_object_for_edit(pcontext->depsgraph, pcontext->vc.obact, true, false, false);
+
+ if (ss->boundary_preview) {
+ SCULPT_boundary_data_free(ss->boundary_preview);
+ }
+
+ ss->boundary_preview = SCULPT_boundary_data_init(
+ pcontext->vc.obact, ss->active_vertex_index, pcontext->radius);
+}
+
static void paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext *pcontext)
{
Brush *brush = pcontext->brush;
@@ -1577,6 +1614,11 @@ static void paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext *
paint_cursor_pose_brush_origins_draw(pcontext);
}
+ if (brush->sculpt_tool == SCULPT_TOOL_BOUNDARY) {
+ paint_cursor_preview_boundary_data_update(pcontext, update_previews);
+ paint_cursor_preview_boundary_data_pivot_draw(pcontext);
+ }
+
/* Setup 3D perspective drawing. */
GPU_matrix_push_projection();
ED_view3d_draw_setup_view(pcontext->wm,
@@ -1603,6 +1645,12 @@ static void paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext *
paint_cursor_pose_brush_segments_draw(pcontext);
}
+ if (brush->sculpt_tool == SCULPT_TOOL_BOUNDARY) {
+ SCULPT_boundary_edges_preview_draw(
+ pcontext->pos, pcontext->ss, pcontext->outline_col, pcontext->outline_alpha);
+ SCULPT_boundary_pivot_line_preview_draw(pcontext->pos, pcontext->ss);
+ }
+
GPU_matrix_pop();
/* Drawing Cursor overlays in Paint Cursor space (as additional info on top of the brush cursor)