Added undo in UV FaceSelect mode (3d window) and in UV Image window.
authorTon Roosendaal <ton@blender.org>
Sat, 6 Nov 2004 23:22:06 +0000 (23:22 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 6 Nov 2004 23:22:06 +0000 (23:22 +0000)
Brecht; can you give it a good test :)

source/blender/src/editface.c
source/blender/src/editsima.c
source/blender/src/header_image.c
source/blender/src/space.c

index 4ed71a4408f0a0ccd89c503357c6ed0dc4f2fc6e..868257e3c83660312e523bfa99d5c61771a4236e 100644 (file)
@@ -608,6 +608,7 @@ void reveal_tface()
                tface++;
        }
 
+       BIF_undo_push("Reveil UV face");
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWIMAGE, 0);
 }
@@ -644,6 +645,7 @@ void hide_tface()
                
                tface++;
        }
+       BIF_undo_push("Hide UV face");
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWIMAGE, 0);
        
@@ -713,6 +715,7 @@ void select_linked_tfaces()
        }
        MEM_freeN(cpmain);
        
+       BIF_undo_push("Select linked UV face");
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWIMAGE, 0);
 }
@@ -745,6 +748,8 @@ void deselectall_tface()
                }
                tface++;
        }
+
+       BIF_undo_push("(De)select all UV face");
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWIMAGE, 0);
 }
@@ -769,6 +774,7 @@ void selectswap_tface(void)
                tface++;
        }
 
+       BIF_undo_push("Select swap UV face");
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWIMAGE, 0);
 }
@@ -834,6 +840,7 @@ void rotate_uv_tface()
                mface++;
        }
        
+       BIF_undo_push("Rotate UV face");
        makeDispList(OBACT);
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWIMAGE, 0);
@@ -935,6 +942,8 @@ void face_select()
        lasttface = tsel;
        
        /* image window redraw */
+       
+       BIF_undo_push("Select UV face");
        allqueue(REDRAWIMAGE, 0);
        allqueue(REDRAWBUTSEDIT, 0);
        allqueue(REDRAWVIEW3D, 0);
@@ -1090,6 +1099,9 @@ void uv_autocalc_tface()
        case UV_LSCM_MAPPING:
                unwrap_lscm(); break;
        }
+       
+       if(mode>0) BIF_undo_push("UV calculation");
+
 }
 
 void set_faceselect()  /* toggle */
@@ -1118,11 +1130,13 @@ void set_faceselect()   /* toggle */
                        set_lasttface();
                        set_seamtface(); /* set TF_SEAM flags in tface */
                }
+               BIF_undo_push("Set UV Faceselect");
        }
        else if((G.f & (G_WEIGHTPAINT|G_VERTEXPAINT|G_TEXTUREPAINT))==0) {
                if(me) reveal_tface();
                setcursor_space(SPACE_VIEW3D, CURSOR_STD);
                makeDispList(ob);
+               BIF_undo_push("End UV Faceselect");
        }
        countall();
 }
@@ -1538,6 +1552,7 @@ void face_draw()
 
        persp(PERSP_WIN);
 
+       BIF_undo_push("UV face draw");
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWIMAGE, 0);
        allqueue(REDRAWHEADERS, 0);
@@ -1604,6 +1619,7 @@ void get_same_uv(void)
 
        
        /* image window redraw */
+       BIF_undo_push("Get same UV");
        allqueue(REDRAWIMAGE, 0);
        allqueue(REDRAWVIEW3D, 0);
 }
index 6c19fd4d2eb538ef597f805f287880334263d418..c3624852201b1d3e2a6048509c54f33cb89a1894 100644 (file)
@@ -780,6 +780,7 @@ void transform_tface_uv(int mode)
                        tv->loc[1]= tv->oldloc[1];
                }
        }
+
        MEM_freeN(transmain);
        
        if(mode=='g') if(G.sima->flag & SI_BE_SQUARE) be_square_tface_uv(me);
@@ -789,6 +790,10 @@ void transform_tface_uv(int mode)
        
        makeDispList(OBACT);
        allqueue(REDRAWVIEW3D, 0);
+
+       if(event!=ESCKEY && event!=RIGHTMOUSE)
+               BIF_undo_push("Transform UV");
+
        scrarea_queue_headredraw(curarea);
        scrarea_queue_winredraw(curarea);
 }
@@ -857,6 +862,8 @@ void mirrormenu_tface_uv(void)
 
        if(mode==1) mirror_tface_uv('x');
        else if(mode==2) mirror_tface_uv('y');
+
+       BIF_undo_push("Mirror UV");
 }
 
 
@@ -893,6 +900,7 @@ void select_swap_tface_uv(void)
                }
        }
        
+       BIF_undo_push("Select swap UV");
        allqueue(REDRAWIMAGE, 0);
 }
 
@@ -1142,6 +1150,7 @@ void mouse_select_sima(void)
        
        force_draw();
        
+       BIF_undo_push("Select UV");
        std_rmouse_transform(transform_tface_uv);
 }
 
