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:
authorClément Foucault <foucault.clem@gmail.com>2018-05-07 16:10:11 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-05-07 18:00:10 +0300
commit8ab3697e2107b955e188f4dec9d264df98e23d97 (patch)
tree7a4ebd8371a6d696b80b0515cb537e04bca03035 /source/blender/draw/modes/pose_mode.c
parent2f76e95b96fc87a8ec598c5f8a9242bc220ad9c2 (diff)
Armature: Add new Transparent Bone overlay option.
This is half the replacement of the old wireframe mode. It's not doing any XRay drawing at the moment.
Diffstat (limited to 'source/blender/draw/modes/pose_mode.c')
-rw-r--r--source/blender/draw/modes/pose_mode.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/draw/modes/pose_mode.c b/source/blender/draw/modes/pose_mode.c
index 18318046869..a7fc1da959b 100644
--- a/source/blender/draw/modes/pose_mode.c
+++ b/source/blender/draw/modes/pose_mode.c
@@ -25,6 +25,7 @@
#include "DRW_engine.h"
#include "DRW_render.h"
+#include "DNA_view3d_types.h"
/* If builtin shaders are needed */
#include "GPU_shader.h"
@@ -85,7 +86,7 @@ static void POSE_cache_init(void *vedata)
{
/* Solid bones */
- DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS;
+ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_CULL_BACK;
psl->bone_solid = DRW_pass_create("Bone Solid Pass", state);
}
@@ -175,14 +176,25 @@ static void POSE_draw_scene(void *vedata)
POSE_PassList *psl = ((POSE_Data *)vedata)->psl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ const bool transparent_bones = (draw_ctx->v3d->overlay.arm_flag & V3D_OVERLAY_ARM_TRANSP_BONES) != 0;
DRW_draw_pass(psl->bone_envelope);
+ if (transparent_bones) {
+ DRW_pass_state_add(psl->bone_solid, DRW_STATE_BLEND);
+ DRW_pass_state_remove(psl->bone_solid, DRW_STATE_WRITE_DEPTH);
+ DRW_draw_pass(psl->bone_solid);
+ }
+
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl)
+ if (!transparent_bones) {
+ DRW_draw_pass(psl->bone_solid);
+ }
+
DRW_draw_pass(psl->bone_outline);
DRW_draw_pass(psl->bone_wire);
- DRW_draw_pass(psl->bone_solid);
DRW_draw_pass(psl->relationship);
MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl)