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-21 01:15:19 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-05-26 23:28:52 +0300
commit44935fdfa342307259c4f7163738d5e74374e70a (patch)
treed8222164a793cc0f13c8e7201aa7c3fa6fcca699 /source/blender/draw/intern/draw_armature.c
parent2241a61aabf50bf10b7561dbd57fc2ded64d29c3 (diff)
Armature: Make Custom bone have the same appearance as other bones.
I had to correct some errors in the winding order of the normal bones.
Diffstat (limited to 'source/blender/draw/intern/draw_armature.c')
-rw-r--r--source/blender/draw/intern/draw_armature.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c
index 46122af257c..05c7d3892ed 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -313,19 +313,32 @@ static void drw_shgroup_bone_envelope(
/* Custom (geometry) */
-static void drw_shgroup_bone_custom_solid(const float (*bone_mat)[4], const float color[4], 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)
{
/* grr, not re-using instances! */
struct Gwn_Batch *geom = DRW_cache_object_surface_get(custom);
if (geom) {
- DRWShadingGroup *shgrp_geom_solid = shgroup_instance_solid(g_data.passes.bone_solid, geom);
+ DRWShadingGroup *shgrp_geom_solid = shgroup_instance_bone_shape_solid(g_data.passes.bone_solid, geom);
float final_bonemat[4][4];
mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
- DRW_shgroup_call_dynamic_add(shgrp_geom_solid, final_bonemat, color);
+ DRW_shgroup_call_dynamic_add(shgrp_geom_solid, final_bonemat, bone_color, hint_color);
+ }
+
+ geom = DRW_cache_object_edge_detection_get(custom);
+ if (geom && outline_color[3] > 0.0f) {
+ DRWShadingGroup *shgrp_geom_wire = shgroup_instance_bone_shape_outline(g_data.passes.bone_outline, geom);
+ float final_bonemat[4][4], final_color[4];
+ mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
+ DRW_shgroup_call_dynamic_add(shgrp_geom_wire, final_bonemat, outline_color);
}
}
-static void drw_shgroup_bone_custom_wire(const float (*bone_mat)[4], const float color[4], Object *custom)
+static void drw_shgroup_bone_custom_wire(
+ const float (*bone_mat)[4],
+ const float color[4], Object *custom)
{
/* grr, not re-using instances! */
struct Gwn_Batch *geom = DRW_cache_object_wire_outline_get(custom);
@@ -1169,6 +1182,7 @@ static void draw_bone_custom_shape(
{
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);
+ const float *col_hint = get_bone_hint_color(eBone, pchan, arm, boneflag, constflag);
const float (*disp_mat)[4] = pchan->disp_mat;
if (select_id != -1) {
@@ -1176,9 +1190,11 @@ static void draw_bone_custom_shape(
}
if ((boneflag & BONE_DRAWWIRE) == 0) {
- drw_shgroup_bone_custom_solid(disp_mat, col_solid, pchan->custom);
+ drw_shgroup_bone_custom_solid(disp_mat, col_solid, col_hint, col_wire, pchan->custom);
+ }
+ else {
+ drw_shgroup_bone_custom_wire(disp_mat, col_wire, pchan->custom);
}
- drw_shgroup_bone_custom_wire(disp_mat, col_wire, pchan->custom);
if (select_id != -1) {
DRW_select_load_id(-1);