[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14650] trunk/blender/source/blender/src/ editobject.c: stop centering objects from moving children

Campbell Barton ideasman42 at gmail.com
Thu May 1 22:31:57 CEST 2008


Revision: 14650
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14650
Author:   campbellbarton
Date:     2008-05-01 22:31:57 +0200 (Thu, 01 May 2008)

Log Message:
-----------
stop centering objects from moving children

Modified Paths:
--------------
    trunk/blender/source/blender/src/editobject.c

Modified: trunk/blender/source/blender/src/editobject.c
===================================================================
--- trunk/blender/source/blender/src/editobject.c	2008-05-01 19:46:05 UTC (rev 14649)
+++ trunk/blender/source/blender/src/editobject.c	2008-05-01 20:31:57 UTC (rev 14650)
@@ -555,6 +555,20 @@
 	return totvert;
 }
 
+/* use this when the loc/size/rot of the parent has changed but the children should stay in the same place
+ * apply-size-rot or object center for eg */
+static void ignore_parent_tx( Object *ob ) {
+	Object *ob_child;
+	/* a change was made, adjust the children to compensate */
+	for (ob_child=G.main->object.first; ob_child; ob_child=ob_child->id.next) {
+		if (ob_child->parent == ob) {
+			apply_obmat(ob_child);
+			what_does_parent(ob_child);
+			Mat4Invert(ob_child->parentinv, workob.obmat);
+		}
+	}
+}
+
 static void select_editcurve_hook(HookModifierData *hmd)
 {
 	extern ListBase editNurb;
@@ -1936,6 +1950,9 @@
 							base->object->loc[1]+= centn[1];
 							base->object->loc[2]+= centn[2];
 							
+							where_is_object(base->object);
+							ignore_parent_tx(base->object);
+							
 							/* other users? */
 							ob= G.main->object.first;
 							while(ob) {
@@ -1954,6 +1971,9 @@
 										ob->loc[1]+= centn[1];
 										ob->loc[2]+= centn[2];
 										
+										where_is_object(ob);
+										ignore_parent_tx(ob);
+										
 										if(tme && (tme->flag & ME_ISDONE)==0) {
 											mvert= tme->mvert;
 											for(a=0; a<tme->totvert; a++, mvert++) {
@@ -2033,6 +2053,9 @@
 							base->object->loc[0]+= cent[0];
 							base->object->loc[1]+= cent[1];
 							base->object->loc[2]+= cent[2];
+							
+							where_is_object(base->object);
+							ignore_parent_tx(base->object);
 						}
 						
 						tot_change++;
@@ -2080,6 +2103,10 @@
 						 */
 						docenter_armature(base->object, centermode);
 						tot_change++;
+						
+						where_is_object(base->object);
+						ignore_parent_tx(base->object);
+						
 						if(G.obedit) 
 							break;
 					}
@@ -3869,7 +3896,7 @@
 void apply_objects_locrot( void )
 {
 	Base *base, *basact;
-	Object *ob, *ob_child;
+	Object *ob;
 	bArmature *arm;
 	Mesh *me;
 	Curve *cu;
@@ -4018,14 +4045,7 @@
 				continue;
 			}
 			
-			/* a change was made, adjust the children to compensate */
-			for (ob_child=G.main->object.first; ob_child; ob_child=ob_child->id.next) {
-				if (ob_child->parent == ob) {
-					apply_obmat(ob_child);
-					what_does_parent(ob_child);
-					Mat4Invert(ob_child->parentinv, workob.obmat);
-				}
-			}
+			ignore_parent_tx(ob);
 		}
 	}
 	if (change) {





More information about the Bf-blender-cvs mailing list