-> Enter/Exit editmode wait cursor flags
authorGeoffrey Bantle <hairbat@yahoo.com>
Thu, 28 Sep 2006 01:55:44 +0000 (01:55 +0000)
committerGeoffrey Bantle <hairbat@yahoo.com>
Thu, 28 Sep 2006 01:55:44 +0000 (01:55 +0000)
The wait cursor was being called during editmode enter and exit for meshes.
This was a problem for several reasons. First of all, python modules like
Mesh now make use of editmode features. These methods that wrap editmode
tools may be called many times during the execution of a script
and lead to the wait cursor rapidly flickering on and off.

The other problem was that the wait cursor wasn't being called for editmode
enter and exit of all data types. This is unified now.

-New Arguments

enter_editmode() should be passed a nonzero integer or simply EM_WAITCURSOR
if the wait cursor is desired. Currently only the python API passes a '0'
to enter_editmode()

exit_editmode() has several options and they are passed in as the bitflags
EM_FREEDATA, EM_FREEUNDO and EM_WAITCURSOR. These flags are defined in
BDR_editobject.h.

18 files changed:
source/blender/include/BDR_editobject.h
source/blender/python/api2_2x/Blender.c
source/blender/python/api2_2x/NMesh.c
source/blender/python/api2_2x/Object.c
source/blender/python/api2_2x/Window.c
source/blender/src/drawscene.c
source/blender/src/editarmature.c
source/blender/src/editcurve.c
source/blender/src/editfont.c
source/blender/src/editmesh.c
source/blender/src/editobject.c
source/blender/src/header_info.c
source/blender/src/header_view3d.c
source/blender/src/meshtools.c
source/blender/src/outliner.c
source/blender/src/poseobject.c
source/blender/src/toets.c
source/blender/src/verse_object.c

index 83ff29d72cc6c2efa7efaf777c7510c47ab97a5a..b86209f46f63d779e83b339b57bd997fca32d850 100644 (file)
@@ -56,9 +56,13 @@ void make_vertex_parent(void);
 int test_parent_loop(struct Object *par, struct Object *ob);
 void make_parent(void);
 
-void exit_editmode(int freedata);
+#define EM_WAITCURSOR  (1 << 0)
+#define EM_FREEDATA    (1 << 1)
+#define EM_FREEUNDO    (1 << 2)
+
+void exit_editmode(int flag);
 void check_editmode(int type);
-void enter_editmode(void);
+void enter_editmode(int wc);
 
 void docentre(int centremode);
 void docentre_new(void);
index e4cbd0dab0df33f84cee2e68eb8fdf41bc7fa270..8b013068e131fe15e03279945a39d85590a852fd 100644 (file)
@@ -609,7 +609,7 @@ static PyObject *Blender_Load( PyObject * self, PyObject * args )
        }
 
        if( G.obedit )
