[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36233] trunk/blender/source/blender/ editors/object/object_transform.c: fix [#27006] Apply Scale at a B-Bone Skeleton causes rescale of B-Bones and offset of attached objects

Campbell Barton ideasman42 at gmail.com
Wed Apr 20 06:11:15 CEST 2011


Revision: 36233
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36233
Author:   campbellbarton
Date:     2011-04-20 04:11:12 +0000 (Wed, 20 Apr 2011)
Log Message:
-----------
fix [#27006] Apply Scale at a B-Bone Skeleton causes rescale of B-Bones and offset of attached objects

Modified Paths:
--------------
    trunk/blender/source/blender/editors/object/object_transform.c

Modified: trunk/blender/source/blender/editors/object/object_transform.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_transform.c	2011-04-20 03:05:19 UTC (rev 36232)
+++ trunk/blender/source/blender/editors/object/object_transform.c	2011-04-20 04:11:12 UTC (rev 36233)
@@ -54,6 +54,7 @@
 #include "BKE_object.h"
 #include "BKE_report.h"
 #include "BKE_multires.h"
+#include "BKE_armature.h"
 
 #include "RNA_define.h"
 #include "RNA_access.h"
@@ -389,13 +390,6 @@
 {
 	Main *bmain= CTX_data_main(C);
 	Scene *scene= CTX_data_scene(C);
-	bArmature *arm;
-	Mesh *me;
-	Curve *cu;
-	Nurb *nu;
-	BPoint *bp;
-	BezTriple *bezt;
-	MVert *mvert;
 	float rsmat[3][3], tmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale;
 	int a, change = 0;
 	
@@ -403,28 +397,27 @@
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
 
 		if(ob->type==OB_MESH) {
-			me= ob->data;
-			
-			if(ID_REAL_USERS(me) > 1) {
+			if(ID_REAL_USERS(ob->data) > 1) {
 				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user mesh, doing nothing.");
 				return OPERATOR_CANCELLED;
 			}
 		}
 		else if(ob->type==OB_ARMATURE) {
-			arm= ob->data;
-			
-			if(ID_REAL_USERS(arm) > 1) {
+			if(ID_REAL_USERS(ob->data) > 1) {
 				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user armature, doing nothing.");
 				return OPERATOR_CANCELLED;
 			}
 		}
 		else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
-			cu= ob->data;
-			
-			if(ID_REAL_USERS(cu) > 1) {
+			Curve *cu;
+
+			if(ID_REAL_USERS(ob->data) > 1) {
 				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user curve, doing nothing.");
 				return OPERATOR_CANCELLED;
 			}
+
+			cu= ob->data;
+
 			if(!(cu->flag & CU_3D) && (apply_rot || apply_loc)) {
 				BKE_report(reports, RPT_ERROR, "Neither rotation nor location could be applied to a 2d curve, doing nothing.");
 				return OPERATOR_CANCELLED;
@@ -477,8 +470,9 @@
 
 		/* apply to object data */
 		if(ob->type==OB_MESH) {
-			me= ob->data;
-			
+			Mesh *me= ob->data;
+			MVert *mvert;
+
 			multiresModifier_scale_disp(scene, ob);
 			
 			/* adjust data */
@@ -504,8 +498,12 @@
 			ED_armature_apply_transform(ob, mat);
 		}
 		else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
-			cu= ob->data;
+			Curve *cu= ob->data;
 
+			Nurb *nu;
+			BPoint *bp;
+			BezTriple *bezt;
+
 			scale = mat3_to_scale(rsmat);
 
 			for(nu=cu->nurb.first; nu; nu=nu->next) {
@@ -539,6 +537,10 @@
 		}
 
 		where_is_object(scene, ob);
+		if(ob->type==OB_ARMATURE) {
+			where_is_pose(scene, ob); /* needed for bone parents */
+		}
+
 		ignore_parent_tx(bmain, scene, ob);
 
 		DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA);
@@ -864,6 +866,8 @@
 					/* do_inverse_offset= TRUE; */ /* docenter_armature() handles this */
 
 					where_is_object(scene, ob);
+					where_is_pose(scene, ob); /* needed for bone parents */
+
 					ignore_parent_tx(bmain, scene, ob);
 
 					if(obedit)
@@ -880,6 +884,10 @@
 				add_v3_v3(ob->loc, centn);
 
 				where_is_object(scene, ob);
+				if(ob->type==OB_ARMATURE) {
+					where_is_pose(scene, ob); /* needed for bone parents */
+				}
+
 				ignore_parent_tx(bmain, scene, ob);
 				
 				/* other users? */
@@ -896,6 +904,9 @@
 						add_v3_v3(ob_other->loc, centn);
 
 						where_is_object(scene, ob_other);
+						if(ob_other->type==OB_ARMATURE) {
+							where_is_pose(scene, ob_other); /* needed for bone parents */
+						}
 						ignore_parent_tx(bmain, scene, ob_other);
 					}
 				}




More information about the Bf-blender-cvs mailing list