[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58452] branches/soc-2013-dingto: Merged revision(s) 58450 from trunk/blender into soc-2013-dingto.

Thomas Dinges blender at dingto.org
Sat Jul 20 17:47:53 CEST 2013


Revision: 58452
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58452
Author:   dingto
Date:     2013-07-20 15:47:53 +0000 (Sat, 20 Jul 2013)
Log Message:
-----------
Merged revision(s) 58450 from trunk/blender into soc-2013-dingto.

Modified Paths:
--------------
    branches/soc-2013-dingto/source/blender/editors/space_view3d/view3d_snap.c

Property Changed:
----------------
    branches/soc-2013-dingto/


Property changes on: branches/soc-2013-dingto
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_dev:58091-58422
/branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037,48089,48092,48551-48552,48679,48790,48792-48793,49076,49087,49292,49294,49466,49894,50052,50126,52854-52856,54573
/branches/soc-2013-depsgraph_mt:57516
/tags/blender-2.67b-release/blender:57122
/trunk/blender:57315-57365,57369-58448
   + /branches/ge_dev:58091-58422
/branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037,48089,48092,48551-48552,48679,48790,48792-48793,49076,49087,49292,49294,49466,49894,50052,50126,52854-52856,54573
/branches/soc-2013-depsgraph_mt:57516
/tags/blender-2.67b-release/blender:57122
/trunk/blender:57315-57365,57369-58448,58450

Modified: branches/soc-2013-dingto/source/blender/editors/space_view3d/view3d_snap.c
===================================================================
--- branches/soc-2013-dingto/source/blender/editors/space_view3d/view3d_snap.c	2013-07-20 15:46:49 UTC (rev 58451)
+++ branches/soc-2013-dingto/source/blender/editors/space_view3d/view3d_snap.c	2013-07-20 15:47:53 UTC (rev 58452)
@@ -676,12 +676,15 @@
 	Scene *scene = CTX_data_scene(C);
 	View3D *v3d = CTX_wm_view3d(C);
 	TransVert *tv;
-	float *curs, imat[3][3], bmat[3][3], vec[3];
+	float imat[3][3], bmat[3][3];
+	const float *cursor_global;
 	int a;
 
-	curs = give_cursor(scene, v3d);
+	cursor_global = give_cursor(scene, v3d);
 
 	if (obedit) {
+		float cursor_local[3];
+
 		tottrans = 0;
 		
 		if (ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL))
@@ -692,10 +695,10 @@
 		invert_m3_m3(imat, bmat);
 		
 		tv = transvmain;
+		sub_v3_v3v3(cursor_local, cursor_global, obedit->obmat[3]);
+		mul_m3_v3(imat, cursor_local);
 		for (a = 0; a < tottrans; a++, tv++) {
-			sub_v3_v3v3(vec, curs, obedit->obmat[3]);
-			mul_m3_v3(imat, vec);
-			copy_v3_v3(tv->loc, vec);
+			copy_v3_v3(tv->loc, cursor_local);
 		}
 		
 		special_transvert_update(obedit);
@@ -711,25 +714,27 @@
 			if (ob->mode & OB_MODE_POSE) {
 				bPoseChannel *pchan;
 				bArmature *arm = ob->data;
+				float cursor_local[3];
 				
 				invert_m4_m4(ob->imat, ob->obmat);
-				copy_v3_v3(vec, curs);
-				mul_m4_v3(ob->imat, vec);
+				copy_v3_v3(cursor_local, cursor_global);
+				mul_m4_v3(ob->imat, cursor_local);
 				
 				for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 					if (pchan->bone->flag & BONE_SELECTED) {
 						if (pchan->bone->layer & arm->layer) {
 							if ((pchan->bone->flag & BONE_CONNECTED) == 0) {
 								/* Get position in pchan (pose) space. */
-								BKE_armature_loc_pose_to_bone(pchan, vec, vec);
+								float cursor_pose[3];
+								BKE_armature_loc_pose_to_bone(pchan, cursor_local, cursor_pose);
 
 								/* copy new position */
 								if ((pchan->protectflag & OB_LOCK_LOCX) == 0)
-									pchan->loc[0] = vec[0];
+									pchan->loc[0] = cursor_pose[0];
 								if ((pchan->protectflag & OB_LOCK_LOCY) == 0)
-									pchan->loc[1] = vec[1];
+									pchan->loc[1] = cursor_pose[1];
 								if ((pchan->protectflag & OB_LOCK_LOCZ) == 0)
-									pchan->loc[2] = vec[2];
+									pchan->loc[2] = cursor_pose[2];
 
 								/* auto-keyframing */
 								ED_autokeyframe_pchan(C, scene, ob, pchan, ks);
@@ -745,23 +750,24 @@
 				DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 			}
 			else {
-				vec[0] = -ob->obmat[3][0] + curs[0];
-				vec[1] = -ob->obmat[3][1] + curs[1];
-				vec[2] = -ob->obmat[3][2] + curs[2];
+				float cursor_parent[3];  /* parent-relative */
+				cursor_parent[0] = -ob->obmat[3][0] + cursor_global[0];
+				cursor_parent[1] = -ob->obmat[3][1] + cursor_global[1];
+				cursor_parent[2] = -ob->obmat[3][2] + cursor_global[2];
 				
 				if (ob->parent) {
 					float originmat[3][3];
 					BKE_object_where_is_calc_ex(scene, NULL, ob, originmat);
 					
 					invert_m3_m3(imat, originmat);
-					mul_m3_v3(imat, vec);
+					mul_m3_v3(imat, cursor_parent);
 				}
 				if ((ob->protectflag & OB_LOCK_LOCX) == 0)
-					ob->loc[0] += vec[0];
+					ob->loc[0] += cursor_parent[0];
 				if ((ob->protectflag & OB_LOCK_LOCY) == 0)
-					ob->loc[1] += vec[1];
+					ob->loc[1] += cursor_parent[1];
 				if ((ob->protectflag & OB_LOCK_LOCZ) == 0)
-					ob->loc[2] += vec[2];
+					ob->loc[2] += cursor_parent[2];
 
 				/* auto-keyframing */
 				ED_autokeyframe_object(C, scene, ob, ks);




More information about the Bf-blender-cvs mailing list