[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13468] trunk/blender/source/blender: == Custom Bone Shape Drawing - 'Wireframe' Option ==

Joshua Leung aligorith at gmail.com
Wed Jan 30 09:10:47 CET 2008


Revision: 13468
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13468
Author:   aligorith
Date:     2008-01-30 09:10:47 +0100 (Wed, 30 Jan 2008)

Log Message:
-----------
== Custom Bone Shape Drawing - 'Wireframe' Option ==

In production rigs, such as those for Peach and Plumiferos, custom bone shapes are often simple wireframe shapes (formed with a single line). These are only visible when the armature's drawtype is Wire, which means that this drawtype must be used for the display of those bones. On the other hand, 'normal' bones must also be drawn as wireframes.

I've added a small toggle beside the field for the name of the object to use. This is marked 'W' (this is not great, but it'll have to do for now). 
When activated, that bone's custom bone shape will always draw as a wireframe. As a result, the armature's drawtype doesn't have to be set to 'Wire' to see these bones. 

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_armature_types.h
    trunk/blender/source/blender/src/buttons_editing.c
    trunk/blender/source/blender/src/drawarmature.c

Modified: trunk/blender/source/blender/makesdna/DNA_armature_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_armature_types.h	2008-01-30 05:38:55 UTC (rev 13467)
+++ trunk/blender/source/blender/makesdna/DNA_armature_types.h	2008-01-30 08:10:47 UTC (rev 13468)
@@ -155,7 +155,8 @@
 	BONE_UNKEYED				= (1<<13), 	/* set to prevent destruction of its unkeyframed pose (after transform) */		
 	BONE_HINGE_CHILD_TRANSFORM 	= (1<<14), 	/* set to prevent hinge child bones from influencing the transform center */
 	BONE_NO_SCALE				= (1<<15), 	/* No parent scale */
-	BONE_HIDDEN_PG				= (1<<16)	/* hidden bone when drawing PoseChannels (for ghost drawing) */
+	BONE_HIDDEN_PG				= (1<<16),	/* hidden bone when drawing PoseChannels (for ghost drawing) */
+	BONE_DRAWWIRE				= (1<<17)	/* bone should be drawn as OB_WIRE, regardless of draw-types of view+armature */
 } eBone_Flag;
 
 #endif

Modified: trunk/blender/source/blender/src/buttons_editing.c
===================================================================
--- trunk/blender/source/blender/src/buttons_editing.c	2008-01-30 05:38:55 UTC (rev 13467)
+++ trunk/blender/source/blender/src/buttons_editing.c	2008-01-30 08:10:47 UTC (rev 13468)
@@ -4355,9 +4355,11 @@
 			MEM_freeN(menustr);
 			
 			ob_arm_bone_pchan_lock(ob, arm, curBone, pchan);
-			uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:",		220,by,110,19, &pchan->custom, "Object that defines custom draw type for this Bone");
+			uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:",		220,by,90,19, &pchan->custom, "Object that defines custom draw type for this Bone");
 			ob_arm_bone_pchan_lock(ob, arm, curBone, NULL);
 			
+			uiDefButBitI(block, TOG, BONE_DRAWWIRE, B_ARM_RECALCDATA, "W",			309,by,21,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Custom shape of this Bone should always be drawn as a wireframe");
+			
 			/* Segment, ease in/out buttons */
 			uiBlockBeginAlign(block);
 			uiDefButS(block, NUM, B_ARM_RECALCDATA, "Segm: ",  -10,by-19,117,19, &curBone->segments, 1.0, 32.0, 0.0, 0.0, "Subdivisions for B-bones");

Modified: trunk/blender/source/blender/src/drawarmature.c
===================================================================
--- trunk/blender/source/blender/src/drawarmature.c	2008-01-30 05:38:55 UTC (rev 13467)
+++ trunk/blender/source/blender/src/drawarmature.c	2008-01-30 08:10:47 UTC (rev 13468)
@@ -1521,13 +1521,13 @@
 	GLfloat tmp;
 	float smat[4][4], imat[4][4];
 	int index= -1;
-	int do_dashed= 1;
+	int do_dashed= 3;
 	short flag, constflag;
 	
 	/* hacky... prevent outline select from drawing dashed helplines */
 	glGetFloatv(GL_LINE_WIDTH, &tmp);
-	if (tmp > 1.1) do_dashed= 0;
-	if (G.vd->flag & V3D_HIDE_HELPLINES) do_dashed= 0;
+	if (tmp > 1.1) do_dashed &= ~1;
+	if (G.vd->flag & V3D_HIDE_HELPLINES) do_dashed &= ~2;
 	
 	/* precalc inverse matrix for drawing screen aligned */
 	if (arm->drawtype==ARM_ENVELOPE) {
@@ -1584,8 +1584,13 @@
 					/* set color-set to use */
 					set_pchan_colorset(ob, pchan);
 					
-					if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM))
-						draw_custom_bone(pchan->custom, OB_SOLID, arm->flag, flag, index, bone->length);
+					if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
+						/* BONE_DRAWWIRE case is here too, as sometimes wire overlay won't be done */
+						if (pchan->bone->flag & BONE_DRAWWIRE) 
+							draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
+						else
+							draw_custom_bone(pchan->custom, OB_SOLID, arm->flag, flag, index, bone->length);
+					}
 					else if (arm->drawtype==ARM_LINE)
 						;	/* nothing in solid */
 					else if (arm->drawtype==ARM_ENVELOPE)
@@ -1674,16 +1679,16 @@
 					
 					/* extra draw service for pose mode */
 					constflag= pchan->constflag;
-					if(pchan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE))
+					if (pchan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE))
 						constflag |= PCHAN_HAS_ACTION;
-					if(pchan->flag & POSE_STRIDE)
+					if (pchan->flag & POSE_STRIDE)
 						constflag |= PCHAN_HAS_STRIDE;
 						
 					/* set color-set to use */
 					set_pchan_colorset(ob, pchan);
 
-					if (pchan->custom && !(arm->flag & ARM_NO_CUSTOM)) {
-						if (dt < OB_SOLID)
+					if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
+						if ((dt < OB_SOLID) || (pchan->bone->flag & BONE_DRAWWIRE))
 							draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
 					}
 					else if (arm->drawtype==ARM_ENVELOPE) {





More information about the Bf-blender-cvs mailing list