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.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c
index 9cdd371ec4e..e49b2e45580 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.c
+++ b/source/blender/draw/engines/overlay/overlay_engine.c
@@ -66,6 +66,7 @@ static void OVERLAY_engine_init(void *vedata)
pd->is_image_editor = sima != NULL;
if (pd->is_image_editor) {
+ pd->hide_overlays = (sima->overlay.flag & SI_OVERLAY_SHOW_OVERLAYS) == 0;
pd->clipping_state = 0;
OVERLAY_grid_init(data);
OVERLAY_edit_uv_init(data);
@@ -196,6 +197,7 @@ static void OVERLAY_cache_init(void *vedata)
OVERLAY_antialiasing_cache_init(vedata);
OVERLAY_armature_cache_init(vedata);
OVERLAY_background_cache_init(vedata);
+ OVERLAY_fade_cache_init(vedata);
OVERLAY_extra_cache_init(vedata);
OVERLAY_facing_cache_init(vedata);
OVERLAY_gpencil_cache_init(vedata);
@@ -206,6 +208,7 @@ static void OVERLAY_cache_init(void *vedata)
OVERLAY_outline_cache_init(vedata);
OVERLAY_particle_cache_init(vedata);
OVERLAY_wireframe_cache_init(vedata);
+ OVERLAY_volume_cache_init(vedata);
}
BLI_INLINE OVERLAY_DupliData *OVERLAY_duplidata_get(Object *ob, void *vedata, bool *do_init)
@@ -259,6 +262,27 @@ static bool overlay_object_is_edit_mode(const OVERLAY_PrivateData *pd, const Obj
return false;
}
+static bool overlay_should_fade_object(Object *ob, Object *active_object)
+{
+ if (!active_object || !ob) {
+ return false;
+ }
+
+ if (ELEM(active_object->mode, OB_MODE_OBJECT, OB_MODE_POSE)) {
+ return false;
+ }
+
+ if ((active_object->mode & ob->mode) != 0) {
+ return false;
+ }
+
+ if (ob->base_flag & BASE_FROM_DUPLI) {
+ return false;
+ }
+
+ return true;
+}
+
static void OVERLAY_cache_populate(void *vedata, Object *ob)
{
OVERLAY_Data *data = vedata;
@@ -295,6 +319,8 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
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) &&
!is_select;
+ const bool draw_fade = draw_surface && (pd->overlay.flag & V3D_OVERLAY_FADE_INACTIVE) &&
+ overlay_should_fade_object(ob, draw_ctx->obact);
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);
@@ -315,6 +341,9 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
bool do_init;
OVERLAY_DupliData *dupli = OVERLAY_duplidata_get(ob, vedata, &do_init);
+ if (draw_fade) {
+ OVERLAY_fade_cache_populate(vedata, ob);
+ }
if (draw_facing) {
OVERLAY_facing_cache_populate(vedata, ob);
}
@@ -328,6 +357,10 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
OVERLAY_pose_cache_populate(vedata, ob);
}
+ if (ob->type == OB_VOLUME) {
+ OVERLAY_volume_cache_populate(vedata, ob);
+ }
+
if (in_edit_mode && !pd->hide_overlays) {
switch (ob->type) {
case OB_MESH:
@@ -451,7 +484,7 @@ static void OVERLAY_cache_finish(void *vedata)
return;
}
- /* TODO(fclem) Only do this when really needed. */
+ /* TODO(fclem): Only do this when really needed. */
{
/* HACK we allocate the in front depth here to avoid the overhead when if is not needed. */
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
@@ -476,6 +509,11 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_FramebufferList *fbl = data->fbl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
+ /* Needs to be done first as it modifies the scene color and depth buffer. */
+ if (!pd->is_image_editor) {
+ OVERLAY_image_scene_background_draw(vedata);
+ }
+
if (DRW_state_is_fbo()) {
const float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
GPU_framebuffer_bind(dfbl->overlay_only_fb);
@@ -511,8 +549,10 @@ static void OVERLAY_draw_scene(void *vedata)
}
OVERLAY_image_draw(vedata);
+ OVERLAY_fade_draw(vedata);
OVERLAY_facing_draw(vedata);
OVERLAY_extra_blend_draw(vedata);
+ OVERLAY_volume_draw(vedata);
if (DRW_state_is_fbo()) {
GPU_framebuffer_bind(fbl->overlay_line_fb);
@@ -538,6 +578,7 @@ static void OVERLAY_draw_scene(void *vedata)
GPU_framebuffer_bind(fbl->overlay_in_front_fb);
}
+ OVERLAY_fade_infront_draw(vedata);
OVERLAY_facing_infront_draw(vedata);
if (DRW_state_is_fbo()) {