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/draw/engines/overlay/overlay_engine.c')
-rw-r--r--source/blender/draw/engines/overlay/overlay_engine.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c
index 97f6b91b7a9..61337ac8d1d 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.c
+++ b/source/blender/draw/engines/overlay/overlay_engine.c
@@ -30,6 +30,7 @@
#include "ED_view3d.h"
#include "BKE_object.h"
+#include "BKE_paint.h"
#include "overlay_engine.h"
#include "overlay_private.h"
@@ -45,6 +46,8 @@ static void OVERLAY_engine_init(void *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
const RegionView3D *rv3d = draw_ctx->rv3d;
const View3D *v3d = draw_ctx->v3d;
+ const Scene *scene = draw_ctx->scene;
+ const ToolSettings *ts = scene->toolsettings;
if (!stl->pd) {
/* Alloc transient pointers */
@@ -69,12 +72,24 @@ static void OVERLAY_engine_init(void *vedata)
pd->overlay.flag = V3D_OVERLAY_HIDE_TEXT | V3D_OVERLAY_HIDE_MOTION_PATHS |
V3D_OVERLAY_HIDE_BONES | V3D_OVERLAY_HIDE_OBJECT_XTRAS |
V3D_OVERLAY_HIDE_OBJECT_ORIGINS;
+ pd->overlay.wireframe_threshold = v3d->overlay.wireframe_threshold;
}
if (v3d->shading.type == OB_WIRE) {
pd->overlay.flag |= V3D_OVERLAY_WIREFRAMES;
}
+ if (ts->sculpt) {
+ if (ts->sculpt->flags & SCULPT_HIDE_FACE_SETS) {
+ pd->overlay.sculpt_mode_face_sets_opacity = 0.0f;
+ }
+ if (ts->sculpt->flags & SCULPT_HIDE_MASK) {
+ pd->overlay.sculpt_mode_mask_opacity = 0.0f;
+ }
+ }
+
+ pd->use_in_front = (v3d->shading.type <= OB_SOLID) ||
+ BKE_scene_uses_blender_workbench(draw_ctx->scene);
pd->wireframe_mode = (v3d->shading.type == OB_WIRE);
pd->clipping_state = RV3D_CLIPPING_ENABLED(v3d, rv3d) ? DRW_STATE_CLIP_PLANES : 0;
pd->xray_opacity = XRAY_ALPHA(v3d);
@@ -110,6 +125,11 @@ static void OVERLAY_cache_init(void *vedata)
switch (pd->ctx_mode) {
case CTX_MODE_EDIT_MESH:
OVERLAY_edit_mesh_cache_init(vedata);
+ /* `pd->edit_mesh.flag` is valid after calling `OVERLAY_edit_mesh_cache_init`. */
+ const bool draw_edit_weights = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_WEIGHT);
+ if (draw_edit_weights) {
+ OVERLAY_paint_cache_init(vedata);
+ }
break;
case CTX_MODE_EDIT_SURFACE:
case CTX_MODE_EDIT_CURVE:
@@ -226,10 +246,12 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
const bool renderable = DRW_object_is_renderable(ob);
const bool in_pose_mode = ob->type == OB_ARMATURE && OVERLAY_armature_is_pose_mode(ob, draw_ctx);
const bool in_edit_mode = overlay_object_is_edit_mode(pd, ob);
- const bool in_particle_edit_mode = ob->mode == OB_MODE_PARTICLE_EDIT;
+ const bool in_particle_edit_mode = (ob->mode == OB_MODE_PARTICLE_EDIT) &&
+ (pd->ctx_mode == CTX_MODE_PARTICLE);
const bool in_paint_mode = (ob == draw_ctx->obact) &&
(draw_ctx->object_mode & OB_MODE_ALL_PAINT);
- const bool in_sculpt_mode = (ob == draw_ctx->obact) && (ob->sculpt != NULL);
+ const bool in_sculpt_mode = (ob == draw_ctx->obact) && (ob->sculpt != NULL) &&
+ (ob->sculpt->mode_type == OB_MODE_SCULPT);
const bool has_surface = ELEM(ob->type,
OB_MESH,
OB_CURVE,
@@ -241,7 +263,8 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
OB_POINTCLOUD,
OB_VOLUME);
const bool draw_surface = (ob->dt >= OB_WIRE) && (renderable || (ob->dt == OB_WIRE));
- const bool draw_facing = draw_surface && (pd->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION);
+ const bool draw_facing = draw_surface && (pd->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION) &&
+ !is_select;
const bool draw_bones = (pd->overlay.flag & V3D_OVERLAY_HIDE_BONES) == 0;
const bool draw_wires = draw_surface && has_surface &&
(pd->wireframe_mode || !pd->hide_overlays);
@@ -250,6 +273,7 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
(ob->base_flag & BASE_SELECTED);
const bool draw_bone_selection = (ob->type == OB_MESH) && pd->armature.do_pose_fade_geom &&
!is_select;
+ const bool draw_edit_weights = in_edit_mode && (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_WEIGHT);
const bool draw_extras =
(!pd->hide_overlays) &&
(((pd->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS) == 0) ||
@@ -278,6 +302,9 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
switch (ob->type) {
case OB_MESH:
OVERLAY_edit_mesh_cache_populate(vedata, ob);
+ if (draw_edit_weights) {
+ OVERLAY_paint_weight_cache_populate(vedata, ob);
+ }
break;
case OB_ARMATURE:
if (draw_bones) {
@@ -469,6 +496,12 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_xray_depth_infront_copy(vedata);
if (DRW_state_is_fbo()) {
+ GPU_framebuffer_bind(fbl->overlay_in_front_fb);
+ }
+
+ OVERLAY_facing_infront_draw(vedata);
+
+ if (DRW_state_is_fbo()) {
GPU_framebuffer_bind(fbl->overlay_line_in_front_fb);
}
@@ -485,7 +518,7 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_motion_path_draw(vedata);
OVERLAY_extra_centers_draw(vedata);
- if (DRW_state_is_select()) {
+ if (DRW_state_is_select() || DRW_state_is_depth()) {
/* Edit modes have their own selection code. */
return;
}
@@ -494,6 +527,7 @@ static void OVERLAY_draw_scene(void *vedata)
switch (pd->ctx_mode) {
case CTX_MODE_EDIT_MESH:
+ OVERLAY_paint_draw(vedata);
OVERLAY_edit_mesh_draw(vedata);
break;
case CTX_MODE_EDIT_SURFACE: