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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-03-11 11:08:43 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-03-11 11:14:29 +0400
commitdf5cbfb6253b10763375e3c86e827a1a34700231 (patch)
tree6a9160da5b829ba203318f2093487c546fc13f5b /source/blender/editors/space_view3d/drawarmature.c
parent12c56d8c1f7318ddbd9782f25b871d4b09bad258 (diff)
Fix T39070: Custom bone shapes appear only one sided
The idea is simple -- only enable culling for bones if they're not using custom shape or if culling is enabled in shading panel.
Diffstat (limited to 'source/blender/editors/space_view3d/drawarmature.c')
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c64
1 files changed, 45 insertions, 19 deletions
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 8aced487160..8793dff4bac 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1667,6 +1667,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
short do_dashed = 3;
bool draw_wire = false;
int flag;
+ bool is_cull_enabled;
/* being set below */
arm->layer_used = 0;
@@ -1714,9 +1715,15 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
}
/* little speedup, also make sure transparent only draws once */
- glCullFace(GL_BACK);
- glEnable(GL_CULL_FACE);
-
+ glCullFace(GL_BACK);
+ if (v3d->flag2 & V3D_BACKFACE_CULLING) {
+ glEnable(GL_CULL_FACE);
+ is_cull_enabled = true;
+ }
+ else {
+ is_cull_enabled = false;
+ }
+
/* if solid we draw that first, with selection codes, but without names, axes etc */
if (dt > OB_WIRE) {
if (arm->flag & ARM_POSEMODE)
@@ -1765,26 +1772,38 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
draw_wire = true;
}
else {
+ if (is_cull_enabled && (v3d->flag2 & V3D_BACKFACE_CULLING) == 0) {
+ is_cull_enabled = false;
+ glDisable(GL_CULL_FACE);
+ }
+
draw_custom_bone(scene, v3d, rv3d, pchan->custom,
OB_SOLID, arm->flag, flag, index, bone->length);
}
}
- else if (arm->drawtype == ARM_LINE) {
- /* nothing in solid */
- }
- else if (arm->drawtype == ARM_WIRE) {
- /* nothing in solid */
- }
- else if (arm->drawtype == ARM_ENVELOPE) {
- draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
- }
- else if (arm->drawtype == ARM_B_BONE) {
- draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
- }
else {
- draw_bone(OB_SOLID, arm->flag, flag, 0, index, bone->length);
+ if (is_cull_enabled == false) {
+ is_cull_enabled = true;
+ glEnable(GL_CULL_FACE);
+ }
+
+ if (arm->drawtype == ARM_LINE) {
+ /* nothing in solid */
+ }
+ else if (arm->drawtype == ARM_WIRE) {
+ /* nothing in solid */
+ }
+ else if (arm->drawtype == ARM_ENVELOPE) {
+ draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
+ }
+ else if (arm->drawtype == ARM_B_BONE) {
+ draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
+ }
+ else {
+ draw_bone(OB_SOLID, arm->flag, flag, 0, index, bone->length);
+ }
}
-
+
glPopMatrix();
}
}
@@ -1885,7 +1904,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (arm->flag & ARM_POSEMODE)
index = base->selcol;
}
-
+
+ if (is_cull_enabled == false) {
+ is_cull_enabled = true;
+ glEnable(GL_CULL_FACE);
+ }
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
arm->layer_used |= bone->layer;
@@ -1990,7 +2014,9 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
}
/* restore */
- glDisable(GL_CULL_FACE);
+ if (is_cull_enabled) {
+ glDisable(GL_CULL_FACE);
+ }
/* draw DoFs */
if (arm->flag & ARM_POSEMODE) {