[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54494] trunk/blender/source/blender/ editors: Reports #34042 and #33749

Ton Roosendaal ton at blender.org
Tue Feb 12 15:42:46 CET 2013


Revision: 54494
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54494
Author:   ton
Date:     2013-02-12 14:42:46 +0000 (Tue, 12 Feb 2013)
Log Message:
-----------
Reports #34042 and #33749

Tweak for new option for Relative Bone parenting
(which transforms child object based on rest pose, so you can change bones 
in editmode to define pivot)

In the original commit it was made default, but that was too invisble for
users. Now it's an option in the Make Parent menu to choose. Communicates
a new feature better.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/editarmature.c
    trunk/blender/source/blender/editors/include/ED_object.h
    trunk/blender/source/blender/editors/object/object_relations.c

Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c	2013-02-12 14:36:08 UTC (rev 54493)
+++ trunk/blender/source/blender/editors/armature/editarmature.c	2013-02-12 14:42:46 UTC (rev 54494)
@@ -2268,7 +2268,7 @@
 	
 	BLI_addtail(arm->edbo, bone);
 	
-	bone->flag |= BONE_TIPSEL | BONE_RELATIVE_PARENTING;
+	bone->flag |= BONE_TIPSEL;
 	bone->weight = 1.0f;
 	bone->dist = 0.25f;
 	bone->xwidth = 0.1f;
@@ -3422,7 +3422,7 @@
 						copy_v3_v3(newbone->tail, ebone->head);
 						newbone->parent = ebone->parent;
 						
-						newbone->flag = BONE_TIPSEL | BONE_RELATIVE_PARENTING;
+						newbone->flag = BONE_TIPSEL;
 						
 						if (newbone->parent && (ebone->flag & BONE_CONNECTED)) {
 							newbone->flag |= BONE_CONNECTED;

Modified: trunk/blender/source/blender/editors/include/ED_object.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_object.h	2013-02-12 14:36:08 UTC (rev 54493)
+++ trunk/blender/source/blender/editors/include/ED_object.h	2013-02-12 14:42:46 UTC (rev 54494)
@@ -83,6 +83,7 @@
 	PAR_ARMATURE_ENVELOPE,
 	PAR_ARMATURE_AUTO,
 	PAR_BONE,
+	PAR_BONE_RELATIVE,
 	PAR_CURVE,
 	PAR_FOLLOW,
 	PAR_PATH_CONST,

Modified: trunk/blender/source/blender/editors/object/object_relations.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_relations.c	2013-02-12 14:36:08 UTC (rev 54493)
+++ trunk/blender/source/blender/editors/object/object_relations.c	2013-02-12 14:42:46 UTC (rev 54494)
@@ -35,6 +35,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "DNA_anim_types.h"
+#include "DNA_armature_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_group_types.h"
@@ -578,6 +579,7 @@
 	{PAR_ARMATURE_AUTO, "ARMATURE_AUTO", 0, "   With Automatic Weights", ""},
 	{PAR_ARMATURE_ENVELOPE, "ARMATURE_ENVELOPE", 0, "   With Envelope Weights", ""},
 	{PAR_BONE, "BONE", 0, "Bone", ""},
+	{PAR_BONE_RELATIVE, "BONE_RELATIVE", 0, "Bone Relative", ""},
 	{PAR_CURVE, "CURVE", 0, "Curve Deform", ""},
 	{PAR_FOLLOW, "FOLLOW", 0, "Follow Path", ""},
 	{PAR_PATH_CONST, "PATH_CONST", 0, "Path Constraint", ""},
@@ -624,7 +626,7 @@
 				partype = PAR_OBJECT;
 		}
 	}
-	else if (partype == PAR_BONE) {
+	else if (ELEM(partype, PAR_BONE, PAR_BONE_RELATIVE)) {
 		pchan = BKE_pose_channel_active(par);
 		
 		if (pchan == NULL) {
@@ -705,8 +707,16 @@
 					}
 				}
 			}
-			else if (partype == PAR_BONE)
+			else if (partype == PAR_BONE) {
 				ob->partype = PARBONE;  /* note, dna define, not operator property */
+				if (pchan->bone)
+					pchan->bone->flag &= ~BONE_RELATIVE_PARENTING;
+			}
+			else if (partype == PAR_BONE_RELATIVE) {
+				ob->partype = PARBONE;  /* note, dna define, not operator property */
+				if (pchan->bone)
+					pchan->bone->flag |= BONE_RELATIVE_PARENTING;
+			}
 			else
 				ob->partype = PAROBJECT;  /* note, dna define, not operator property */
 			
@@ -815,6 +825,7 @@
 		uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_ENVELOPE);
 		uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO);
 		uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE);
+		uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE_RELATIVE);
 	}
 	else if (ob->type == OB_CURVE) {
 		uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_CURVE);




More information about the Bf-blender-cvs mailing list