-               exit_editmode( 1 );
+               exit_editmode(EM_FREEDATA);
 
        if (G.background) { /* background mode */
                if (is_blend_file)
index 722593569a32149a4d3952e83b293b3169a4b5de..fe97a7c916a7affeab25f940e59e5ed4ac05dc9f 100644 (file)
@@ -3253,8 +3253,8 @@ static PyObject *M_NMesh_PutRaw( PyObject * self, PyObject * args )
                EXPP_allqueue( REDRAWVIEW3D, 0 );
 
        if (ob && G.obedit) { /* prevents a crash when a new object is created */
-               exit_editmode(1);
-               enter_editmode();
+               exit_editmode(EM_FREEDATA);
+               enter_editmode(0);
        }
 
        // @OK...this requires some explanation:
index b4f784c67b504a477c271135dc6a8003997041fe..6aeff4b320c41623dd4be22bdead23d6ab9ba65d 100644 (file)
@@ -1839,7 +1839,7 @@ static PyObject *Object_join( BPy_Object * self, PyObject * args )
 
        /* exit editmode so join can be done */
        if( G.obedit )
-               exit_editmode( 1 );
+               exit_editmode( EM_FREEDATA );
        
        temp_scene = add_scene( "Scene" ); /* make the new scene */
        temp_scene->lay= 1; /* first layer on */
index 9c40f9ffa292874436040eb55212e67584f52835..175e8a7b18b900aa0555514efc571da259944aa2 100644 (file)
@@ -899,14 +899,14 @@ static PyObject *M_Window_EditMode( PyObject * self, PyObject * args )
        if( status >= 0 ) {
                if( status ) {
                        if( !G.obedit )
-                               enter_editmode(  );
+                               enter_editmode(0);
                } else if( G.obedit ) {
                        if( do_undo && U.undosteps != 0 ) {
                                if( undo_str_len > 63 )
                                        undo_str[63] = '\0';    /* 64 is max */
                                undo_push_mesh( undo_str );     /* use better solution after 2.34 */
                        }
-                       exit_editmode( 1 );
+                       exit_editmode( EM_FREEDATA );
                }
        }
 
index 4528c2125f45e71dd21298438918b857625ac5a5..6d5251494c092ba58125fb9c213635e0dbf51846 100644 (file)
@@ -71,7 +71,7 @@ void set_scene(Scene *sce)            /* also see scene.c: set_scene_bg() */
        
        /* ending all modes */
        if( G.obedit) 
-               exit_editmode(2);
+               exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
        
        if(G.f & G_FACESELECT)
                set_faceselect();
index 87ef080807f90dc8a4b0d5d2767c1ee305630b90..ecf0958efc425fe189dcc8695229e5fc6e823db5 100644 (file)
@@ -384,7 +384,7 @@ int join_armature(void)
        
        /*      Put the active armature into editmode and join the bones from the other one*/
 
-       enter_editmode();
+       enter_editmode(EM_WAITCURSOR);
        
        for (base=FIRSTBASE; base; base=nextbase) {
                nextbase = base->next;
@@ -447,7 +447,7 @@ int join_armature(void)
        
        DAG_scene_sort(G.scene);        // because we removed object(s)
        
-       exit_editmode(1);
+       exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWOOPS, 0);
        return 1;
index a899cee70d9f147b07c98340dff21795d585d136..54645bce9c9aa66df80b6caf270b7d68a93922df 100644 (file)
@@ -3357,8 +3357,8 @@ int join_curve(int type)
        
        DAG_scene_sort(G.scene);        // because we removed object(s), call before editmode!
        
-       enter_editmode();
-       exit_editmode(1);
+       enter_editmode(EM_WAITCURSOR);
+       exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
        
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWBUTSEDIT, 0);
index e7b65f15f16afdefac21c10b37b57cd826a8a70b..9447ef59bbb6aafd63915b01d2e3ece17fe054c5 100644 (file)
@@ -416,7 +416,7 @@ void txt_export_to_object(struct Text *text)
        }
 
        make_editText();
-       exit_editmode(1);
+       exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
 
        allqueue(REDRAWVIEW3D, 0);
 }
@@ -487,7 +487,7 @@ void txt_export_to_objects(struct Text *text)
                cu->pos= cu->len;
 
                make_editText();
-               exit_editmode(1);
+               exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
 
                linenum++;
                curline = curline->next;
@@ -1188,7 +1188,7 @@ void add_primitiveFont(int dummy_argument)
        cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
        cu->tb[0].w = cu->tb[0].h = 0.0;
        
-       enter_editmode();
+       enter_editmode(EM_WAITCURSOR);
 
        allqueue(REDRAWALL, 0);
 }
index 72b118b56a2c754612ced1b26174819e790250d6..7d2837df2416af45f4e9337ccd96fca683054e43 100644 (file)
@@ -801,7 +801,6 @@ void make_editMesh()
                return;
        }
        
-       waitcursor(1);
 
        /* initialize fastmalloc for editmesh */
        init_editmesh_fastmalloc(G.editMesh, me->totvert, me->totedge, me->totface);
@@ -948,7 +947,6 @@ void make_editMesh()
        
        countall();
        
