diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-05-17 15:33:34 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-05-17 15:33:34 +0300 |
commit | d0ceb1821bb202fdd0ebd82539abc7ae7a395b02 (patch) | |
tree | 64003d4972fe62174de9b4a1501a2b886a662ef1 /source/blender/draw/modes | |
parent | 3c799ba8013405142430d7e20c272fe92457852d (diff) |
DwM: Armature: fix bone distance outline drawing.
This indeed needed its own draw pass, thank to @fclem for the hints!
Also fixes a stupid mistake in bones head/tail coloring.
Diffstat (limited to 'source/blender/draw/modes')
-rw-r--r-- | source/blender/draw/modes/edit_armature_mode.c | 11 | ||||
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 10 | ||||
-rw-r--r-- | source/blender/draw/modes/pose_mode.c | 10 |
3 files changed, 28 insertions, 3 deletions
diff --git a/source/blender/draw/modes/edit_armature_mode.c b/source/blender/draw/modes/edit_armature_mode.c index 7d13dbd78ee..3487ceba141 100644 --- a/source/blender/draw/modes/edit_armature_mode.c +++ b/source/blender/draw/modes/edit_armature_mode.c @@ -38,6 +38,7 @@ extern GlobalsUboStorage ts; typedef struct EDIT_ARMATURE_PassList { struct DRWPass *bone_solid; struct DRWPass *bone_wire; + struct DRWPass *bone_envelope; struct DRWPass *relationship; } EDIT_ARMATURE_PassList; @@ -84,6 +85,12 @@ static void EDIT_ARMATURE_cache_init(void *vedata) } { + /* distance outline around envelope bones */ + DRWState state = DRW_STATE_ADDITIVE | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS | DRW_STATE_BLEND; + psl->bone_envelope = DRW_pass_create("Bone Envelope Outline Pass", state); + } + + { /* Non Meshes Pass (Camera, empties, lamps ...) */ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_BLEND | DRW_STATE_WIRE; psl->relationship = DRW_pass_create("Bone Relationship Pass", state); @@ -102,7 +109,8 @@ static void EDIT_ARMATURE_cache_populate(void *vedata, Object *ob) if (ob->type == OB_ARMATURE) { if (arm->edbo) { - DRW_shgroup_armature_edit(ob, psl->bone_solid, psl->bone_wire, stl->g_data->relationship_lines); + DRW_shgroup_armature_edit( + ob, psl->bone_solid, psl->bone_wire, psl->bone_envelope, stl->g_data->relationship_lines); } } } @@ -111,6 +119,7 @@ static void EDIT_ARMATURE_draw_scene(void *vedata) { EDIT_ARMATURE_PassList *psl = ((EDIT_ARMATURE_Data *)vedata)->psl; + DRW_draw_pass(psl->bone_envelope); DRW_draw_pass(psl->bone_solid); DRW_draw_pass(psl->bone_wire); DRW_draw_pass(psl->relationship); diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index f7ffa7bbbb2..0a781e61b19 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -77,6 +77,7 @@ typedef struct OBJECT_PassList { struct DRWPass *grid; struct DRWPass *bone_solid; struct DRWPass *bone_wire; + struct DRWPass *bone_envelope; } OBJECT_PassList; typedef struct OBJECT_FramebufferList { @@ -603,6 +604,12 @@ static void OBJECT_cache_init(void *vedata) } { + /* distance outline around envelope bones */ + DRWState state = DRW_STATE_ADDITIVE | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS | DRW_STATE_BLEND; + psl->bone_envelope = DRW_pass_create("Bone Envelope Outline Pass", state); + } + + { /* Non Meshes Pass (Camera, empties, lamps ...) */ struct Batch *geom; @@ -1250,7 +1257,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) if (arm->edbo == NULL) { if (DRW_state_is_select() || !DRW_pose_mode_armature(ob, draw_ctx->obact)) { DRW_shgroup_armature_object( - ob, sl, psl->bone_solid, psl->bone_wire, + ob, sl, psl->bone_solid, psl->bone_wire, psl->bone_envelope, stl->g_data->relationship_lines); } } @@ -1340,6 +1347,7 @@ static void OBJECT_draw_scene(void *vedata) } /* This needs to be drawn after the oultine */ +// DRW_draw_pass(psl->bone_envelope); /* Never drawn in Object mode currently. */ DRW_draw_pass(psl->bone_wire); DRW_draw_pass(psl->bone_solid); DRW_draw_pass(psl->non_meshes); diff --git a/source/blender/draw/modes/pose_mode.c b/source/blender/draw/modes/pose_mode.c index b83f78d8896..d3233d713a1 100644 --- a/source/blender/draw/modes/pose_mode.c +++ b/source/blender/draw/modes/pose_mode.c @@ -45,6 +45,7 @@ extern GlobalsUboStorage ts; typedef struct POSE_PassList { struct DRWPass *bone_solid; struct DRWPass *bone_wire; + struct DRWPass *bone_envelope; struct DRWPass *relationship; } POSE_PassList; @@ -93,6 +94,12 @@ static void POSE_cache_init(void *vedata) } { + /* distance outline around envelope bones */ + DRWState state = DRW_STATE_ADDITIVE | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS | DRW_STATE_BLEND; + psl->bone_envelope = DRW_pass_create("Bone Envelope Outline Pass", state); + } + + { /* Non Meshes Pass (Camera, empties, lamps ...) */ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_BLEND | DRW_STATE_WIRE; psl->relationship = DRW_pass_create("Bone Relationship Pass", state); @@ -116,7 +123,7 @@ static void POSE_cache_populate(void *vedata, Object *ob) if (ob->type == OB_ARMATURE) { if (DRW_pose_mode_armature(ob, draw_ctx->obact)) { DRW_shgroup_armature_pose( - ob, psl->bone_solid, psl->bone_wire, + ob, psl->bone_solid, psl->bone_wire, psl->bone_envelope, stl->g_data->relationship_lines); } } @@ -147,6 +154,7 @@ static void POSE_draw_scene(void *vedata) { POSE_PassList *psl = ((POSE_Data *)vedata)->psl; + DRW_draw_pass(psl->bone_envelope); DRW_draw_pass(psl->bone_wire); DRW_draw_pass(psl->bone_solid); DRW_draw_pass(psl->relationship); |