Commit: ca16c74e8705d91d043ec1223a2968a7217d34b7
Author: Joshua Leung
Date:   Mon Jun 11 02:21:26 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBca16c74e8705d91d043ec1223a2968a7217d34b7

Viewport: "Show Relationship Lines" overlay toggle is now respected by Object 
Mode & Armatures (Edit/Pose)

===================================================================

M       source/blender/draw/intern/draw_armature.c
M       source/blender/draw/modes/object_mode.c

===================================================================

diff --git a/source/blender/draw/intern/draw_armature.c 
b/source/blender/draw/intern/draw_armature.c
index a736f0a31fb..82662d77020 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -1462,6 +1462,10 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, 
const bool only_temp, const
                                bSplineIKConstraint *data = 
(bSplineIKConstraint *)con->data;
                                int segcount = 0;
 
+                               /* don't draw if only_temp, as Spline IK chains 
cannot be temporary */
+                               if (only_temp)
+                                       continue;
+
                                parchan = pchan;
                                line_start = parchan->pose_tail;
 
@@ -1489,17 +1493,24 @@ static void draw_bone_relations(
 {
        if (g_data.passes.relationship_lines) {
                if (ebone && ebone->parent) {
-                       if ((boneflag & BONE_CONNECTED) == 0) {
-                               
drw_shgroup_bone_relationship_lines(ebone->head, ebone->parent->tail);
+                       if (do_relations) {
+                               /* Always draw for unconnected bones, 
regardless of selection,
+                                * since riggers will want to know about the 
links between bones
+                                */
+                               if ((boneflag & BONE_CONNECTED) == 0) {
+                                       
drw_shgroup_bone_relationship_lines(ebone->head, ebone->parent->tail);
+                               }
                        }
                }
                else if (pchan && pchan->parent) {
-                       /* Only draw if bone or its parent is selected - 
reduces viewport complexity with complex rigs */
-                       if ((boneflag & BONE_SELECTED) ||
-                           (pchan->parent->bone && (pchan->parent->bone->flag 
& BONE_SELECTED)))
-                       {
-                               if ((boneflag & BONE_CONNECTED) == 0) {
-                                       
drw_shgroup_bone_relationship_lines(pchan->pose_head, pchan->parent->pose_tail);
+                       if (do_relations) {
+                               /* Only draw if bone or its parent is selected 
- reduces viewport complexity with complex rigs */
+                               if ((boneflag & BONE_SELECTED) ||
+                                   (pchan->parent->bone && 
(pchan->parent->bone->flag & BONE_SELECTED)))
+                               {
+                                       if ((boneflag & BONE_CONNECTED) == 0) {
+                                               
drw_shgroup_bone_relationship_lines(pchan->pose_head, pchan->parent->pose_tail);
+                                       }
                                }
                        }
 
@@ -1523,6 +1534,7 @@ static void draw_bone_relations(
 
 static void draw_armature_edit(Object *ob)
 {
+       const DRWContextState *draw_ctx = DRW_context_state_get();
        EditBone *eBone;
        bArmature *arm = ob->data;
        int index;
@@ -1531,7 +1543,7 @@ static void draw_armature_edit(Object *ob)
        update_color(ob, NULL);
 
        const bool show_text = DRW_state_show_text();
-       const bool show_relations = true; /* TODO get value from overlays 
settings. */
+       const bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) 
== 0);
 
        for (eBone = arm->edbo->first, index = ob->select_color; eBone; eBone = 
eBone->next, index += 0x10000) {
                if (eBone->layer & arm->layer) {
@@ -1601,6 +1613,7 @@ static void draw_armature_edit(Object *ob)
 /* if const_color is NULL do pose mode coloring */
 static void draw_armature_pose(Object *ob, const float const_color[4])
 {
+       const DRWContextState *draw_ctx = DRW_context_state_get();
        bArmature *arm = ob->data;
        bPoseChannel *pchan;
        int index = -1;
@@ -1615,8 +1628,6 @@ static void draw_armature_pose(Object *ob, const float 
const_color[4])
 
        // if (!(base->flag & OB_FROMDUPLI)) // TODO
        {
-               const DRWContextState *draw_ctx = DRW_context_state_get();
-
                if ((draw_ctx->object_mode & OB_MODE_POSE) || (ob == 
draw_ctx->object_pose)) {
                        arm->flag |= ARM_POSEMODE;
                }
@@ -1628,7 +1639,7 @@ static void draw_armature_pose(Object *ob, const float 
const_color[4])
 
        const bool is_pose_select = (arm->flag & ARM_POSEMODE) && 
DRW_state_is_select();
        const bool show_text = DRW_state_show_text();
-       const bool show_relations = true; /* TODO get value from overlays 
settings. */
+       const bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) 
== 0);
 
        /* being set below */
        for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index ba44e5dea10..e563af4c3b1 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -2078,6 +2078,7 @@ static void OBJECT_cache_populate(void *vedata, Object 
*ob)
        }
 
        bool do_outlines = ((ob->base_flag & BASE_SELECTED) != 0);
+       bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0);
 
        if (do_outlines) {
                if ((ob != draw_ctx->object_edit) && !((ob == draw_ctx->obact) 
&& (draw_ctx->object_mode & OB_MODE_ALL_PAINT))) {
@@ -2203,7 +2204,9 @@ static void OBJECT_cache_populate(void *vedata, Object 
*ob)
 
                DRW_shgroup_object_center(stl, ob, view_layer, v3d);
 
-               DRW_shgroup_relationship_lines(stl, ob);
+               if (show_relations) {
+                       DRW_shgroup_relationship_lines(stl, ob);
+               }
 
                if ((ob->dtx != 0) && theme_id == TH_UNDEFINED) {
                        theme_id = DRW_object_wire_theme_get(ob, view_layer, 
NULL);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to