-       waitcursor(0);
 }
 
 /* makes Mesh out of editmesh */
@@ -969,7 +967,6 @@ void load_editMesh(void)
        int i, a, ototvert, totedge=0;
        MDeformVert *dvert;
 
-       waitcursor(1);
 
 #ifdef WITH_VERSE
        if(em->vnode) {
@@ -1363,7 +1360,6 @@ void load_editMesh(void)
        }
 
        mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
-       waitcursor(0);
 }
 
 void remake_editMesh(void)
index 03de38ac51cb08b7c43cb6bc1e4b070f76ce724d..55bfa4d3d4604528a3006c969d2bb1949882f43f 100644 (file)
@@ -187,7 +187,7 @@ void add_object_draw(int type)      /* for toolbox or menus, only non-editmode stuff
        setcursor_space(SPACE_VIEW3D, CURSOR_STD);
 
        if ELEM3(curarea->spacetype, SPACE_VIEW3D, SPACE_BUTS, SPACE_INFO) {
-               if (G.obedit) exit_editmode(2); // freedata, and undo
+               if (G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); // freedata, and undo
                ob= add_object(type);
                set_active_base(BASACT);
                base_init_from_view3d(BASACT, G.vd);
@@ -1449,7 +1449,7 @@ void make_parent(void)
 }
 
 
-void enter_editmode(void)
+void enter_editmode(int wc)
 {
        Base *base;
        Object *ob;
@@ -1474,6 +1474,8 @@ void enter_editmode(void)
                return;
        }
        
+       if(wc) waitcursor(1);
+       
        if(ob->type==OB_MESH) {
                me= get_mesh(ob);
                if( me==0 ) return;
@@ -1534,16 +1536,20 @@ void enter_editmode(void)
                
        }
        else G.obedit= NULL;
-
+       
+       if(wc) waitcursor(0);
+       
        scrarea_queue_headredraw(curarea);
 }
 
-void exit_editmode(int freedata)       /* freedata==0 at render, 1= freedata, 2= do undo buffer too */
+void exit_editmode(int flag)   /* freedata==0 at render, 1= freedata, 2= do undo buffer too */
 {
        Object *ob;
-
+       int freedata = flag & EM_FREEDATA, freeundo = flag & EM_FREEUNDO;
+       
        if(G.obedit==NULL) return;
 
+       if(flag & EM_WAITCURSOR) waitcursor(1);
        if(G.obedit->type==OB_MESH) {
 
                /* temporal */
@@ -1614,8 +1620,10 @@ void exit_editmode(int freedata) /* freedata==0 at render, 1= freedata, 2= do un
 
        scrarea_queue_headredraw(curarea);
        
-       if(G.obedit==NULL && freedata==2
+       if(G.obedit==NULL && flag & EM_FREEUNDO
                BIF_undo_push("Editmode");
+       
+       if(flag & EM_WAITCURSOR) waitcursor(0);
 }
 
 void check_editmode(int type)
@@ -1623,7 +1631,7 @@ void check_editmode(int type)
        
        if (G.obedit==0 || G.obedit->type==type) return;
 
-       exit_editmode(2); // freedata, and undo
+       exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); // freedata, and undo
 }
 
 /* 0 == do centre, 1 == centre new, 2 == centre cursor */
@@ -2481,8 +2489,8 @@ void convertmenu(void)
 
                                        /* texspace and normals */
                                        BASACT= base;
-                                       enter_editmode();
-                                       exit_editmode(1); // freedata, but no undo
+                                       enter_editmode(EM_WAITCURSOR);
+                                       exit_editmode(EM_FREEDATA|EM_WAITCURSOR); // freedata, but no undo
                                        BASACT= basact;
                                }
                        }
@@ -2525,8 +2533,8 @@ void convertmenu(void)
                                                
                                                /* So we can see the wireframe */
                                                BASACT= basen;
