[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25011] trunk/blender: * Moved rotation initialisation code for new objects to 'the other' add object function that campbell fixed earlier.

Joshua Leung aligorith at gmail.com
Mon Nov 30 00:54:41 CET 2009


Revision: 25011
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25011
Author:   aligorith
Date:     2009-11-30 00:54:41 +0100 (Mon, 30 Nov 2009)

Log Message:
-----------
* Moved rotation initialisation code for new objects to 'the other' add object function that campbell fixed earlier. This should mean that the py-api does everything in the right way now.

* Tried adding 'Load Factory Settings' to File menu, but I seem to be running up against some RNA bugs. Can be removed if is too problematic.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_info.py
    trunk/blender/source/blender/blenkernel/intern/object.c

Modified: trunk/blender/release/scripts/ui/space_info.py
===================================================================
--- trunk/blender/release/scripts/ui/space_info.py	2009-11-29 23:14:41 UTC (rev 25010)
+++ trunk/blender/release/scripts/ui/space_info.py	2009-11-29 23:54:41 UTC (rev 25011)
@@ -83,12 +83,18 @@
         layout.operator("wm.save_mainfile", text="Save", icon='ICON_FILE_TICK')
         layout.operator_context = 'INVOKE_AREA'
         layout.operator("wm.save_as_mainfile", text="Save As...")
+        
+        layout.separator()
+        
         layout.operator("screen.userpref_show", text="User Preferences...", icon='ICON_PREFERENCES')
+        layout.operator("wm.read_homefile", text="Load Factory Settings").factory = True
 
         layout.separator()
+        
         layout.operator_context = 'INVOKE_AREA'
         layout.operator("wm.link_append", text="Link")
         layout.operator("wm.link_append", text="Append").link = False
+        
         layout.separator()
 
         layout.menu("INFO_MT_file_import")

Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c	2009-11-29 23:14:41 UTC (rev 25010)
+++ trunk/blender/source/blender/blenkernel/intern/object.c	2009-11-29 23:54:41 UTC (rev 25011)
@@ -962,20 +962,22 @@
 
 	/* default object vars */
 	ob->type= type;
-	/* ob->transflag= OB_QUAT; */
-	ob->rotmode= ROT_MODE_EUL;
-
-#if 0 /* not used yet */
-	unit_qt(ob->quat);
-	unit_qt(ob->dquat);
-#endif 
-
+	
 	ob->col[0]= ob->col[1]= ob->col[2]= 1.0;
 	ob->col[3]= 1.0;
-
-	ob->loc[0]= ob->loc[1]= ob->loc[2]= 0.0;
-	ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
+	
 	ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
+	
+	/* objects should default to having Euler XYZ rotations, 
+	 * but rotations default to quaternions 
+	 */
+	ob->rotmode= ROT_MODE_EUL;
+	/* axis-angle must not have a 0,0,0 axis, so set y-axis as default... */
+	ob->rotAxis[1]= ob->drotAxis[1]= 1.0f;
+	/* quaternions should be 1,0,0,0 by default.... */
+	ob->quat[0]= ob->dquat[0]= 1.0f;
+	/* rotation locks should be 4D for 4 component rotations by default... */
+	ob->protectflag = OB_LOCK_ROT4D;
 
 	unit_m4(ob->constinv);
 	unit_m4(ob->parentinv);
@@ -993,11 +995,6 @@
 		ob->upflag= OB_POSZ;
 	}
 	
-#if 0 // XXX old animation system
-	ob->ipoflag = OB_OFFS_OB+OB_OFFS_PARENT;
-	ob->ipowin= ID_OB;	/* the ipowin shown */
-#endif // XXX old animation system
-	
 	ob->dupon= 1; ob->dupoff= 0;
 	ob->dupsta= 1; ob->dupend= 100;
 	ob->dupfacesca = 1.0;
@@ -1039,17 +1036,6 @@
 
 	ob->lay= scene->lay;
 	
-	/* objects should default to having Euler XYZ rotations, 
-	 * but rotations default to quaternions 
-	 */
-	ob->rotmode= ROT_MODE_EUL;
-	/* axis-angle must not have a 0,0,0 axis, so set y-axis as default... */
-	ob->rotAxis[1]= ob->drotAxis[1]= 1.0f;
-	/* quaternions should be 1,0,0,0 by default.... */
-	ob->quat[0]= 1.0f;
-	/* rotation locks should be 4D for 4 component rotations by default... */
-	ob->protectflag = OB_LOCK_ROT4D;
-
 	base= scene_add_base(scene, ob);
 	scene_select_base(scene, base);
 	ob->recalc |= OB_RECALC;





More information about the Bf-blender-cvs mailing list