2.5
authorTon Roosendaal <ton@blender.org>
Wed, 14 Jan 2009 19:26:11 +0000 (19:26 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 14 Jan 2009 19:26:11 +0000 (19:26 +0000)
Editmesh: add primitive basics back. Had to clean up a load of
crap there... but it's sorta in control, so I think Shul can
pick it up again.

Test: ctrl+0 adds plane, or ctrl+9 adds grid.

Notes for Shul:
- i've added a transform function, which gets correctly passed
  on to the add_prim function, should work for all object
  transforms. Only the code inside add_prim might be needed
  to check (it uses 4x4 mat now, not a 3x3)

- The old code with buttons has been ifdeffed out, check for
  user input and make it rna properties, which get read
  in the exec(), and handed over to the add_prim. Set them
  default now to the values from old buttons.

- Operator naming is preferred lower case, I gave this
  a new name.

- check a bit on formatting code, but don't use the old code
  as example! Look also at ED_keymap_mesh() for example.

source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_lib.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/space_view3d/view3d_header.c

index 412929b64fbcf5ce56a99de24a5090c18018ed8e..c791d4e604fef3706598f93bedaad2e98d4edeb4 100644 (file)
@@ -1022,7 +1022,7 @@ void load_editMesh(Scene *scene, Object *ob)
        ClothModifierData *clmd;
        PTCacheID pid;
        float *fp, *newkey, *oldkey, nor[3], cacheco[3], cachemat[4][4];
-       int i, a, ototvert, totedge=0, cacheedit= 0;
+       int i, a, ototvert, cacheedit= 0;
        
        /* this one also tests of edges are not in faces: */
        /* eed->f2==0: not in face, f2==1: draw it */
@@ -1031,19 +1031,17 @@ void load_editMesh(Scene *scene, Object *ob)
        /* eve->f2 : being used in vertexnormals */
        edge_drawflags(em);
        
-       eed= em->edges.first;
-       while(eed) {
-               totedge++;
-               eed= eed->next;
-       }
+       G.totvert= BLI_countlist(&em->verts);
+       G.totedge= BLI_countlist(&em->edges);
+       G.totface= BLI_countlist(&em->faces);
        
        /* new Vertex block */
        if(G.totvert==0) mvert= NULL;
        else mvert= MEM_callocN(G.totvert*sizeof(MVert), "loadeditMesh vert");
 
        /* new Edge block */
-       if(totedge==0) medge= NULL;
-       else medge= MEM_callocN(totedge*sizeof(MEdge), "loadeditMesh edge");
+       if(G.totedge==0) medge= NULL;
+       else medge= MEM_callocN(G.totedge*sizeof(MEdge), "loadeditMesh edge");
        
        /* new Face block */
        if(G.totface==0) mface= NULL;
@@ -1064,7 +1062,7 @@ void load_editMesh(Scene *scene, Object *ob)
 
        /* add new custom data */
        me->totvert= G.totvert;
-       me->totedge= totedge;
+       me->totedge= G.totedge;
        me->totface= G.totface;
 
        CustomData_copy(&em->vdata, &me->vdata, CD_MASK_MESH, CD_CALLOC, me->totvert);
@@ -2096,21 +2094,24 @@ void EM_init_index_arrays(EditMesh *em, int forVert, int forEdge, int forFace)
        int i;
 
        if (forVert) {
-               g_em_vert_array = MEM_mallocN(sizeof(*g_em_vert_array)*G.totvert, "em_v_arr");
+               int tot= BLI_countlist(&em->verts);
+               g_em_vert_array = MEM_mallocN(sizeof(*g_em_vert_array)*tot, "em_v_arr");
 
                for (i=0,eve=em->verts.first; eve; i++,eve=eve->next)
                        g_em_vert_array[i] = eve;
        }
 
        if (forEdge) {
-               g_em_edge_array = MEM_mallocN(sizeof(*g_em_edge_array)*G.totedge, "em_e_arr");
+               int tot= BLI_countlist(&em->edges);
+               g_em_edge_array = MEM_mallocN(sizeof(*g_em_edge_array)*tot, "em_e_arr");
 
                for (i=0,eed=em->edges.first; eed; i++,eed=eed->next)
                        g_em_edge_array[i] = eed;
        }
 
        if (forFace) {
-               g_em_face_array = MEM_mallocN(sizeof(*g_em_face_array)*G.totface, "em_f_arr");
+               int tot= BLI_countlist(&em->faces);
+               g_em_face_array = MEM_mallocN(sizeof(*g_em_face_array)*tot, "em_f_arr");
 
                for (i=0,efa=em->faces.first; efa; i++,efa=efa->next)
                        g_em_face_array[i] = efa;
index d186d264e9c8c53b82b3a823a6d7c3a78f7ca5ed..3c3cbc8411a5e6a01f8cffce4aab3b84e3024b02 100644 (file)
@@ -34,7 +34,6 @@
 
 #include "MEM_guardedalloc.h"
 
-
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_userdef_types.h"
 #include "DNA_view3d_types.h"
+#include "DNA_windowmanager_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
 #include "BLI_editVert.h"
 
+#include "BKE_context.h"
 #include "BKE_depsgraph.h"
 #include "BKE_global.h"
 #include "BKE_library.h"
 
 #include "BIF_retopo.h"
 
+#include "WM_api.h"
+#include "WM_types.h"
+
 #include "ED_mesh.h"
+#include "ED_util.h"
 #include "ED_view3d.h"
+#include "ED_screen.h"
 
 #include "mesh_intern.h"
 
@@ -70,9 +76,6 @@ static void waitcursor() {}
 static void error() {}
 static int pupmenu() {return 0;}
 #define add_numbut(a, b, c, d, e, f, g) {}
-static int do_clever_numbuts() {return 0;}
-static void check_editmode() {}
-static void exit_editmode() {}
 /* XXX */
 
 static float icovert[12][3] = {
@@ -225,7 +228,7 @@ void add_click_mesh(Scene *scene, Object *obedit, EditMesh *em)
                eve->f= SELECT;
        }
        
-       retopo_do_all();
+       //retopo_do_all();
        
        BIF_undo_push("Add vertex/edge/face");
 // XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); 
@@ -756,37 +759,6 @@ void adduplicate_mesh(Scene *scene, Object *obedit, EditMesh *em)
 //     Transform();
 }
 
-/* check whether an object to add mesh to exists, if not, create one
-* returns 1 if new object created, else 0 */
-static int confirm_objectExists(Scene *scene, Object *obedit, Mesh **me, float mat[][3] )
-{
-       int newob = 0;
-       
-       /* if no obedit: new object and enter editmode */
-       if(obedit==NULL) {
-               /* add_object actually returns an object ! :-)
-               But it also stores the added object struct in
-               scene->basact->object (BASACT->object) */
-
-// XXX         add_object_draw(OB_MESH);
-
-               obedit= BASACT->object;
-               
-               where_is_object(scene, obedit);
-               
-               make_editMesh(scene, obedit); 
-               newob= 1;
-       }
-       *me = obedit->data;
-       
-       /* deselectall */
-       EM_clear_flag_all((*me)->edit_mesh, SELECT);
-       
-       /* imat and center and size */
-       Mat3CpyMat4(mat, obedit->obmat);
-       
-       return newob;
-}
 
 // HACK: these can also be found in cmoview.tga.c, but are here so that they can be found by linker
 // this hack is only used so that scons+mingw + split-sources hack works
@@ -934,29 +906,35 @@ signed char monkeyf[250][4]= {
        // ------------------------------- end copied code
 
 
-void make_prim(Object *obedit, EditMesh *em, int type, float imat[3][3], int tot, int seg,
-               int subdiv, float dia, float d, int ext, int fill,
-        float cent[3])
+#define PRIM_PLANE     0
+#define PRIM_CUBE      1
+#define PRIM_CIRCLE    4
+#define PRIM_GRID      10
+
+static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int seg,
+               int subdiv, float dia, float depth, int ext, int fill)
 {
        /*
         * type - for the type of shape
         * dia - the radius for cone,sphere cylinder etc.
-        * d - depth for the cone
-        * ext - ?
+        * depth - 
+        * ext - extrude
         * fill - end capping, and option to fill in circle
         * cent[3] - center of the data. 
         * */
-       
+       EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
        EditVert *eve, *v1=NULL, *v2, *v3, *v4=NULL, *vtop, *vdown;
        float phi, phid, vec[3];
        float q[4], cmat[3][3], nor[3]= {0.0, 0.0, 0.0};
        short a, b;
+       
+       EM_clear_flag_all(em, SELECT);
 
        phid= 2*M_PI/tot;
        phi= .25*M_PI;
 
        switch(type) {
-       case 10: /*  grid */
+       case PRIM_GRID: /*  grid */
                /* clear flags */
                eve= em->verts.first;
                while(eve) {
@@ -967,10 +945,10 @@ void make_prim(Object *obedit, EditMesh *em, int type, float imat[3][3], int tot
                phi= 1.0; 
                phid= 2.0/((float)tot-1);
                for(a=0;a<tot;a++) {
-                       vec[0]= cent[0]+dia*phi;
-                       vec[1]= cent[1]- dia;
-                       vec[2]= cent[2];
-                       Mat3MulVecfl(imat,vec);
+                       vec[0]= dia*phi;
+                       vec[1]= - dia;
+                       vec[2]= 0.0f;
+                       Mat4MulVecfl(mat,vec);
                        eve= addvertlist(em, vec, NULL);
                        eve->f= 1+2+4;
                        if (a) {
@@ -981,7 +959,8 @@ void make_prim(Object *obedit, EditMesh *em, int type, float imat[3][3], int tot
                /* extrude and translate */
                vec[0]= vec[2]= 0.0;
                vec[1]= dia*phid;
-               Mat3MulVecfl(imat, vec);
+               Mat4Mul3Vecfl(mat, vec);
+               
                for(a=0;a<seg-1;a++) {
                        extrudeflag_vert(obedit, em, 2, nor);   // nor unused
                        translateflag(em, 2, vec);
@@ -1028,8 +1007,7 @@ void make_prim(Object *obedit, EditMesh *em, int type, float imat[3][3], int tot
                eve= em->verts.first;
                while(eve) {
                        if(eve->f & SELECT) {
-                               VecAddf(eve->co,eve->co,cent);
-                               Mat3MulVecfl(imat,eve->co);
+                               Mat4MulVecfl(mat,eve->co);
                        }
                        eve= eve->next;
                }
@@ -1070,8 +1048,7 @@ void make_prim(Object *obedit, EditMesh *em, int type, float imat[3][3], int tot
                        eve= em->verts.first;
                        while(eve) {
                                if(eve->f & 2) {
-                                       VecAddf(eve->co,eve->co,cent);
-                                       Mat3MulVecfl(imat,eve->co);
+                                       Mat4MulVecfl(mat,eve->co);
                                }
                                eve= eve->next;
                        }
@@ -1110,26 +1087,25 @@ void make_prim(Object *obedit, EditMesh *em, int type, float imat[3][3], int tot
                        /* and now do imat */
                        for(eve= em->verts.first; eve; eve= eve->next) {
                                if(eve->f & SELECT) {
-                                       VecAddf(eve->co,eve->co,cent);
-                                       Mat3MulVecfl(imat,eve->co);
+                                       Mat4MulVecfl(mat,eve->co);
                                }
                        }
                        recalc_editnormals(em);
                }
                break;
        default: /* all types except grid, sphere... */
-               if(ext==0 && type!=7) d= 0;
+               if(ext==0 && type!=7) depth= 0.0f;
        
                /* vertices */
                vtop= vdown= v1= v2= 0;
                for(b=0; b<=ext; b++) {
                        for(a=0; a<tot; a++) {
                                
-                               vec[0]= cent[0]+dia*sin(phi);
-                               vec[1]= cent[1]+dia*cos(phi);
-                               vec[2]= cent[2]+d;
+                               vec[0]= dia*sin(phi);
+                               vec[1]= dia*cos(phi);
+                               vec[2]= depth;
                                
-                               Mat3MulVecfl(imat, vec);
+                               Mat4MulVecfl(mat, vec);
                                eve= addvertlist(em, vec, NULL);
                                eve->f= SELECT;
                                if(a==0) {
@@ -1138,20 +1114,20 @@ void make_prim(Object *obedit, EditMesh *em, int type, float imat[3][3], int tot
                                }
                                phi+=phid;
                        }
-                       d= -d;
+                       depth= -depth;
                }
                /* center vertices */
                /* type 7, a cone can only have 1 one side filled
                 * if the cone has no capping, dont add vtop */
                if((fill && type>1) || type == 7) {
-                       VECCOPY(vec,cent);
-                       vec[2]-= -d;
-                       Mat3MulVecfl(imat,vec);
+                       vec[0]= vec[1]= 0.0f;
+                       vec[2]-= -depth;
+                       Mat4MulVecfl(mat, vec);
                        vdown= addvertlist(em, vec, NULL);
                        if((ext || type==7) && fill) {
-                               VECCOPY(vec,cent);
-                               vec[2]-= d;
-                               Mat3MulVecfl(imat,vec);
+                               vec[0]= vec[1]= 0.0f;
+                               vec[2]-= depth;
+                               Mat4MulVecfl(mat,vec);
                                vtop= addvertlist(em, vec, NULL);
                        }
                } else {
@@ -1225,6 +1201,7 @@ void make_prim(Object *obedit, EditMesh *em, int type, float imat[3][3], int tot
                righthandfaces(em, 1);  /* otherwise monkey has eyes in wrong direction */
 }
 
+#if 0
 void add_primitiveMesh(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, int type)
 {
        Mesh *me;
@@ -1378,7 +1355,7 @@ void add_primitiveMesh(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em,
        phid= 2*M_PI/tot;
        phi= .25*M_PI;
 
-       make_prim(obedit, em, type, imat, tot, seg, subdiv, dia, d, ext, fill, cent);
+       make_prim(obedit, type, imat, tot, seg, subdiv, dia, d, ext, fill, cent);
 
        if(type<2) tot = totoud;
 
@@ -1398,4 +1375,101 @@ void add_primitiveMesh(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em,
        
        BIF_undo_push(undostr);
 }
+#endif
+
+/* uses context to figure out transform for primitive */
+/* returns standard diameter */
+static float new_primitive_matrix(bContext *C, float primmat[][4])
+{
+       Object *obedit= CTX_data_edit_object(C);
+       Scene *scene = CTX_data_scene(C);
+       ScrArea *sa = CTX_wm_area(C);
+       View3D *v3d = NULL;
+       float *curs, mat[3][3], vmat[3][3], cmat[3][3], imat[3][3];
+       
+       Mat4One(primmat);
+       
+       if(sa->spacetype==SPACE_VIEW3D)
+               v3d= sa->spacedata.first;
+       
+       if(v3d)
+               Mat3CpyMat4(vmat, v3d->viewmat);
+       else
+               Mat3One(vmat);
+       
+       /* inverse transform for view and object */
+       Mat3CpyMat4(mat, obedit->obmat);
+       Mat3MulMat3(cmat, vmat, mat);
+       Mat3Inv(imat, cmat);
+       Mat4CpyMat3(primmat, imat);
+
+       /* center */
+       curs= give_cursor(scene, v3d);
+       VECCOPY(primmat[3], curs);
+       Mat3Inv(imat, mat);
+       Mat3MulVecfl(imat, primmat[3]);
+       VECSUB(primmat[3], primmat[3], obedit->obmat[3]);
+       
+       if(v3d) return v3d->grid;
+       return 1.0f;
+}
+
+/* ********* add primitive operators ************* */
+
+static int add_primitive_plane_exec(bContext *C, wmOperator *op)
+{
+       Object *obedit= CTX_data_edit_object(C);
+       float dia, mat[4][4];
+       
+       dia= new_primitive_matrix(C, mat);
+       
+       /* plane (diameter of 1.41 makes it unit size) */
+       dia*= sqrt(2.0f);
+       
+       make_prim(obedit, PRIM_PLANE, mat, 4, 0, 0, dia, 0.0f, 0, 1);
+       
+       ED_undo_push(C, "Add Plane");   // Note this will become depricated 
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       
+       return OPERATOR_FINISHED;       
+}
 
+void MESH_OT_add_primitive_plane(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Add Plane";
+       ot->idname= "MESH_OT_add_primitive_plane";
+       
+       /* api callbacks */
+       ot->exec= add_primitive_plane_exec;
+       ot->poll= ED_operator_editmesh;
+}
+
+static int add_primitive_grid_exec(bContext *C, wmOperator *op)
+{
+       Object *obedit= CTX_data_edit_object(C);
+       float dia, mat[4][4];
+       
+       dia= new_primitive_matrix(C, mat);
+       
+       /* plane (diameter of 1.41 makes it unit size) */
+       dia*= sqrt(2.0f);
+       
+       make_prim(obedit, PRIM_GRID, mat, 10, 10, 0, dia, 0.0f, 0, 1);
+       
+       ED_undo_push(C, "Add Plane");   // Note this will become depricated 
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       
+       return OPERATOR_FINISHED;       
+}
+
+void MESH_OT_add_primitive_grid(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Add Grid";
+       ot->idname= "MESH_OT_add_primitive_grid";
+       
+       /* api callbacks */
+       ot->exec= add_primitive_grid_exec;
+       ot->poll= ED_operator_editmesh;
+}
index de6cd14b453a40e94e51451605a96386338b4783..93de720d4f6174d5a20678330e54923dc1d1c0eb 100644 (file)
@@ -1357,7 +1357,7 @@ short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor)
        short sel=0, del_old= 0, is_face_sel=0;
        ModifierData *md;
 
-       if(em) return 0;
+       if(em==NULL) return 0;
 
        md = obedit->modifiers.first;
 
index 5d7deafab019b9777b1b1d6f1e74476b6edaed73..e11b4c384469bda3068141d756a6b8a52939d388 100644 (file)
@@ -94,6 +94,8 @@ int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed);
 void em_setup_viewcontext(struct bContext *C, ViewContext *vc);
 
 /* ******************* editmesh_add.c */
+void MESH_OT_add_primitive_plane(struct wmOperatorType *ot);
+void MESH_OT_add_primitive_grid(struct wmOperatorType *ot);
 
 
 /* ******************* editmesh_lib.c */
@@ -172,8 +174,6 @@ void MESH_OT_select_linked_flat_faces(struct wmOperatorType *ot);
 void MESH_OT_select_sharp_edges(struct wmOperatorType *ot);
 
 
-
-
 extern EditEdge *findnearestedge(ViewContext *vc, int *dist);
 extern void EM_automerge(int update);
 void editmesh_select_by_material(EditMesh *em, int index);
index 4363f26e175add4c717027c3650035cec1ad2079..4557d778337a7ad3a5e6fc4555be1e713bd5779d 100644 (file)
 void ED_operatortypes_mesh(void)
 {
        WM_operatortype_append(MESH_OT_de_select_all);
-
        WM_operatortype_append(MESH_OT_select_more);
-
        WM_operatortype_append(MESH_OT_select_less);
-       
        WM_operatortype_append(MESH_OT_selectswap_mesh);
-       
        WM_operatortype_append(MESH_OT_select_non_manifold);
-       
        WM_operatortype_append(MESH_OT_selectconnected_mesh_all);
-       
        WM_operatortype_append(MESH_OT_selectconnected_mesh);
-       
        WM_operatortype_append(MESH_OT_hide_mesh);
-       
        WM_operatortype_append(MESH_OT_reveal_mesh);
-       
        WM_operatortype_append(MESH_OT_righthandfaces);
-       
        WM_operatortype_append(MESH_OT_select_linked_flat_faces);
-       
        WM_operatortype_append(MESH_OT_select_sharp_edges);
+       WM_operatortype_append(MESH_OT_add_primitive_plane);
+       WM_operatortype_append(MESH_OT_add_primitive_grid);
 
 }
 
@@ -95,37 +86,29 @@ void ED_keymap_mesh(wmWindowManager *wm)
 {
        ListBase *keymap= WM_keymap_listbase(wm, "EditMesh", 0, 0);
        
+       /* selecting */
        WM_keymap_add_item(keymap, "MESH_OT_de_select_all", AKEY, KM_PRESS, 0, 0);
-       
        WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
-
        WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
-       
        WM_keymap_add_item(keymap, "MESH_OT_selectswap_mesh", IKEY, KM_PRESS, KM_CTRL, 0);
-       
        WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0);
-       
        WM_keymap_add_item(keymap, "MESH_OT_selectconnected_mesh_all", LKEY, KM_PRESS, KM_CTRL, 0);
-       
        WM_keymap_add_item(keymap, "MESH_OT_selectconnected_mesh", LKEY, KM_PRESS, 0, 0);
+       RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_linked_flat_faces", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"fsharpness",135.0);
+       RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_sharp_edges", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"fsharpness",135.0);          
        
+       /* hide */
        WM_keymap_add_item(keymap, "MESH_OT_hide_mesh", HKEY, KM_PRESS, 0, 0);
-       
        RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_hide_mesh", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "swap", 1);
-       
        WM_keymap_add_item(keymap, "MESH_OT_reveal_mesh", HKEY, KM_PRESS, KM_ALT, 0);
        
+       /* tools */
        RNA_int_set(WM_keymap_add_item(keymap, "MESH_OT_righthandfaces", NKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "select", 2);
-       
        RNA_int_set(WM_keymap_add_item(keymap, "MESH_OT_righthandfaces", NKEY, KM_PRESS, KM_CTRL, 0)->ptr, "select", 1);
        
-       RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_linked_flat_faces", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"fsharpness",135.0);
-       
-       RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_sharp_edges", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"fsharpness",135.0);          
-       
-       
-       
+       /* add */
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_plane", ZEROKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_grid", NINEKEY, KM_PRESS, KM_CTRL, 0);
 
-//     RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_viewzoom", PADPLUSKEY, KM_PRESS, 0, 0)->ptr, "delta", 1);
 }
 
index d37cb7aa11f09f648e25d720131f4ddd2bacfe6a..e06d8f16330c959d19181e34e978986d4ab2d8b3 100644 (file)
@@ -5214,7 +5214,10 @@ static char *view3d_modeselect_pup(Scene *scene)
 
        str += sprintf(str, "Mode: %%t");
        
-       str += sprintf(str, formatstr, "Object Mode", V3D_OBJECTMODE_SEL, ICON_OBJECT);
+       if(ob)
+               str += sprintf(str, formatstr, "Object Mode", V3D_OBJECTMODE_SEL, ICON_OBJECT);
+       else
+               str += sprintf(str, formatstr, " ", V3D_OBJECTMODE_SEL, ICON_OBJECT);
        
        if(ob==NULL) return string;