-                                               enter_editmode();
-                                               exit_editmode(1); // freedata, but no undo
+                                               enter_editmode(EM_WAITCURSOR);
+                                               exit_editmode(EM_FREEDATA|EM_WAITCURSOR); // freedata, but no undo
                                                BASACT= basact;
                                                
                                                /* If the original object is active then make this object active */
@@ -3451,9 +3459,9 @@ void apply_object()
                                
                                /* texspace and normals */
                                BASACT= base;
-                               enter_editmode();
+                               enter_editmode(EM_WAITCURSOR);
                                BIF_undo_push("Applied object");        // editmode undo itself
-                               exit_editmode(1); // freedata, but no undo
+                               exit_editmode(EM_FREEDATA|EM_WAITCURSOR); // freedata, but no undo
                                BASACT= basact;                         
                                
                        }
@@ -3519,9 +3527,9 @@ void apply_object()
                                
                                /* texspace and normals */
                                BASACT= base;
-                               enter_editmode();
+                               enter_editmode(EM_WAITCURSOR);
                                BIF_undo_push("Applied object");        // editmode undo itself
-                               exit_editmode(1); // freedata, but no undo
+                               exit_editmode(EM_FREEDATA|EM_WAITCURSOR); // freedata, but no undo
                                BASACT= basact;
                        }
                }
index 98f07ca239394487cec7d351c351391688c78945..6ab3f8fee69a48f1b9f8b2ae0e7cbc8704096795 100644 (file)
@@ -492,7 +492,7 @@ void do_info_buttons(unsigned short event)
                if(okee("Delete current scene")) {
                        
                        /* exit modes... could become single call once */
-                       exit_editmode(1);
+                       exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
                        if(G.f & G_VERTEXPAINT) set_vpaint(); /* Switch off vertex paint */
                        if(G.f & G_TEXTUREPAINT) set_texturepaint(); /* Switch off tex paint */
                        if(G.f & G_WEIGHTPAINT) set_wpaint();           /* Switch off weight paint */
index 42dc0343aea85f0c45a0b8dcc9a35e5d6727ae12..f514c51a94fbbc3ac15408310bc63dc758ed337b 100644 (file)
@@ -4295,7 +4295,7 @@ void do_view3d_buttons(short event)
                        if(G.f & G_WEIGHTPAINT) set_wpaint();           /* Switch off weight paint */
                        if(G.f & G_FACESELECT) set_faceselect(); /* Switch off face select */
                        if(ob) exit_posemode();         /* exit posemode for active object */
-                       if(G.obedit) exit_editmode(2);  /* exit editmode and undo */
+                       if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);      /* exit editmode and undo */
                } 
                else if (G.vd->modeselect == V3D_EDITMODE_SEL) {
                        if(!G.obedit) {
@@ -4304,13 +4304,13 @@ void do_view3d_buttons(short event)
                                if(G.f & G_TEXTUREPAINT) set_texturepaint(); /* Switch off tex paint */
                                if(G.f & G_WEIGHTPAINT) set_wpaint();           /* Switch off weight paint */
                                        
-                               enter_editmode();
+                               enter_editmode(EM_WAITCURSOR);
                                BIF_undo_push("Original");      /* here, because all over code enter_editmode is abused */
                        }
                } 
                else if (G.vd->modeselect == V3D_FACESELECTMODE_SEL) {
                        if ((G.obedit) && (G.f & G_FACESELECT)) {
-                               exit_editmode(2); /* exit editmode and undo */
+                               exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
                        } else if ((G.f & G_FACESELECT) && (G.f & G_VERTEXPAINT)) {
                                if(G.f & G_VERTEXPAINT) set_vpaint(); /* Switch off vertex paint */
                        } else if ((G.f & G_FACESELECT) && (G.f & G_TEXTUREPAINT)) {
@@ -4320,7 +4320,7 @@ void do_view3d_buttons(short event)
                                if(G.f & G_VERTEXPAINT) set_vpaint(); /* Switch off vertex paint */
                                if(G.f & G_TEXTUREPAINT) set_texturepaint(); /* Switch off tex paint */
                                if(G.f & G_WEIGHTPAINT) set_wpaint();           /* Switch off weight paint */
-                               if (G.obedit) exit_editmode(2); /* exit editmode and undo */
+                               if (G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
                                
                                set_faceselect();
                        }
@@ -4330,7 +4330,7 @@ void do_view3d_buttons(short event)
                                G.vd->flag &= ~V3D_MODE;
                                if(G.f & G_TEXTUREPAINT) set_texturepaint(); /* Switch off tex paint */
                                if(G.f & G_WEIGHTPAINT) set_wpaint();           /* Switch off weight paint */
-                               if(G.obedit) exit_editmode(2);  /* exit editmode and undo */
+                               if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);      /* exit editmode and undo */
                                        
                                set_vpaint();
                        }
