[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25734] trunk/blender/source/blender: obscure feature: Display Custom Bone Shape at another bones transform.

Campbell Barton ideasman42 at gmail.com
Tue Jan 5 12:47:44 CET 2010


Revision: 25734
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25734
Author:   campbellbarton
Date:     2010-01-05 12:47:43 +0100 (Tue, 05 Jan 2010)

Log Message:
-----------
obscure feature: Display Custom Bone Shape at another bones transform.
Brecht and I took a fair bit of convincing on this one however Cessen was jumping through hoops to do without this feature.
Having the shape being an external mesh deformed by its own armature, which were both hidden but in the same layer *(so the depgraph would update them).
Without this some of the bones in the rig also dont make much sense when animating with.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/space_view3d/drawarmature.c
    trunk/blender/source/blender/makesrna/intern/rna_pose.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2010-01-05 10:54:54 UTC (rev 25733)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2010-01-05 11:47:43 UTC (rev 25734)
@@ -3782,6 +3782,7 @@
 		pchan->bone= NULL;
 		pchan->parent= newdataadr(fd, pchan->parent);
 		pchan->child= newdataadr(fd, pchan->child);
+		pchan->custom_tx= newdataadr(fd, pchan->custom_tx);
 		
 		direct_link_constraints(fd, &pchan->constraints);
 		

Modified: trunk/blender/source/blender/editors/space_view3d/drawarmature.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawarmature.c	2010-01-05 10:54:54 UTC (rev 25733)
+++ trunk/blender/source/blender/editors/space_view3d/drawarmature.c	2010-01-05 11:47:43 UTC (rev 25734)
@@ -1622,8 +1622,14 @@
 			
 			if ( (bone) && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)) ) {
 				if (bone->layer & arm->layer) {
+					int use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
 					glPushMatrix();
-					glMultMatrixf(pchan->pose_mat);
+
+					if(use_custom && pchan->custom_tx) {
+						glMultMatrixf(pchan->custom_tx->pose_mat);
+					} else {
+						glMultMatrixf(pchan->pose_mat);
+					}
 					
 					/* catch exception for bone with hidden parent */
 					flag= bone->flag;
@@ -1637,7 +1643,7 @@
 					/* set color-set to use */
 					set_pchan_colorset(ob, pchan);
 					
-					if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
+					if (use_custom) {
 						/* if drawwire, don't try to draw in solid */
 						if (pchan->bone->flag & BONE_DRAWWIRE) 
 							draw_wire= 1;
@@ -1687,7 +1693,12 @@
 					if (pchan->custom) {
 						if ((dt < OB_SOLID) || (bone->flag & BONE_DRAWWIRE)) {
 							glPushMatrix();
-							glMultMatrixf(pchan->pose_mat);
+
+							if(pchan->custom_tx) {
+								glMultMatrixf(pchan->custom_tx->pose_mat);
+							} else {
+								glMultMatrixf(pchan->pose_mat);
+							}
 							
 							/* prepare colors */
 							if (arm->flag & ARM_POSEMODE)	

Modified: trunk/blender/source/blender/makesrna/intern/rna_pose.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_pose.c	2010-01-05 10:54:54 UTC (rev 25733)
+++ trunk/blender/source/blender/makesrna/intern/rna_pose.c	2010-01-05 11:47:43 UTC (rev 25734)
@@ -912,6 +912,13 @@
 	RNA_def_property_ui_text(prop, "Custom Object", "Object that defines custom draw type for this bone.");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
+	prop= RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "custom_tx");
+	RNA_def_property_struct_type(prop, "PoseBone");
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Custom Shape Transform", "Bone that defines the display transform of this custom shape.");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
+	
 	/* bone groups */
 	prop= RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "agrp_index");





More information about the Bf-blender-cvs mailing list