Merge branch 'blender2.7'
[blender.git] / source / blender / draw / intern / draw_armature.c
index 8d0cae3cc4a8bf5d6cd4507df94f72f2c5c13f57..f22350113e7890e90b16d1fd6990e875abbc4b67 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * Copyright 2016, Blender Foundation.
- *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributor(s): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
  */
 
-/** \file draw_armature.c
- *  \ingroup draw
+/** \file
+ * \ingroup draw
  */
 
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
 
-#include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
 #include "DNA_view3d_types.h"
 #include "DNA_object_types.h"
 
 #include "DRW_render.h"
 
-#include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_dlrbTree.h"
 #include "BLI_utildefines.h"
 
-#include "BKE_animsys.h"
-#include "BKE_action.h"
 #include "BKE_armature.h"
-#include "BKE_global.h"
-#include "BKE_modifier.h"
-#include "BKE_nla.h"
-#include "BKE_curve.h"
 
-#include "BIF_gl.h"
 
 #include "ED_armature.h"
-#include "ED_keyframes_draw.h"
 
-#include "GPU_select.h"
 
 #include "UI_resources.h"
 
@@ -128,23 +112,24 @@ static struct {
 
 
 /* -------------------------------------------------------------------- */
-
 /** \name Shader Groups (DRW_shgroup)
  * \{ */
 
 /* Octahedral */
 static void drw_shgroup_bone_octahedral(
         const float (*bone_mat)[4],
-        const float bone_color[4], const float hint_color[4], const float outline_color[4])
+        const float bone_color[4], const float hint_color[4], const float outline_color[4],
+        const eGPUShaderConfig sh_cfg)
 {
        if (g_data.bone_octahedral_outline == NULL) {
                struct GPUBatch *geom = DRW_cache_bone_octahedral_wire_get();
-               g_data.bone_octahedral_outline = shgroup_instance_bone_shape_outline(g_data.passes.bone_outline, geom);
+               g_data.bone_octahedral_outline = shgroup_instance_bone_shape_outline(
+                       g_data.passes.bone_outline, geom, sh_cfg);
        }
        if (g_data.bone_octahedral_solid == NULL) {
                struct GPUBatch *geom = DRW_cache_bone_octahedral_get();
-               g_data.bone_octahedral_solid = shgroup_instance_bone_shape_solid(g_data.passes.bone_solid, geom,
-                                                                                g_data.transparent);
+               g_data.bone_octahedral_solid = shgroup_instance_bone_shape_solid(
+                       g_data.passes.bone_solid, geom, g_data.transparent, sh_cfg);
        }
        float final_bonemat[4][4];
        mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
@@ -157,15 +142,18 @@ static void drw_shgroup_bone_octahedral(
 /* Box / B-Bone */
 static void drw_shgroup_bone_box(
         const float (*bone_mat)[4],
-        const float bone_color[4], const float hint_color[4], const float outline_color[4])
+        const float bone_color[4], const float hint_color[4], const float outline_color[4],
+        const eGPUShaderConfig sh_cfg)
 {
        if (g_data.bone_box_wire == NULL) {
                struct GPUBatch *geom = DRW_cache_bone_box_wire_get();
-               g_data.bone_box_outline = shgroup_instance_bone_shape_outline(g_data.passes.bone_outline, geom);
+               g_data.bone_box_outline = shgroup_instance_bone_shape_outline(
+                       g_data.passes.bone_outline, geom, sh_cfg);
        }
        if (g_data.bone_box_solid == NULL) {
                struct GPUBatch *geom = DRW_cache_bone_box_get();
-               g_data.bone_box_solid = shgroup_instance_bone_shape_solid(g_data.passes.bone_solid, geom, g_data.transparent);
+               g_data.bone_box_solid = shgroup_instance_bone_shape_solid(
+                       g_data.passes.bone_solid, geom, g_data.transparent, sh_cfg);
        }
        float final_bonemat[4][4];
        mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
@@ -176,10 +164,12 @@ static void drw_shgroup_bone_box(
 }
 
 /* Wire */
-static void drw_shgroup_bone_wire(const float (*bone_mat)[4], const float color[4])
+static void drw_shgroup_bone_wire(
+        const float (*bone_mat)[4], const float color[4],
+        const eGPUShaderConfig sh_cfg)
 {
        if (g_data.bone_wire == NULL) {
-               g_data.bone_wire = shgroup_dynlines_flat_color(g_data.passes.bone_wire);
+               g_data.bone_wire = shgroup_dynlines_flat_color(g_data.passes.bone_wire, sh_cfg);
        }
        float head[3], tail[3];
        mul_v3_m4v3(head, g_data.ob->obmat, bone_mat[3]);
@@ -193,10 +183,11 @@ static void drw_shgroup_bone_wire(const float (*bone_mat)[4], const float color[
 /* Stick */
 static void drw_shgroup_bone_stick(
         const float (*bone_mat)[4],
-        const float col_wire[4], const float col_bone[4], const float col_head[4], const float col_tail[4])
+        const float col_wire[4], const float col_bone[4], const float col_head[4], const float col_tail[4],
+        const eGPUShaderConfig sh_cfg)
 {
        if (g_data.bone_stick == NULL) {
-               g_data.bone_stick = shgroup_instance_bone_stick(g_data.passes.bone_wire);
+               g_data.bone_stick = shgroup_instance_bone_stick(g_data.passes.bone_wire, sh_cfg);
        }
        float final_bonemat[4][4], tail[4];
        mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
@@ -323,7 +314,7 @@ extern void drw_batch_cache_generate_requested(Object *custom);
 static void drw_shgroup_bone_custom_solid(
         const float (*bone_mat)[4],
         const float bone_color[4], const float hint_color[4], const float outline_color[4],
-        Object *custom)
+        const eGPUShaderConfig sh_cfg, Object *custom)
 {
        /* grr, not re-using instances! */
        struct GPUBatch *surf = DRW_cache_object_surface_get(custom);
@@ -339,13 +330,14 @@ static void drw_shgroup_bone_custom_solid(
        }
 
        if (surf) {
-               DRWShadingGroup *shgrp_geom_solid = shgroup_instance_bone_shape_solid(g_data.passes.bone_solid, surf,
-                                                                                     g_data.transparent);
+               DRWShadingGroup *shgrp_geom_solid = shgroup_instance_bone_shape_solid(
+                       g_data.passes.bone_solid, surf, g_data.transparent, sh_cfg);
                DRW_shgroup_call_dynamic_add(shgrp_geom_solid, final_bonemat, bone_color, hint_color);
        }
 
        if (edges && outline_color[3] > 0.0f) {
-               DRWShadingGroup *shgrp_geom_wire = shgroup_instance_bone_shape_outline(g_data.passes.bone_outline, edges);
+               DRWShadingGroup *shgrp_geom_wire = shgroup_instance_bone_shape_outline(
+                       g_data.passes.bone_outline, edges, sh_cfg);
                DRW_shgroup_call_dynamic_add(shgrp_geom_wire, final_bonemat, outline_color);
        }
 
@@ -363,7 +355,7 @@ static void drw_shgroup_bone_custom_wire(
         const float color[4], Object *custom)
 {
        /* grr, not re-using instances! */
-       struct GPUBatch *geom = DRW_cache_object_wire_outline_get(custom);
+       struct GPUBatch *geom = DRW_cache_object_all_edges_get(custom);
 
        /* XXXXXXX needs to be moved elsewhere. */
        drw_batch_cache_generate_requested(custom);
@@ -469,7 +461,6 @@ static void drw_shgroup_bone_ik_spline_lines(const float start[3], const float e
 
 
 /* -------------------------------------------------------------------- */
-
 /** \name Drawing Theme Helpers
  *
  * Note, this section is duplicate of code in 'drawarmature.c'.
@@ -513,8 +504,9 @@ static void set_pchan_colorset(Object *ob, bPoseChannel *pchan)
                 */
                if (pchan->agrp_index) {
                        grp = (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1));
-                       if (grp)
+                       if (grp) {
                                color_index = grp->customCol;
+                       }
                }
        }
 
@@ -735,15 +727,17 @@ static bool set_pchan_color(short colCode, const int boneflag, const short const
 
 
 /* -------------------------------------------------------------------- */
-
 /** \name Drawing Color Helpers
  * \{ */
 
 /** See: 'set_pchan_color'*/
 static void update_color(const Object *ob, const float const_color[4])
 {
+       const bArmature *arm = ob->data;
        g_theme.const_color = const_color;
-       g_theme.const_wire = ((ob->base_flag & BASE_SELECTED) != 0) ? 1.5f : 0.0f;
+       g_theme.const_wire = (
+               ((ob->base_flag & BASE_SELECTED) ||
+                (arm->drawtype == ARM_WIRE)) ? 1.5f : 0.0f);
 
 #define NO_ALPHA(c) (((c)[3] = 1.0f), (c))
 
@@ -769,8 +763,9 @@ static const float *get_bone_solid_color(
         const EditBone *UNUSED(eBone), const bPoseChannel *pchan, const bArmature *arm,
         const int boneflag, const short constflag)
 {
-       if (g_theme.const_color)
+       if (g_theme.const_color) {
                return g_theme.bone_solid_color;
+       }
 
        if (arm->flag & ARM_POSEMODE) {
                static float disp_color[4];
@@ -786,8 +781,9 @@ static const float *get_bone_solid_with_consts_color(
         const EditBone *eBone, const bPoseChannel *pchan, const bArmature *arm,
         const int boneflag, const short constflag)
 {
-       if (g_theme.const_color)
+       if (g_theme.const_color) {
                return g_theme.bone_solid_color;
+       }
 
        const float *col = get_bone_solid_color(eBone, pchan, arm, boneflag, constflag);
 
@@ -803,12 +799,15 @@ static const float *get_bone_solid_with_consts_color(
 
 static float get_bone_wire_thickness(int boneflag)
 {
-       if (g_theme.const_color)
+       if (g_theme.const_color) {
                return g_theme.const_wire;
-       else if (boneflag & (BONE_DRAW_ACTIVE | BONE_SELECTED))
+       }
+       else if (boneflag & (BONE_DRAW_ACTIVE | BONE_SELECTED)) {
                return 2.0f;
-       else
+       }
+       else {
                return 1.0f;
+       }
 }
 
 static const float *get_bone_wire_color(
@@ -882,7 +881,6 @@ static const float *get_bone_hint_color(
 
 
 /* -------------------------------------------------------------------- */
-
 /** \name Helper Utils
  * \{ */
 
@@ -1254,14 +1252,13 @@ static void draw_points(
 
 
 /* -------------------------------------------------------------------- */
-
 /** \name Draw Bones
  * \{ */
 
 static void draw_bone_custom_shape(
         EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
         const int boneflag, const short constflag,
-        const int select_id)
+        const eGPUShaderConfig sh_cfg, const int select_id)
 {
        const float *col_solid = get_bone_solid_color(eBone, pchan, arm, boneflag, constflag);
        const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
@@ -1273,7 +1270,7 @@ static void draw_bone_custom_shape(
        }
 
        if ((boneflag & BONE_DRAWWIRE) == 0) {
-               drw_shgroup_bone_custom_solid(disp_mat, col_solid, col_hint, col_wire, pchan->custom);
+               drw_shgroup_bone_custom_solid(disp_mat, col_solid, col_hint, col_wire, sh_cfg, pchan->custom);
        }
        else {
                drw_shgroup_bone_custom_wire(disp_mat, col_wire, pchan->custom);
@@ -1329,7 +1326,8 @@ static void draw_bone_envelope(
 
 static void draw_bone_line(
         EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
-        const int boneflag, const short constflag, const int select_id)
+        const int boneflag, const short constflag,
+        const eGPUShaderConfig sh_cfg, const int select_id)
 {
        const float *col_bone = get_bone_solid_with_consts_color(eBone, pchan, arm, boneflag, constflag);
        const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
@@ -1367,20 +1365,20 @@ static void draw_bone_line(
 
        if (select_id == -1) {
                /* Not in selection mode, draw everything at once. */
-               drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, col_head, col_tail);
+               drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, col_head, col_tail, sh_cfg);
        }
        else {
                /* In selection mode, draw bone, root and tip separately. */
                DRW_select_load_id(select_id | BONESEL_BONE);
-               drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, no_display, no_display);
+               drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, no_display, no_display, sh_cfg);
 
                if (col_head[3] > 0.0f) {
                        DRW_select_load_id(select_id | BONESEL_ROOT);
-                       drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, col_head, no_display);
+                       drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, col_head, no_display, sh_cfg);
                }
 
                DRW_select_load_id(select_id | BONESEL_TIP);
-               drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, no_display, col_tail);
+               drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, no_display, col_tail, sh_cfg);
 
                DRW_select_load_id(-1);
        }
@@ -1389,7 +1387,7 @@ static void draw_bone_line(
 static void draw_bone_wire(
         EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
         const int boneflag, const short constflag,
-        const int select_id)
+        const eGPUShaderConfig sh_cfg, const int select_id)
 {
        const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
 
@@ -1402,12 +1400,12 @@ static void draw_bone_wire(
                BLI_assert(bbones_mat != NULL);
 
                for (int i = pchan->bone->segments; i--; bbones_mat++) {
-                       drw_shgroup_bone_wire(bbones_mat->mat, col_wire);
+                       drw_shgroup_bone_wire(bbones_mat->mat, col_wire, sh_cfg);
                }
        }
        else if (eBone) {
                for (int i = 0; i < eBone->segments; i++) {
-                       drw_shgroup_bone_wire(eBone->disp_bbone_mat[i], col_wire);
+                       drw_shgroup_bone_wire(eBone->disp_bbone_mat[i], col_wire, sh_cfg);
                }
        }
 
@@ -1423,7 +1421,7 @@ static void draw_bone_wire(
 static void draw_bone_box(
         EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
         const int boneflag, const short constflag,
-        const int select_id)
+        const eGPUShaderConfig sh_cfg, const int select_id)
 {
        const float *col_solid = get_bone_solid_with_consts_color(eBone, pchan, arm, boneflag, constflag);
        const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
@@ -1438,12 +1436,12 @@ static void draw_bone_box(
                BLI_assert(bbones_mat != NULL);
 
                for (int i = pchan->bone->segments; i--; bbones_mat++) {
-                       drw_shgroup_bone_box(bbones_mat->mat, col_solid, col_hint, col_wire);
+                       drw_shgroup_bone_box(bbones_mat->mat, col_solid, col_hint, col_wire, sh_cfg);
                }
        }
        else if (eBone) {
                for (int i = 0; i < eBone->segments; i++) {
-                       drw_shgroup_bone_box(eBone->disp_bbone_mat[i], col_solid, col_hint, col_wire);
+                       drw_shgroup_bone_box(eBone->disp_bbone_mat[i], col_solid, col_hint, col_wire, sh_cfg);
                }
        }
 
@@ -1459,7 +1457,7 @@ static void draw_bone_box(
 static void draw_bone_octahedral(
         EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
         const int boneflag, const short constflag,
-        const int select_id)
+        const eGPUShaderConfig sh_cfg, const int select_id)
 {
        const float *col_solid = get_bone_solid_with_consts_color(eBone, pchan, arm, boneflag, constflag);
        const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
@@ -1469,7 +1467,7 @@ static void draw_bone_octahedral(
                DRW_select_load_id(select_id | BONESEL_BONE);
        }
 
-       drw_shgroup_bone_octahedral(BONE_VAR(eBone, pchan, disp_mat), col_solid, col_hint, col_wire);
+       drw_shgroup_bone_octahedral(BONE_VAR(eBone, pchan, disp_mat), col_solid, col_hint, col_wire, sh_cfg);
 
        if (select_id != -1) {
                DRW_select_load_id(-1);
@@ -1482,7 +1480,6 @@ static void draw_bone_octahedral(
 
 
 /* -------------------------------------------------------------------- */
-
 /** \name Draw Degrees of Freedom
  * \{ */
 
@@ -1559,7 +1556,6 @@ static void draw_bone_dofs(bPoseChannel *pchan)
 
 
 /* -------------------------------------------------------------------- */
-
 /** \name Draw Relationships
  * \{ */
 
@@ -1570,8 +1566,9 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
        float *line_start = NULL, *line_end = NULL;
 
        for (con = pchan->constraints.first; con; con = con->next) {
-               if (con->enforce == 0.0f)
+               if (con->enforce == 0.0f) {
                        continue;
+               }
 
                switch (con->type) {
                        case CONSTRAINT_TYPE_KINEMATIC:
@@ -1580,8 +1577,9 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
                                int segcount = 0;
 
                                /* if only_temp, only draw if it is a temporary ik-chain */
-                               if (only_temp && !(data->flag & CONSTRAINT_IK_TEMP))
+                               if (only_temp && !(data->flag & CONSTRAINT_IK_TEMP)) {
                                        continue;
+                               }
 
                                /* exclude tip from chain? */
                                parchan = ((data->flag & CONSTRAINT_IK_TIP) == 0) ? pchan->parent : pchan;
@@ -1599,10 +1597,12 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
                                if (parchan) {
                                        line_end = parchan->pose_head;
 
-                                       if (constflag & PCHAN_HAS_TARGET)
+                                       if (constflag & PCHAN_HAS_TARGET) {
                                                drw_shgroup_bone_ik_lines(line_start, line_end);
-                                       else
+                                       }
+                                       else {
                                                drw_shgroup_bone_ik_no_target_lines(line_start, line_end);
+                                       }
                                }
                                break;
                        }
@@ -1612,8 +1612,9 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
                                int segcount = 0;
 
                                /* don't draw if only_temp, as Spline IK chains cannot be temporary */
-                               if (only_temp)
+                               if (only_temp) {
                                        continue;
+                               }
 
                                parchan = pchan;
                                line_start = parchan->pose_tail;
@@ -1677,7 +1678,6 @@ static void draw_bone_relations(
 /** \} */
 
 /* -------------------------------------------------------------------- */
-
 /** \name Main Draw Loops
  * \{ */
 
@@ -1695,7 +1695,7 @@ static void draw_armature_edit(Object *ob)
        const bool show_text = DRW_state_show_text();
        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) {
+       for (eBone = arm->edbo->first, index = ob->select_id; eBone; eBone = eBone->next, index += 0x10000) {
                if (eBone->layer & arm->layer) {
                        if ((eBone->flag & BONE_HIDDEN_A) == 0) {
                                const int select_id = is_select ? index : (uint)-1;
@@ -1721,19 +1721,19 @@ static void draw_armature_edit(Object *ob)
                                }
                                else if (arm->drawtype == ARM_LINE) {
                                        draw_bone_update_disp_matrix_default(eBone, NULL);
-                                       draw_bone_line(eBone, NULL, arm, boneflag, constflag, select_id);
+                                       draw_bone_line(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
                                }
                                else if (arm->drawtype == ARM_WIRE) {
                                        draw_bone_update_disp_matrix_bbone(eBone, NULL);
-                                       draw_bone_wire(eBone, NULL, arm, boneflag, constflag, select_id);
+                                       draw_bone_wire(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
                                }
                                else if (arm->drawtype == ARM_B_BONE) {
                                        draw_bone_update_disp_matrix_bbone(eBone, NULL);
-                                       draw_bone_box(eBone, NULL, arm, boneflag, constflag, select_id);
+                                       draw_bone_box(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
                                }
                                else {
                                        draw_bone_update_disp_matrix_default(eBone, NULL);
-                                       draw_bone_octahedral(eBone, NULL, arm, boneflag, constflag, select_id);
+                                       draw_bone_octahedral(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
                                }
 
                                /* Draw names of bone */
@@ -1783,7 +1783,7 @@ static void draw_armature_pose(Object *ob, const float const_color[4])
                }
 
                if (arm->flag & ARM_POSEMODE) {
-                       index = ob->select_color;
+                       index = ob->select_id;
                }
        }
 
@@ -1820,14 +1820,15 @@ static void draw_armature_pose(Object *ob, const float const_color[4])
                                }
 
                                /* set temporary flag for drawing bone as active, but only if selected */
-                               if (bone == arm->act_bone)
+                               if (bone == arm->act_bone) {
                                        boneflag |= BONE_DRAW_ACTIVE;
+                               }
 
                                draw_bone_relations(NULL, pchan, arm, boneflag, constflag, show_relations);
 
                                if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
                                        draw_bone_update_disp_matrix_custom(pchan);
-                                       draw_bone_custom_shape(NULL, pchan, arm, boneflag, constflag, select_id);
+                                       draw_bone_custom_shape(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
                                }
                                else if (arm->drawtype == ARM_ENVELOPE) {
                                        draw_bone_update_disp_matrix_default(NULL, pchan);
@@ -1835,25 +1836,25 @@ static void draw_armature_pose(Object *ob, const float const_color[4])
                                }
                                else if (arm->drawtype == ARM_LINE) {
                                        draw_bone_update_disp_matrix_default(NULL, pchan);
-                                       draw_bone_line(NULL, pchan, arm, boneflag, constflag, select_id);
+                                       draw_bone_line(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
                                }
                                else if (arm->drawtype == ARM_WIRE) {
                                        draw_bone_update_disp_matrix_bbone(NULL, pchan);
-                                       draw_bone_wire(NULL, pchan, arm, boneflag, constflag, select_id);
+                                       draw_bone_wire(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
                                }
                                else if (arm->drawtype == ARM_B_BONE) {
                                        draw_bone_update_disp_matrix_bbone(NULL, pchan);
-                                       draw_bone_box(NULL, pchan, arm, boneflag, constflag, select_id);
+                                       draw_bone_box(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
                                }
                                else {
                                        draw_bone_update_disp_matrix_default(NULL, pchan);
-                                       draw_bone_octahedral(NULL, pchan, arm, boneflag, constflag, select_id);
+                                       draw_bone_octahedral(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
                                }
 
                                if (!is_pose_select && show_relations &&
                                    (arm->flag & ARM_POSEMODE) &&
                                    (bone->flag & BONE_SELECTED) &&
-                                   ((ob->base_flag & BASE_FROMDUPLI) == 0) &&
+                                   ((ob->base_flag & BASE_FROM_DUPLI) == 0) &&
                                    (pchan->ikflag & (BONE_IK_XLIMIT | BONE_IK_ZLIMIT)))
                                {
                                        draw_bone_dofs(pchan);