@@ -4340,7 +4340,7 @@ void do_view3d_buttons(short event)
                                G.vd->flag &= ~V3D_MODE;
                                if(G.f & G_VERTEXPAINT) set_vpaint(); /* Switch off vertex paint */
                                if(G.f & G_WEIGHTPAINT) set_wpaint();           /* Switch off weight paint */
-                               if(G.obedit) exit_editmode(2);  /* exit editmode and undo */
+                               if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);      /* exit editmode and undo */
                                        
                                set_texturepaint();
                        }
@@ -4350,7 +4350,7 @@ void do_view3d_buttons(short event)
                                G.vd->flag &= ~V3D_MODE;
                                if(G.f & G_VERTEXPAINT) set_vpaint(); /* Switch off vertex paint */
                                if(G.f & G_TEXTUREPAINT) set_texturepaint(); /* Switch off tex paint */
-                               if(G.obedit) exit_editmode(2);  /* exit editmode and undo */
+                               if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);      /* exit editmode and undo */
                                
                                set_wpaint();
                        }
@@ -4359,7 +4359,7 @@ void do_view3d_buttons(short event)
                        
                        if (ob) {
                                G.vd->flag &= ~V3D_MODE;
-                               if(G.obedit) exit_editmode(2);  /* exit editmode and undo */
+                               if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);      /* exit editmode and undo */
                                        
                                enter_posemode();
                        }
index 03771e3df933516435419ee28abcdf494a5d1ecc..677ae69d4adb801abefd45e9dfb50b2f7b1bb5c7 100644 (file)
@@ -454,8 +454,8 @@ int join_mesh(void)
        
        DAG_scene_sort(G.scene);        // removed objects, need to rebuild dag before editmode call
        
-       enter_editmode();
-       exit_editmode(1);       // freedata, but no undo
+       enter_editmode(EM_WAITCURSOR);
+       exit_editmode(EM_FREEDATA|EM_WAITCURSOR);       // freedata, but no undo
        
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWBUTSSHADING, 0);
index e603ca9c1d8bbbfc61145cbb162f05b288517398..e96f6a557a8371bf435b2e261f40b988a2441f58 100644 (file)
@@ -1056,7 +1056,7 @@ static void tree_element_active_object(SpaceOops *soops, TreeElement *te)
        
        sce= (Scene *)outliner_search_back(soops, te, ID_SCE);
        if(sce && G.scene != sce) {
-               if(G.obedit) exit_editmode(2);
+               if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
                set_scene(sce);
        }
        
@@ -1087,7 +1087,7 @@ static void tree_element_active_object(SpaceOops *soops, TreeElement *te)
                allqueue(REDRAWINFO, 1);
        }
        
-       if(ob!=G.obedit) exit_editmode(2);
+       if(ob!=G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
 }
 
 static int tree_element_active_material(SpaceOops *soops, TreeElement *te, int set)
@@ -1244,7 +1244,7 @@ static int tree_element_active_world(SpaceOops *soops, TreeElement *te, int set)
        
        if(set) {       // make new scene active
                if(sce && G.scene != sce) {
-                       if(G.obedit) exit_editmode(2);
+                       if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
                        set_scene(sce);
                }
        }
