From 0f84375d7afeccdaeb7a84af16aa46b1a521286f Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 7 Nov 2004 16:49:46 +0000 Subject: Lotsa undo stuff added; - ALT+U undo menu shows history for global undo as well - Added undo pushes for buttons window more consistantly - Added it & tested for ipowindow too - Added it in outliner - And quite some missing occasions for 3d window editing --- source/blender/blenkernel/BKE_blender.h | 11 ++++---- source/blender/blenkernel/intern/blender.c | 35 ++++++++++++++++++++++-- source/blender/src/buttons_editing.c | 11 ++++++-- source/blender/src/buttons_logic.c | 11 ++++++++ source/blender/src/buttons_object.c | 26 ++++++++++++++---- source/blender/src/buttons_scene.c | 10 +++++++ source/blender/src/buttons_script.c | 13 +++++++-- source/blender/src/buttons_shading.c | 16 +++++++++-- source/blender/src/edit.c | 3 ++ source/blender/src/editipo.c | 20 ++++++++++++-- source/blender/src/editmode_undo.c | 2 +- source/blender/src/editobject.c | 8 ++---- source/blender/src/header_buttonswin.c | 1 + source/blender/src/header_info.c | 44 +++++++++++++----------------- source/blender/src/interface.c | 17 +++++++++--- source/blender/src/outliner.c | 11 +++++++- source/blender/src/space.c | 9 +++++- source/blender/src/usiblender.c | 18 ++++++------ 18 files changed, 198 insertions(+), 68 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 51c8e9fd855..b57a361e7e1 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -60,11 +60,12 @@ void free_pushpop(void); void pushpop_test(void); /* global undo */ -void BKE_write_undo(char *name); -void BKE_undo_step(int step); -void BKE_reset_undo(void); -void BKE_undo_menu(void); -void BKE_undo_save_quit(void); +extern void BKE_write_undo(char *name); +extern void BKE_undo_step(int step); +extern void BKE_reset_undo(void); +extern char *BKE_undo_menu_string(void); +extern void BKE_undo_number(int nr); +extern void BKE_undo_save_quit(void); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 0d70d29c100..b4c16bc039a 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -58,6 +58,8 @@ #include "DNA_curve_types.h" #include "BLI_blenlib.h" +#include "BLI_dynstr.h" + #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -543,7 +545,10 @@ void BKE_write_undo(char *name) void BKE_undo_step(int step) { - if(step==1) { + if(step==0) { + read_undosave(curundo); + } + else if(step==1) { /* curundo should never be NULL, after restart or load file it should call undo_save */ if(curundo==NULL || curundo->prev==NULL) error("No undo available"); else { @@ -579,10 +584,36 @@ void BKE_reset_undo(void) curundo= NULL; } +/* based on index nr it does a restore */ +void BKE_undo_number(int nr) +{ + UndoElem *uel; + int a=1; + + for(uel= undobase.first; uel; uel= uel->next, a++) { + if(a==nr) break; + } + curundo= uel; + BKE_undo_step(0); +} -void BKE_undo_menu(void) +char *BKE_undo_menu_string(void) { + UndoElem *uel; + DynStr *ds= BLI_dynstr_new(); + char *menu; + + BLI_dynstr_append(ds, "Global Undo History %t"); + for(uel= undobase.first; uel; uel= uel->next) { + BLI_dynstr_append(ds, "|"); + BLI_dynstr_append(ds, uel->name); + } + + menu= BLI_dynstr_get_cstring(ds); + BLI_dynstr_free(ds); + + return menu; } /* saves quit.blend */ diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 96239d47341..2fd8a190196 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -379,6 +379,7 @@ static void decimate_apply(void) if (mesh_uses_displist(me)) { makeDispList(ob); } + BIF_undo_push("Apply decimation"); } else error("Not a decimated Mesh"); } @@ -439,12 +440,14 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an case B_MATNEW: new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0); scrarea_queue_winredraw(curarea); + BIF_undo_push("New material"); allqueue(REDRAWVIEW3D_Z, 0); allqueue(REDRAWOOPS, 0); break; case B_MATDEL: delete_material_index(); scrarea_queue_winredraw(curarea); + BIF_undo_push("Delete material index"); allqueue(REDRAWVIEW3D_Z, 0); allqueue(REDRAWOOPS, 0); break; @@ -519,6 +522,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an } nu= nu->next; } + BIF_undo_push("Select material index"); allqueue(REDRAWVIEW3D, 0); } } @@ -583,8 +587,6 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an nu= nu->next; } } - if(event == B_SETSMOOTH) BIF_undo_push("Set Smooth"); - else BIF_undo_push("Set Solid"); makeDispList(G.obedit); allqueue(REDRAWVIEW3D, 0); } @@ -612,6 +614,9 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an } allqueue(REDRAWVIEW3D, 0); } + if(event == B_SETSMOOTH) BIF_undo_push("Set Smooth"); + else BIF_undo_push("Set Solid"); + break; default: @@ -831,6 +836,7 @@ static void load_buts_vfont(char *name) text_to_curve(OBACT, 0); makeDispList(OBACT); + BIF_undo_push("Load vector font"); allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWBUTSEDIT, 0); } @@ -903,6 +909,7 @@ void do_fontbuts(unsigned short event) cu->vfont= vf; text_to_curve(ob, 0); makeDispList(ob); + BIF_undo_push("Set vector font"); allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWBUTSEDIT, 0); } diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c index bef16fb6987..3719a5cf225 100644 --- a/source/blender/src/buttons_logic.c +++ b/source/blender/src/buttons_logic.c @@ -124,6 +124,7 @@ static void del_property(void *selpropv, void *data2_unused) a++; prop= prop->next; } + BIF_undo_push("Delete property"); allqueue(REDRAWBUTSLOGIC, 0); } @@ -251,6 +252,7 @@ static void sca_move_sensor(void *datav, void *data2_unused) BLI_remlink(&base->object->sensors, sens); BLI_insertlink(&base->object->sensors, sens->next, sens); } + BIF_undo_push("Move sensor"); allqueue(REDRAWBUTSLOGIC, 0); break; } @@ -289,6 +291,7 @@ static void sca_move_controller(void *datav, void *data2_unused) BLI_remlink(&base->object->controllers, cont); BLI_insertlink(&base->object->controllers, cont->next, cont); } + BIF_undo_push("Move controller"); allqueue(REDRAWBUTSLOGIC, 0); break; } @@ -327,6 +330,7 @@ static void sca_move_actuator(void *datav, void *data2_unused) BLI_remlink(&base->object->actuators, act); BLI_insertlink(&base->object->actuators, act->next, act); } + BIF_undo_push("Move actuator"); allqueue(REDRAWBUTSLOGIC, 0); break; } @@ -379,6 +383,7 @@ void do_logic_buts(unsigned short event) prop= new_property(PROP_FLOAT); make_unique_prop_names(prop->name); BLI_addtail(&ob->prop, prop); + BIF_undo_push("Add property"); allqueue(REDRAWBUTSLOGIC, 0); break; @@ -409,6 +414,7 @@ void do_logic_buts(unsigned short event) base= base->next; } + BIF_undo_push("Add sensor"); allqueue(REDRAWBUTSLOGIC, 0); break; @@ -443,6 +449,7 @@ void do_logic_buts(unsigned short event) } base= base->next; } + BIF_undo_push("Delete sensor"); allqueue(REDRAWBUTSLOGIC, 0); break; @@ -458,6 +465,7 @@ void do_logic_buts(unsigned short event) } base= base->next; } + BIF_undo_push("Add controller"); allqueue(REDRAWBUTSLOGIC, 0); break; @@ -494,6 +502,7 @@ void do_logic_buts(unsigned short event) } base= base->next; } + BIF_undo_push("Delete controller"); allqueue(REDRAWBUTSLOGIC, 0); break; @@ -509,6 +518,7 @@ void do_logic_buts(unsigned short event) } base= base->next; } + BIF_undo_push("Add actuator"); allqueue(REDRAWBUTSLOGIC, 0); break; @@ -544,6 +554,7 @@ void do_logic_buts(unsigned short event) } base= base->next; } + BIF_undo_push("Delete actuator"); allqueue(REDRAWBUTSLOGIC, 0); break; diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 8368937bd66..f3150199b73 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -192,6 +192,7 @@ static void del_constraint_func (void *arg1v, void *arg2v) BLI_freelinkN(lb, con); + BIF_undo_push("Delete constraint"); allqueue(REDRAWBUTSOBJECT, 0); allqueue(REDRAWIPO, 0); @@ -818,6 +819,7 @@ void do_constraintbuts(unsigned short event) add_constraint_to_client(con); test_scene_constraints(); + BIF_undo_push("Add constraint"); allqueue (REDRAWVIEW3D, 0); allqueue (REDRAWBUTSOBJECT, 0); } @@ -830,6 +832,7 @@ void do_constraintbuts(unsigned short event) add_constraint_to_client(con); test_scene_constraints(); + BIF_undo_push("Add constraint"); allqueue (REDRAWVIEW3D, 0); allqueue (REDRAWBUTSOBJECT, 0); } @@ -842,6 +845,7 @@ void do_constraintbuts(unsigned short event) add_constraint_to_client(con); test_scene_constraints(); + BIF_undo_push("Add constraint"); allqueue (REDRAWVIEW3D, 0); allqueue (REDRAWBUTSOBJECT, 0); } @@ -854,6 +858,7 @@ void do_constraintbuts(unsigned short event) add_constraint_to_client(con); test_scene_constraints(); + BIF_undo_push("Add constraint"); allqueue (REDRAWVIEW3D, 0); allqueue (REDRAWBUTSOBJECT, 0); } @@ -866,6 +871,7 @@ void do_constraintbuts(unsigned short event) add_constraint_to_client(con); test_scene_constraints(); + BIF_undo_push("Add constraint"); allqueue (REDRAWVIEW3D, 0); allqueue (REDRAWBUTSOBJECT, 0); } @@ -878,6 +884,7 @@ void do_constraintbuts(unsigned short event) add_constraint_to_client(con); test_scene_constraints(); + BIF_undo_push("Add constraint"); allqueue (REDRAWVIEW3D, 0); allqueue (REDRAWBUTSOBJECT, 0); } @@ -890,6 +897,7 @@ void do_constraintbuts(unsigned short event) add_constraint_to_client(con); test_scene_constraints(); + BIF_undo_push("Add constraint"); allqueue (REDRAWVIEW3D, 0); allqueue (REDRAWBUTSOBJECT, 0); } @@ -913,6 +921,7 @@ void do_constraintbuts(unsigned short event) add_constraint_to_client(con); test_scene_constraints(); + BIF_undo_push("Add constraint"); allqueue(REDRAWVIEW3D,0); allqueue(REDRAWBUTSOBJECT,0); } @@ -950,7 +959,7 @@ static void object_panel_constraint(void) if (conlist) { - uiDefBlockBut(block, add_constraintmenu, NULL, "Add Constraint|>> ", 0, 190, 130, 20, "Add a new constraint"); + uiDefBlockBut(block, add_constraintmenu, NULL, "Add Constraint", 0, 190, 130, 20, "Add a new constraint"); /* print active object or bone */ { @@ -1114,6 +1123,7 @@ void do_object_panels(unsigned short event) MEM_freeN(hook); } freedisplist(&ob->disp); + BIF_undo_push("Delete hook"); allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWBUTSOBJECT, 0); } @@ -1130,6 +1140,8 @@ void do_object_panels(unsigned short event) /* apparently this call goes from right to left... */ Mat4MulSerie(hook->parentinv, hook->parent->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL); + BIF_undo_push("Clear hook"); + allqueue(REDRAWVIEW3D, 0); } } break; @@ -1268,6 +1280,7 @@ void do_effects_panels(unsigned short event) else copy_act_effect(ob); } + BIF_undo_push("New effect"); allqueue(REDRAWBUTSOBJECT, 0); break; case B_DELEFFECT: @@ -1282,6 +1295,7 @@ void do_effects_panels(unsigned short event) } eff= effn; } + BIF_undo_push("Delete effect"); allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWBUTSOBJECT, 0); break; @@ -1469,14 +1483,14 @@ void object_panel_effects(Object *ob) } if(eff) { - uiDefButS(block, MENU, B_CHANGEEFFECT, "Build %x0|Particles %x1|Wave %x2", 895,187,107,27, &eff->buttype, 0, 0, 0, 0, "Start building the effect"); + uiDefButS(block, MENU, B_CHANGEEFFECT, "Build %x0|Particles %x1|Wave %x2", 895,187,107,27, &eff->buttype, 0, 0, 0, 0, "Set effect type"); if(eff->type==EFF_BUILD) { BuildEff *bld; bld= (BuildEff *)eff; - uiDefButF(block, NUM, 0, "Len:", 649,138,95,21, &bld->len, 1.0, 9000.0, 100, 0, "Specify the total time the building requires"); + uiDefButF(block, NUM, 0, "Len:", 649,138,95,21, &bld->len, 1.0, 9000.0, 100, 0, "Specify the total time the build effect requires"); uiDefButF(block, NUM, 0, "Sfra:", 746,138,94,22, &bld->sfra, 1.0, 9000.0, 100, 0, "Specify the startframe of the effect"); } else if(eff->type==EFF_WAVE) { @@ -1484,9 +1498,9 @@ void object_panel_effects(Object *ob) wav= (WaveEff *)eff; uiBlockBeginAlign(block); - uiDefButS(block, TOG|BIT|1, B_CALCEFFECT, "X", 782,135,54,23, &wav->flag, 0, 0, 0, 0, "Enable X axis"); - uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Y", 840,135,47,23, &wav->flag, 0, 0, 0, 0, "Enable Y axis"); - uiDefButS(block, TOG|BIT|3, B_CALCEFFECT, "Cycl", 890,135,111,23, &wav->flag, 0, 0, 0, 0, "Enable cyclic wave efefct"); + uiDefButS(block, TOG|BIT|1, B_CALCEFFECT, "X", 782,135,54,23, &wav->flag, 0, 0, 0, 0, "Enable X axis motion"); + uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Y", 840,135,47,23, &wav->flag, 0, 0, 0, 0, "Enable Y axis motion"); + uiDefButS(block, TOG|BIT|3, B_CALCEFFECT, "Cycl", 890,135,111,23, &wav->flag, 0, 0, 0, 0, "Enable cyclic wave effect"); uiBlockBeginAlign(block); uiDefButF(block, NUM, B_CALCEFFECT, "Sta x:", 550,135,113,24, &wav->startx, -100.0, 100.0, 100, 0, "Starting position for the X axis"); uiDefButF(block, NUM, B_CALCEFFECT, "Sta y:", 665,135,104,24, &wav->starty, -100.0, 100.0, 100, 0, "Starting position for the Y axis"); diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 0ae1a347896..2e5d05a001f 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -140,6 +140,7 @@ static void load_new_sample(char *str) /* called from fileselect */ } } + BIF_undo_push("Load new audio file"); allqueue(REDRAWBUTSSCENE, 0); } @@ -223,6 +224,7 @@ void do_soundbuts(unsigned short event) sound = tempsound; id = &sound->id; G.buts->lockpoin = (bSound*)id; + BIF_undo_push("Copy sound"); do_soundbuts(B_SOUND_REDRAW); } break; @@ -551,6 +553,7 @@ void do_render_panels(unsigned short event) G.scene->r.xparts= G.scene->r.yparts= 1; BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); + BIF_undo_push("Set PAL"); allqueue(REDRAWBUTSSCENE, 0); allqueue(REDRAWVIEWCAM, 0); break; @@ -634,6 +637,7 @@ void do_render_panels(unsigned short event) G.scene->r.xparts= G.scene->r.yparts= 1; BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); + BIF_undo_push("Set FULL"); allqueue(REDRAWBUTSSCENE, 0); allqueue(REDRAWVIEWCAM, 0); break; @@ -674,6 +678,7 @@ void do_render_panels(unsigned short event) G.scene->r.xparts= G.scene->r.yparts= 1; BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); + BIF_undo_push("Set PAL 16/9"); allqueue(REDRAWVIEWCAM, 0); allqueue(REDRAWBUTSSCENE, 0); break; @@ -713,6 +718,7 @@ void do_render_panels(unsigned short event) G.scene->r.xparts= G.scene->r.yparts= 1; BLI_init_rctf(&G.scene->r.safety, 0.0, 1.0, 0.0, 1.0); + BIF_undo_push("Set PC"); allqueue(REDRAWVIEWCAM, 0); allqueue(REDRAWBUTSSCENE, 0); break; @@ -727,6 +733,7 @@ void do_render_panels(unsigned short event) G.scene->r.xparts= G.scene->r.yparts= 1; BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); + BIF_undo_push("Set Default"); allqueue(REDRAWVIEWCAM, 0); allqueue(REDRAWBUTSSCENE, 0); break; @@ -741,6 +748,7 @@ void do_render_panels(unsigned short event) G.scene->r.yparts= 1; BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); + BIF_undo_push("Set Panorama"); allqueue(REDRAWVIEWCAM, 0); allqueue(REDRAWBUTSSCENE, 0); break; @@ -755,6 +763,7 @@ void do_render_panels(unsigned short event) G.scene->r.xparts= G.scene->r.yparts= 1; BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); + BIF_undo_push("Set NTSC"); allqueue(REDRAWBUTSSCENE, 0); allqueue(REDRAWVIEWCAM, 0); break; @@ -775,6 +784,7 @@ void do_render_panels(unsigned short event) break; case B_CLEARSET: scene_change_set(G.scene, NULL); + BIF_undo_push("Clear set"); break; } } diff --git a/source/blender/src/buttons_script.c b/source/blender/src/buttons_script.c index 9cb4d49769c..94013132f78 100644 --- a/source/blender/src/buttons_script.c +++ b/source/blender/src/buttons_script.c @@ -183,8 +183,10 @@ void do_scriptbuts(unsigned short event) switch (event) { case B_SSCRIPT_ADD: extend_scriptlink(&G.scene->scriptlink); + BIF_undo_push("Add scriptlink"); break; case B_SSCRIPT_DEL: + BIF_undo_push("Delete scriptlink"); delete_scriptlink(&G.scene->scriptlink); break; @@ -212,9 +214,14 @@ void do_scriptbuts(unsigned short event) script= &(G.scene->world->scriptlink); } - if (event==B_SCRIPT_ADD) extend_scriptlink(script); - else delete_scriptlink(script); - + if (event==B_SCRIPT_ADD) { + extend_scriptlink(script); + BIF_undo_push("Add scriptlink"); + } + else { + delete_scriptlink(script); + BIF_undo_push("Delete scriptlink"); + } break; default: break; diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 61b9c3eb6fc..29441162e11 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -190,6 +190,7 @@ void load_tex_image(char *str) /* called from fileselect */ ima->ok= 1; } + BIF_undo_push("Load image"); allqueue(REDRAWBUTSSHADING, 0); BIF_all_preview_changed(); @@ -382,7 +383,8 @@ static void do_colorbandbuts(ColorBand *coba, unsigned short event) coba->cur= coba->tot-1; do_colorbandbuts(coba, B_CALCCBAND); - + BIF_undo_push("Add colorband"); + break; case B_DELCOLORBAND: @@ -394,6 +396,7 @@ static void do_colorbandbuts(ColorBand *coba, unsigned short event) if(coba->cur) coba->cur--; coba->tot--; + BIF_undo_push("Delete colorband"); allqueue(REDRAWBUTSSHADING, 0); BIF_all_preview_changed(); break; @@ -507,6 +510,7 @@ void do_texbuts(unsigned short event) case B_DEFTEXVAR: if(tex==0) return; default_tex(tex); + BIF_undo_push("Default texture vars"); allqueue(REDRAWBUTSSHADING, 0); BIF_all_preview_changed(); break; @@ -571,6 +575,7 @@ void do_texbuts(unsigned short event) id_us_plus((ID*) newima); if(id) id->us--; + BIF_undo_push("Browse image"); allqueue(REDRAWBUTSSHADING, 0); BIF_all_preview_changed(); } @@ -1446,11 +1451,13 @@ void do_radiobuts(unsigned short event) switch(event) { case B_RAD_ADD: add_radio(); + BIF_undo_push("Add radiosity"); allqueue(REDRAWBUTSSHADING, 0); allqueue(REDRAWVIEW3D, 0); break; case B_RAD_DELETE: delete_radio(); + BIF_undo_push("Delete radiosity"); allqueue(REDRAWBUTSSHADING, 0); allqueue(REDRAWVIEW3D, 0); break; @@ -1538,10 +1545,12 @@ void do_radiobuts(unsigned short event) break; case B_RAD_ADDMESH: if(phase & RAD_PHASE_FACES) rad_addmesh(); + BIF_undo_push("Radiosity add mesh"); allqueue(REDRAWVIEW3D, 0); break; case B_RAD_REPLACE: if(phase & RAD_PHASE_FACES) rad_replacemesh(); + BIF_undo_push("Radiosity replace mesh"); allqueue(REDRAWVIEW3D, 0); break; } @@ -1653,6 +1662,7 @@ void do_worldbuts(unsigned short event) wrld->mtex[ wrld->texact ]= 0; allqueue(REDRAWBUTSSHADING, 0); allqueue(REDRAWOOPS, 0); + BIF_undo_push("Unlink world texture"); BIF_preview_changed(G.buts); } break; @@ -1973,6 +1983,7 @@ void do_lampbuts(unsigned short event) if(mtex->tex) mtex->tex->id.us--; MEM_freeN(mtex); la->mtex[ la->texact ]= 0; + BIF_undo_push("Unlink world texture"); allqueue(REDRAWBUTSSHADING, 0); allqueue(REDRAWOOPS, 0); BIF_preview_changed(G.buts); @@ -2430,6 +2441,7 @@ void do_matbuts(unsigned short event) if(mtex->tex) mtex->tex->id.us--; MEM_freeN(mtex); ma->mtex[ (int) ma->texact ]= 0; + BIF_undo_push("Unlink material texture"); allqueue(REDRAWBUTSSHADING, 0); allqueue(REDRAWOOPS, 0); BIF_preview_changed(G.buts); @@ -2455,6 +2467,7 @@ void do_matbuts(unsigned short event) memcpy(ma->mtex[(int)ma->texact], &mtexcopybuf, sizeof(MTex)); id_us_plus((ID *)mtexcopybuf.tex); + BIF_undo_push("Paste mapping settings"); BIF_preview_changed(G.buts); scrarea_queue_winredraw(curarea); } @@ -2496,7 +2509,6 @@ void do_matbuts(unsigned short event) } break; - break; } } diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c index b968de4034b..9df39060ee6 100644 --- a/source/blender/src/edit.c +++ b/source/blender/src/edit.c @@ -1190,9 +1190,11 @@ void snapmenu() switch (event) { case 1: /*Selection to grid*/ snap_sel_to_grid(); + BIF_undo_push("Snap selection to grid"); break; case 2: /*Selection to cursor*/ snap_sel_to_curs(); + BIF_undo_push("Snap selection to cursor"); break; case 3: /*Cursor to grid*/ snap_curs_to_grid(); @@ -1202,6 +1204,7 @@ void snapmenu() break; case 5: /*Selection to center of selection*/ snap_to_center(); + BIF_undo_push("Snap selection to center"); break; } } diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index 36e6f6b75cf..f87cd54fe09 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -1400,6 +1400,8 @@ void ipo_toggle_showkey(void) { else G.sipo->showkey= 1; free_ipokey(&G.sipo->ipokey); if(G.sipo->ipo) G.sipo->ipo->showkey= G.sipo->showkey; + + BIF_undo_push("Toggle show key Ipo"); } void swap_selectall_editipo() @@ -1414,8 +1416,6 @@ void swap_selectall_editipo() deselectall_key(); get_status_editipo(); - - if(G.sipo->showkey) { ik= G.sipo->ipokey.first; @@ -1467,6 +1467,7 @@ void swap_selectall_editipo() } + BIF_undo_push("Swap select all Ipo"); scrarea_queue_winredraw(curarea); } @@ -1554,6 +1555,7 @@ void deselectall_editipo() } } + BIF_undo_push("(De)select all Ipo"); scrarea_queue_winredraw(curarea); } @@ -1673,6 +1675,7 @@ void move_to_frame() } } } + BIF_undo_push("Set frame to selected Ipo vertex"); } /* *********************************** */ @@ -1743,11 +1746,12 @@ void do_ipo_selectbuttons() else { ei->flag |= IPO_SELECT; } - + update_editipo_flags(); scrarea_queue_winredraw(curarea); } } + BIF_undo_push("Select Ipo curve"); } /* ******************************************* */ @@ -2059,6 +2063,7 @@ void add_vert_ipo() ei->icu->flag= ei->flag; editipo_changed(G.sipo, 1); + BIF_undo_push("Add Ipo vertex"); } void add_duplicate_editipo() @@ -2339,6 +2344,7 @@ void join_ipo(int mode) } } deselectall_editipo(); + BIF_undo_push("Join Ipo"); } void ipo_snap_menu(void) @@ -2434,6 +2440,7 @@ void ipo_snap(short event) } } editipo_changed(G.sipo, 1); + BIF_undo_push("Snap Ipo"); } @@ -2965,6 +2972,7 @@ void sethandles_ipo(int code) } editipo_changed(G.sipo, 1); + BIF_undo_push("Set handles Ipo"); } @@ -3048,6 +3056,7 @@ void set_ipotype() } } } + BIF_undo_push("Set ipo type"); scrarea_queue_winredraw(curarea); } @@ -3112,6 +3121,7 @@ void borderselect_ipo() } } } + BIF_undo_push("Border select Ipo"); scrarea_queue_winredraw(curarea); } } @@ -3319,6 +3329,7 @@ void paste_editipo() } } editipo_changed(G.sipo, 1); + BIF_undo_push("Paste Ipo curves"); } } @@ -3338,7 +3349,9 @@ void set_exprap_ipo(int mode) } } } + editipo_changed(G.sipo, 1); + BIF_undo_push("Set extrapolation Ipo"); } int find_other_handles(EditIpo *eicur, float ctime, BezTriple **beztar) @@ -3433,6 +3446,7 @@ void set_speed_editipo(float speed) if(didit==0) error("Did not set speed"); editipo_changed(G.sipo, 1); + BIF_undo_push("Set speed IPO"); allqueue(REDRAWNLA, 0); allqueue (REDRAWACTION, 0); allqueue(REDRAWIPO, 0); diff --git a/source/blender/src/editmode_undo.c b/source/blender/src/editmode_undo.c index 4c0150e848b..bea1e53b471 100644 --- a/source/blender/src/editmode_undo.c +++ b/source/blender/src/editmode_undo.c @@ -285,7 +285,7 @@ void undo_editmode_menu(void) undo_clean_stack(); // removes other objects from it - BLI_dynstr_append(ds, "Undo History %t"); + BLI_dynstr_append(ds, "Editmode Undo History %t"); for(uel= undobase.first; uel; uel= uel->next) { BLI_dynstr_append(ds, "|"); diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 2e87e81a7e8..f87e0b6b08b 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -5014,7 +5014,7 @@ void transform(int mode) if(mode=='r') mode= 'R'; if(mode=='s') mode= 'C'; } - /* form duplicate routines */ + /* from duplicate routines */ if(mode=='d') mode= 'g'; /* this can cause floating exception at dec alpha */ @@ -7535,7 +7535,7 @@ void adduplicate(float *dtrans) clear_id_newpoins(); countall(); - if(dtrans==0) transform('g'); + if(dtrans==0) transform('d'); set_active_base(BASACT); @@ -8103,6 +8103,7 @@ void mirror_object(short mode) special_aftertrans_update('m', 1, 0, 0); + BIF_undo_push("Mirror"); allqueue(REDRAWVIEW3D, 0); scrarea_queue_headredraw(curarea); @@ -8129,8 +8130,5 @@ void mirrormenu(void) if (mode==-1) return; /* return */ mirror_edit(mode); /* separating functionality from interface | call*/ - - BIF_undo_push("Mirror"); - } } diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c index 70c3b0717f6..1f53373c31a 100644 --- a/source/blender/src/header_buttonswin.c +++ b/source/blender/src/header_buttonswin.c @@ -189,6 +189,7 @@ void do_buts_buttons(short event) } } BIF_preview_changed(G.buts); + BIF_undo_push("Paste material settings"); scrarea_queue_winredraw(curarea); } break; diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c index aaba982616f..b7ba3bf87d5 100644 --- a/source/blender/src/header_info.c +++ b/source/blender/src/header_info.c @@ -680,25 +680,28 @@ static void do_info_file_importmenu(void *arg, int event) } /* events >=4 are registered bpython scripts */ - if (event >= 4) BPY_menu_do_python(PYMENU_IMPORT, event - 4); - - else switch(event) { + if (event >= 4) { + BPY_menu_do_python(PYMENU_IMPORT, event - 4); + BIF_undo_push("Import file"); + } + else { + switch(event) { - case 0: /* DXF */ - activate_fileselect(FILE_BLENDER, "Import DXF", G.sce, BIF_read_file); - break; - case 1: /* VRML 1.0 */ - activate_fileselect(FILE_BLENDER, "Import VRML 1.0", G.sce, BIF_read_file); - break; - case 2: /* VideoScape */ - activate_fileselect(FILE_BLENDER, "Import VideoScape", G.sce, BIF_read_file); - break; - case 3: /* STL */ - activate_fileselect(FILE_BLENDER, "Import STL", G.sce, BIF_read_file); - break; + case 0: /* DXF */ + activate_fileselect(FILE_BLENDER, "Import DXF", G.sce, BIF_read_file); + break; + case 1: /* VRML 1.0 */ + activate_fileselect(FILE_BLENDER, "Import VRML 1.0", G.sce, BIF_read_file); + break; + case 2: /* VideoScape */ + activate_fileselect(FILE_BLENDER, "Import VideoScape", G.sce, BIF_read_file); + break; + case 3: /* STL */ + activate_fileselect(FILE_BLENDER, "Import STL", G.sce, BIF_read_file); + break; + } } - allqueue(REDRAWINFO, 0); } @@ -851,15 +854,6 @@ static void do_info_filemenu(void *arg, int event) case 6: /* save image */ mainqenter(F3KEY, 1); break; -/* - case 20: - strcpy(dir, G.sce); - activate_fileselect(FILE_SPECIAL, "INSTALL LICENSE KEY", dir, loadKeyboard); - break; - case 21: - SHOW_LICENSE_KEY(); - break; -*/ case 22: /* save runtime */ activate_fileselect(FILE_SPECIAL, "Save Runtime", "", write_runtime_check); break; diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index ede18300a8d..c6397ae2f8b 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -3250,10 +3250,19 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent) if(inside || uevent->event!=LEFTMOUSE) { butevent= ui_do_button(block, but, uevent); - if( !(block->flag & UI_BLOCK_LOOP)) - if(but->type!=BLOCK && but->type!=MENU) - if(!G.obedit) - BIF_undo_push(but->str); + /* add undo pushes if... */ + if( !(block->flag & UI_BLOCK_LOOP)) { + if(!G.obedit) { + if ELEM4(but->type, BLOCK, BUT, LABEL, PULLDOWN); + else { + /* define which string to use for undo */ + if ELEM(but->type, LINK, INLINK) BIF_undo_push("Add button link"); + else if ELEM(but->type, MENU, ICONTEXTROW) BIF_undo_push(but->drawstr); + else if(but->str[0]) BIF_undo_push(but->str); + else BIF_undo_push(but->tip); + } + } + } if(butevent) addqueue(block->winq, UI_BUT_EVENT, (short)butevent); diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c index 4ced1f07b08..1ecaf46bf05 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -781,6 +781,7 @@ void outliner_toggle_visible(struct ScrArea *sa) else outliner_set_flag(soops, &soops->tree, TSE_CLOSED, 1); + BIF_undo_push("Outliner toggle visible"); scrarea_queue_redraw(sa); } @@ -793,6 +794,7 @@ void outliner_toggle_selected(struct ScrArea *sa) else outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 1); + BIF_undo_push("Outliner toggle selected"); scrarea_queue_redraw(sa); } @@ -830,6 +832,7 @@ void outliner_one_level(struct ScrArea *sa, int add) if(level) outliner_openclose_level(soops, &soops->tree, 1, level-1, 0); } + BIF_undo_push("Outliner show/hide one level"); scrarea_queue_redraw(sa); } @@ -1370,6 +1373,7 @@ void outliner_mouse_event(ScrArea *sa, short event) } if(te) { + BIF_undo_push("Outliner click event"); allqueue(REDRAWOOPS, 0); } @@ -1457,6 +1461,8 @@ void outliner_show_hierarchy(struct ScrArea *sa) tree_element_show_hierarchy(so, &so->tree); scrarea_queue_redraw(sa); + + BIF_undo_push("Outliner show hierarchy"); } static void do_outliner_select(SpaceOops *soops, ListBase *lb, float y1, float y2, short *selecting) @@ -1508,7 +1514,8 @@ void outliner_select(struct ScrArea *sa ) y1= y2; } } - + BIF_undo_push("Outliner selection"); + } /* ************ SELECTION OPERATIONS ********* */ @@ -1753,11 +1760,13 @@ void outliner_operation_menu(ScrArea *sa) switch(idlevel) { case ID_MA: outliner_do_libdata_operation(soops, &soops->tree, unlink_material_cb); + BIF_undo_push("Unlink material"); allqueue(REDRAWBUTSSHADING, 1); break; case ID_TE: outliner_do_libdata_operation(soops, &soops->tree, unlink_texture_cb); allqueue(REDRAWBUTSSHADING, 1); + BIF_undo_push("Unlink texture"); break; default: error("Not yet..."); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index b673e3f545d..cb716db99a3 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -705,7 +705,14 @@ void BIF_undo_menu(void) else if(G.f & G_VERTEXPAINT) ; else { - if(U.uiflag & USER_GLOBALUNDO) BKE_undo_menu(); + if(U.uiflag & USER_GLOBALUNDO) { + char *menu= BKE_undo_menu_string(); + if(menu) { + short event= pupmenu_col(menu, 20); + MEM_freeN(menu); + if(event>0) BKE_undo_number(event); + } + } } } } diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index af6b8e1be02..13647fdbd90 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -138,17 +138,19 @@ void BIF_read_file(char *name) calls readfile, calls toolbox, throws one more, on failure calls the stream, and that is stubbed.... */ BKE_read_file(name, NULL); - } - mainwindow_set_filename_to_title(G.main->name); - countall(); - sound_initialize_sounds(); + + mainwindow_set_filename_to_title(G.main->name); + countall(); + sound_initialize_sounds(); - winqueue_break= 1; /* leave queues everywhere */ + winqueue_break= 1; /* leave queues everywhere */ - undo_editmode_clear(); - BKE_reset_undo(); - BKE_write_undo("original"); /* save current state */ + undo_editmode_clear(); + BKE_reset_undo(); + BKE_write_undo("original"); /* save current state */ + } + else BIF_undo_push("Import file"); } int BIF_read_homefile(void) -- cgit v1.2.3