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
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2018-06-10 17:21:26 +0300
committerJoshua Leung <aligorith@gmail.com>2018-06-10 17:49:38 +0300
commitca16c74e8705d91d043ec1223a2968a7217d34b7 (patch)
tree3a2ce1b3b777b1e19ce90c570df51fe9e115f98f /source
parent937e4fb49ade28ec4b800b8ee216dbbe874f3ca1 (diff)
Viewport: "Show Relationship Lines" overlay toggle is now respected by Object Mode & Armatures (Edit/Pose)
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/intern/draw_armature.c35
-rw-r--r--source/blender/draw/modes/object_mode.c5
2 files changed, 27 insertions, 13 deletions
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);