@@ -1500,7 +1500,7 @@ static int tree_element_active_pose(TreeElement *te, TreeStoreElem *tselem, int
        Object *ob= (Object *)tselem->id;
        
        if(set) {
-               if(G.obedit) exit_editmode(2);
+               if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
                if(ob->flag & OB_POSEMODE) exit_posemode();
                else enter_posemode();
        }
@@ -1642,14 +1642,14 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even
                                        /* editmode? */
                                        if(te->idcode==ID_SCE) {
                                                if(G.scene!=(Scene *)tselem->id) {
-                                                       if(G.obedit) exit_editmode(2);
+                                                       if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
                                                        set_scene((Scene *)tselem->id);
                                                }
                                        }
                                        else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
-                                               if(G.obedit) exit_editmode(2);
+                                               if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
                                                else {
-                                                       enter_editmode();
+                                                       enter_editmode(EM_WAITCURSOR);
                                                        extern_set_butspace(F9KEY, 0);
                                                }
                                        }
@@ -2015,7 +2015,7 @@ static void object_delete_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem
        if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
        if(base) {
                // check also library later
-               if(G.obedit==base->object) exit_editmode(2);
+               if(G.obedit==base->object) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
                
                if(base==BASACT) {
                        G.f &= ~(G_VERTEXPAINT+G_FACESELECT+G_TEXTUREPAINT+G_WEIGHTPAINT);
index ddbd5e88ea655c1f9a917c9dbfccb7e4ae631c4b..6cc4a986cc124dfc2ae979e1d9ea9bda5f841e9a 100644 (file)
@@ -114,7 +114,7 @@ void enter_posemode(void)
                return;
        }
 
-       if (G.obedit) exit_editmode(1);
+       if (G.obedit) exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
        G.f &= ~(G_VERTEXPAINT | G_FACESELECT | G_TEXTUREPAINT | G_WEIGHTPAINT);
 }
 
index 2b6327df80cca1e61bb089809c567dd597d1a2ec..be204c08c719b56d091a7008f36982d8dfc9430b 100644 (file)
@@ -652,11 +652,11 @@ int blenderqread(unsigned short event, short val)
                                else if(G.vd) {
                                        /* also when Alt-E */
                                        if(G.obedit==NULL) {
-                                               enter_editmode();
+                                               enter_editmode(EM_WAITCURSOR);
                                                if(G.obedit) BIF_undo_push("Original"); // here, because all over code enter_editmode is abused
                                        }
                                        else
-                                               exit_editmode(2); // freedata, and undo
+                                               exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); // freedata, and undo
                                }
                                return 0;
                        }
@@ -676,7 +676,7 @@ int blenderqread(unsigned short event, short val)
                }
                else if(G.qual==LR_SHIFTKEY) {  // ??
                        if(G.obedit)
-                               exit_editmode(2); // freedata, and undo
+                               exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); // freedata, and undo
                        if(G.f & G_FACESELECT)
                                set_faceselect();
                        if(G.f & G_VERTEXPAINT)
@@ -710,11 +710,11 @@ int blenderqread(unsigned short event, short val)
                if(G.qual==LR_ALTKEY) {
                        if(G.vd && textspace==0) {
                                if(G.obedit==0) {
-                                       enter_editmode();
+                                       enter_editmode(EM_WAITCURSOR);
                                        BIF_undo_push("Original");
                                }
                                else
-                                       exit_editmode(2); // freedata, and undo
+                                       exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); // freedata, and undo
                                return 0;
                        }                       
                }
index b23142250e66678340209cc5c1c1bc30b34da789..623668b86cd1b64e2b0e210b7dce53ede55df7da 100644 (file)
@@ -384,7 +384,7 @@ void b_verse_unsubscribe(VNode *vnode)
        if(vnode->type != V_NT_OBJECT) return;
        
        if(G.obedit && G.obedit->vnode == (void*)vnode)
-               exit_editmode(2);
+               exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
 
        /* create mesh data */
        while(vlink){