Small edit so undo+redraw is only done when removeDoubles actually does somthing.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 29 Jan 2006 08:01:04 +0000 (08:01 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 29 Jan 2006 08:01:04 +0000 (08:01 +0000)
Would anyone have a problem with me going through and making functions like triangulate, flip normals tri2quad etc all return how many changes made? - then undo+redraw can be done only when needed.

source/blender/src/buttons_editing.c

index e3fbb98476123a3900b5fec930401d5b45dfe213..04f11bc6318cca7479959a76f42369bbc8e49e3d 100644 (file)
@@ -3058,7 +3058,7 @@ void do_meshbuts(unsigned short event)
        Mesh *me;
        float fac;
        short randfac;
-
+       int count; /* store num of changes made to see if redraw & undo are needed*/
        ob= OBACT;
        if(ob && ob->type==OB_MESH) {
 
@@ -3183,10 +3183,13 @@ void do_meshbuts(unsigned short event)
                G.f -= G_DISABLE_OK;
                break;
        case B_REMDOUB:
-               notice("Removed: %d", removedoublesflag(1, G.scene->toolsettings->doublimit));
-               DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-               allqueue(REDRAWVIEW3D, 0);
-               BIF_undo_push("Rem Doubles");
+               count= removedoublesflag(1, G.scene->toolsettings->doublimit);
+               notice("Removed: %d", count);
+               if (count) { /* only undo and redraw if an action is taken */
+                       DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
+                       allqueue(REDRAWVIEW3D, 0);
+                       BIF_undo_push("Rem Doubles");
+               }
                break;
        case B_SUBDIV:
                waitcursor(1);