- Fix some things I missed in my last commit
authorJiri Hnidek <jiri.hnidek@tul.cz>
Wed, 29 Jul 2009 14:07:51 +0000 (14:07 +0000)
committerJiri Hnidek <jiri.hnidek@tul.cz>
Wed, 29 Jul 2009 14:07:51 +0000 (14:07 +0000)
 - Change name of OBJECT_OT_object_add operator
 - Use new OBJECT_OT_object_add operator in space_info.py

release/ui/space_info.py
source/blender/editors/metaball/editmball.c
source/blender/editors/object/object_edit.c
source/blender/makesrna/intern/rna_meta.c

index 3cc01a35c1fa402f328bdc92bfe678093e4c414e..855ce0b4f8fe325a75b4ea543270cfaec7af6885 100644 (file)
@@ -113,7 +113,7 @@ class INFO_MT_add(bpy.types.Menu):
                layout.item_menu_enumO( "OBJECT_OT_mesh_add", "type", text="Mesh", icon="ICON_OUTLINER_OB_MESH")
                layout.item_menu_enumO( "OBJECT_OT_curve_add", "type", text="Curve", icon="ICON_OUTLINER_OB_CURVE")
                layout.item_menu_enumO( "OBJECT_OT_surface_add", "type", text="Surface", icon="ICON_OUTLINER_OB_SURFACE")
-               layout.item_enumO("OBJECT_OT_object_add", "type", "META", icon="ICON_OUTLINER_OB_META")
+               layout.item_menu_enumO( "OBJECT_OT_metaball_add", "type", "META", icon="ICON_OUTLINER_OB_META")
                layout.itemO("OBJECT_OT_text_add", text="Text", icon="ICON_OUTLINER_OB_FONT")
 
                layout.itemS()
index 7b9175f8ae068a337b5a2fc9b393d599786050a6..b9bb219783f35a136d2f04b6efadf630757f6cd0 100644 (file)
@@ -45,6 +45,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_view3d_types.h"
 #include "DNA_windowmanager_types.h"
+#include "DNA_userdef_types.h"
 
 #include "RNA_define.h"
 #include "RNA_access.h"
@@ -106,6 +107,8 @@ MetaElem *add_metaball_primitive(bContext *C, int type, int newname)
        MetaElem *ml;
        float *curs, mat[3][3], cent[3], imat[3][3], cmat[3][3];
 
+       if(!obedit) return NULL;
+
        /* Deselect all existing metaelems */
        ml= mball->editelems->first;
        while(ml) {
@@ -114,7 +117,6 @@ MetaElem *add_metaball_primitive(bContext *C, int type, int newname)
        }
 
        Mat3CpyMat4(mat, obedit->obmat);
-
        if(v3d) {
                curs= give_cursor(scene, v3d);
                VECCOPY(cent, curs);
@@ -127,12 +129,17 @@ MetaElem *add_metaball_primitive(bContext *C, int type, int newname)
        cent[2]-= obedit->obmat[3][2];
 
        if (rv3d) {
-               Mat3CpyMat4(imat, rv3d->viewmat);
+               if (!(newname) || U.flag & USER_ADD_VIEWALIGNED || !rv3d)
+                       Mat3CpyMat4(imat, rv3d->viewmat);
+               else
+                       Mat3One(imat);
                Mat3MulVecfl(imat, cent);
                Mat3MulMat3(cmat, imat, mat);
                Mat3Inv(imat,cmat);
                Mat3MulVecfl(imat, cent);
        }
+       else
+               Mat3One(imat);
 
        ml= MEM_callocN(sizeof(MetaElem), "metaelem");
 
index f699ae93a08ace9a3cf5f11084c040d7de22472e..f34dc2e7c2372a6adc987374562d8e54865b57a8 100644 (file)
@@ -597,7 +597,7 @@ static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *even
 void OBJECT_OT_metaball_add(wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name= "Add Metaball";
+       ot->name= "Metaball";
        ot->description= "Add an metaball object to the scene.";
        ot->idname= "OBJECT_OT_metaball_add";
 
index beb5bbaf51b6cbb4cf7c1d17431dd4d11ecda1dd..d57c102a35f718ea912ef85acd5dd902268484cb 100644 (file)
@@ -40,6 +40,7 @@
 #include "BKE_depsgraph.h"
 
 #include "WM_types.h"
+#include "WM_api.h"
 
 static int rna_Meta_texspace_editable(PointerRNA *ptr)
 {