@@ -1192,6 +1201,7 @@ void borderselect_sima(void)
                        }
                                                        
                }
+               BIF_undo_push("Border select UV");
                scrarea_queue_winredraw(curarea);
        }
 }
@@ -1367,6 +1377,7 @@ void hide_tface_uv(int swap)
                        }
                }
        }
+       BIF_undo_push("Hide UV");
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWIMAGE, 0);
 }
@@ -1387,6 +1398,7 @@ void reveal_tface_uv(void)
                        if(!(tface->flag & TF_SELECT))
                                tface->flag |= (TF_SELECT|TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
        
+       BIF_undo_push("Reveil UV");
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWIMAGE, 0);
 }
@@ -1526,6 +1538,7 @@ void stitch_uv_tface(int mode)
        if(G.sima->flag & SI_BE_SQUARE) be_square_tface_uv(me);
        if(G.sima->flag & SI_CLIP_UV) tface_do_clip();
 
+       BIF_undo_push("Stitch UV");
        allqueue(REDRAWVIEW3D, 0);
        scrarea_queue_winredraw(curarea);
 }
@@ -1632,6 +1645,7 @@ void select_linked_tface_uv(void)
        }
        MEM_freeN(sortblock);
 
+       BIF_undo_push("Select linked UV");
        scrarea_queue_winredraw(curarea);
 }
 
@@ -1658,6 +1672,7 @@ void unlink_selection(void)
                }
        }
        
+       BIF_undo_push("Unlink UV selection");
        scrarea_queue_winredraw(curarea);
 }
 
@@ -1713,6 +1728,8 @@ void pin_tface_uv(int mode)
                        }
                }
        }
+       
+       BIF_undo_push("Pin UV");
        scrarea_queue_winredraw(curarea);
 }
 
index aa4c2eef845b9b456ddf167dbc221b5626e7a6eb..01d0a532c6da76111b2226b8b627a042b35d582a 100644 (file)
@@ -112,7 +112,7 @@ void load_space_image(char *str)    /* called from fileselect */
                image_changed(G.sima, 0);
 
        }
-
+       BIF_undo_push("Load image UV");
        allqueue(REDRAWIMAGE, 0);
 }
 
@@ -175,6 +175,7 @@ void replace_space_image(char *str)         /* called from fileselect */
                image_changed(G.sima, 0);
 
        }
+       BIF_undo_push("Replace image UV");
        allqueue(REDRAWIMAGE, 0);
 }
 
@@ -252,6 +253,7 @@ void do_image_buttons(unsigned short event)
                }
                /* also when image is the same: assign! 0==no tileflag: */
                image_changed(G.sima, 0);
+               BIF_undo_push("Assign image UV");
 
                break;
        case B_SIMAGELOAD:
@@ -627,6 +629,7 @@ static void do_image_imagemenu(void *arg, int event)
                                }
                        }
                }
+               BIF_undo_push("Pack image");
                allqueue(REDRAWBUTSSHADING, 0);
                allqueue(REDRAWHEADERS, 0);
                break;
@@ -647,6 +650,7 @@ static void do_image_imagemenu(void *arg, int event)
                                error("There are no packed images to unpack");
                        }
                }
+               BIF_undo_push("Unpack image");
                allqueue(REDRAWBUTSSHADING, 0);
                allqueue(REDRAWHEADERS, 0);
                break;
index f014942aca86ec9515d179b0f5e475b86d21d6be..b673e3f545d3d7ee1b043ce4edc3315ff235564a 100644 (file)
@@ -653,13 +653,12 @@ void BIF_undo(void)
                        
        }
        else {
-               if (G.f & G_FACESELECT)
-                       ;
-               else if(G.f & G_WEIGHTPAINT)
+               if(G.f & G_WEIGHTPAINT)
                        wpaint_undo();
                else if(G.f & G_VERTEXPAINT)
                        vpaint_undo();
                else {
+                       /* now also in faceselect mode */
                        if(U.uiflag & USER_GLOBALUNDO) BKE_undo_step(1);
                }
        }
@@ -677,13 +676,12 @@ void BIF_redo(void)
        
        }
        else {
-               if (G.f & G_FACESELECT)
-                       ;
-               else if(G.f & G_WEIGHTPAINT)
+               if(G.f & G_WEIGHTPAINT)
                        wpaint_undo();
                else if(G.f & G_VERTEXPAINT)
                        vpaint_undo();
                else {
+                       /* includes faceselect now */
                        if(U.uiflag & USER_GLOBALUNDO) BKE_undo_step(-1);
                }
        }
@@ -702,9 +700,7 @@ void BIF_undo_menu(void)
                allqueue(REDRAWALL, 0);
        }
        else {
-               if (G.f & G_FACESELECT)
-                       ;
-               else if(G.f & G_WEIGHTPAINT)
+               if(G.f & G_WEIGHTPAINT)
                        ;
                else if(G.f & G_VERTEXPAINT)
                        ;