diff options
-rw-r--r-- | source/blender/src/editmode_undo.c | 25 | ||||
-rw-r--r-- | source/blender/src/header_view3d.c | 12 | ||||
-rw-r--r-- | source/blender/src/interface.c | 28 | ||||
-rw-r--r-- | source/blender/src/toolbox.c | 2 |
4 files changed, 43 insertions, 24 deletions
diff --git a/source/blender/src/editmode_undo.c b/source/blender/src/editmode_undo.c index bea1e53b471..1c5aca9ff8f 100644 --- a/source/blender/src/editmode_undo.c +++ b/source/blender/src/editmode_undo.c @@ -182,7 +182,7 @@ void undo_editmode_push(char *name, void (*freedata)(void *), static void undo_clean_stack(void) { UndoElem *uel, *next; - int mixed= 0, checknames= 1; + int mixed= 0; /* global undo changes pointers, so we also allow identical names */ /* side effect: when deleting/renaming object and start editing new one with same name */ @@ -190,19 +190,18 @@ static void undo_clean_stack(void) uel= undobase.first; while(uel) { next= uel->next; - if(uel->ob != G.obedit) { - - /* for when global undo changes pointers... */ - if(checknames && strcmp(uel->id.name, G.obedit->id.name)==0) { - uel->ob= G.obedit; - } - else { - mixed= 1; - BLI_remlink(&undobase, uel); - uel->freedata(uel->undodata); - MEM_freeN(uel); - } + + /* for when global undo changes pointers... */ + if(strcmp(uel->id.name, G.obedit->id.name)==0) { + uel->ob= G.obedit; + } + else { + mixed= 1; + BLI_remlink(&undobase, uel); + uel->freedata(uel->undodata); + MEM_freeN(uel); } + uel= next; } diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index f1ac9781230..6257a4fa52b 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -1843,6 +1843,9 @@ void do_view3d_edit_mesh_verticesmenu(void *arg, int event) case 5: /*merge */ mergemenu(); break; + case 6: /* add hook */ + add_hook(); + break; } allqueue(REDRAWVIEW3D, 0); } @@ -1866,7 +1869,8 @@ static uiBlock *view3d_edit_mesh_verticesmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Vertex Parent|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Vertex Parent|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Hook|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); @@ -2308,7 +2312,10 @@ static void do_view3d_edit_curve_controlpointsmenu(void *arg, int event) case 5: /* make vertex parent */ make_parent(); break; - } + case 6: /* add hook */ + add_hook(); + break; + } allqueue(REDRAWVIEW3D, 0); } @@ -2332,6 +2339,7 @@ static uiBlock *view3d_edit_curve_controlpointsmenu(void *arg_unused) } uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Vertex Parent|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Hook|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 8a0f1ea235b..aed87eec60d 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -420,7 +420,8 @@ void ui_block_set_flush(uiBlock *block, uiBut *but) /* ******************* copy and paste ******************** */ /* c = copy, v = paste */ -static void ui_but_copy_paste(uiBut *but, char mode) +/* return 1 when something changed */ +static int ui_but_copy_paste(uiBut *but, char mode) { static char str[256]=""; static double butval=0.0; @@ -433,6 +434,7 @@ static void ui_but_copy_paste(uiBut *but, char mode) else { ui_set_but_val(but, butval); ui_check_but(but); + return 1; } } else if(but->type==TEX) { @@ -444,6 +446,7 @@ static void ui_but_copy_paste(uiBut *but, char mode) strncpy(but->poin, str, but->max); uibut_do_func(but); ui_check_but(but); + return 1; } } else if(but->type==IDPOIN) { @@ -455,9 +458,10 @@ static void ui_but_copy_paste(uiBut *but, char mode) else { but->idpoin_func(str, but->idpoin_idpp); ui_check_but(but); + return 1; } } - + return 0; } /* ******************* block calc ************************* */ @@ -1243,6 +1247,7 @@ static int ui_do_but_KEYEVT(uiBut *but) ui_set_but_val(but, -1); ui_check_but(but); ui_draw_but(but); + ui_block_flush_back(but->block); do { event= extern_qread(&val); @@ -3226,17 +3231,22 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent) for(but= block->buttons.first; but; but= but->next) { if(but->type!=LABEL) { if(but->flag & UI_ACTIVE) { - if(uevent->event==VKEY) ui_but_copy_paste(but, 'v'); - else ui_but_copy_paste(but, 'c'); - - ui_draw_but(but); + int doit=0; - if(but->retval) addqueue(block->winq, UI_BUT_EVENT, (short)but->retval); - BIF_undo_push(but->str); + if(uevent->event==VKEY) doit= ui_but_copy_paste(but, 'v'); + else ui_but_copy_paste(but, 'c'); + if(doit) { + ui_draw_but(but); + + if(but->retval) addqueue(block->winq, UI_BUT_EVENT, (short)but->retval); + if(but->type==NUMSLI && but->a1) addqueue(block->winq, REDRAW, 1); // col button update + + BIF_undo_push(but->str); + } + // but we do return, to prevent passing event through other queues */ if( (block->flag & UI_BLOCK_LOOP) && but->type==BLOCK); else if(but->retval) retval= UI_RETURN_OK; - break; } } diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index a36806eae6d..7e34acff2b8 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -1682,6 +1682,7 @@ static TBitem tb_curve_edit_cv[]= { { 0, "Vector|V", TB_ALT|'t', NULL}, { 0, "SEPR", 0, NULL}, { 0, "Make Vertex Parent|Ctrl P", TB_CTRL|'p', NULL}, +{ 0, "Add Hook|Ctrl H", TB_CTRL|'h', NULL}, { -1, "", 0, tb_do_hotkey}}; @@ -1708,6 +1709,7 @@ static TBitem tb_mesh_edit_vertex[]= { { 0, "Remove Doubles|W, 5", 1, NULL}, { 0, "SEPR", 0, NULL}, { 0, "Make Vertex Parent|Ctrl P", 0, NULL}, +{ 0, "Add Hook|Ctrl H", 6, NULL}, { -1, "", 0, do_view3d_edit_mesh_verticesmenu}}; static TBitem tb_mesh_edit_edge[]= { |