diff options
-rw-r--r-- | source/blender/makesdna/DNA_gpencil_types.h | 6 | ||||
-rw-r--r-- | source/blender/src/drawaction.c | 30 | ||||
-rw-r--r-- | source/blender/src/drawgpencil.c | 43 | ||||
-rw-r--r-- | source/blender/src/editnode.c | 9 | ||||
-rw-r--r-- | source/blender/src/gpencil.c | 12 | ||||
-rw-r--r-- | source/blender/src/interface_draw.c | 1 | ||||
-rw-r--r-- | source/blender/src/space.c | 6 |
7 files changed, 69 insertions, 38 deletions
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 2ac5faab066..55d4e32b744 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -127,12 +127,12 @@ typedef struct bGPdata { } bGPdata; /* bGPdata->flag */ - /* draw this datablock's data (not used) */ -#define GP_DATA_DISP (1<<0) + /* don't allow painting to occur at all */ +#define GP_DATA_LMBPLOCK (1<<0) /* show debugging info in viewport (i.e. status print) */ #define GP_DATA_DISPINFO (1<<1) /* in Action Editor, show as expanded channel */ -#define GP_DATA_EXPAND (1<<2) +#define GP_DATA_EXPAND (1<<2) /* is the block overriding all clicks? */ #define GP_DATA_EDITPAINT (1<<3) /* new strokes are added in viewport space */ diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c index fc629b7c1b0..0782ccfc7ee 100644 --- a/source/blender/src/drawaction.c +++ b/source/blender/src/drawaction.c @@ -646,7 +646,7 @@ static void draw_channel_names(void) case SPACE_VIEW3D: { /* this shouldn't cause any overflow... */ - sprintf(name, "3D-View: <%s>", view3d_get_name(sa->spacedata.first)); + sprintf(name, "3DView: %s", view3d_get_name(sa->spacedata.first)); special= ICON_VIEW3D; } break; @@ -684,8 +684,10 @@ static void draw_channel_names(void) break; default: - sprintf(name, "GP-Data"); + { + sprintf(name, "<Unknown GP-Data Source>"); special= -1; + } break; } } @@ -775,13 +777,19 @@ static void draw_channel_names(void) offset += 17; } - /* draw special icon indicating type of ipo-blocktype? - * only for expand widgets for Ipo and Constraint Channels - */ - if (special > 0) { - offset = (group) ? 29 : 24; - BIF_icon_draw(x+offset, yminc, special); - offset += 17; + /* draw special icon indicating certain data-types */ + if (special > -1) { + if (group == 3) { + /* for gpdatablock channels */ + BIF_icon_draw(x+offset, yminc, special); + offset += 17; + } + else { + /* for ipo/constraint channels */ + offset = (group) ? 29 : 24; + BIF_icon_draw(x+offset, yminc, special); + offset += 17; + } } /* draw name */ @@ -797,13 +805,13 @@ static void draw_channel_names(void) offset = 0; /* draw protect 'lock' */ - if (protect > 0) { + if (protect > -1) { offset = 16; BIF_icon_draw(NAMEWIDTH-offset, yminc, protect); } /* draw mute 'eye' */ - if (mute > 0) { + if (mute > -1) { offset += 16; BIF_icon_draw(NAMEWIDTH-offset, yminc, mute); } diff --git a/source/blender/src/drawgpencil.c b/source/blender/src/drawgpencil.c index 2e1586c369b..aa6d80fe4b9 100644 --- a/source/blender/src/drawgpencil.c +++ b/source/blender/src/drawgpencil.c @@ -94,7 +94,7 @@ void gp_ui_activelayer_cb (void *gpd, void *gpl) { gpencil_layer_setactive(gpd, gpl); - force_draw_plus(SPACE_ACTION, 0); + allqueue(REDRAWACTION, 0); } /* rename layer and set active */ @@ -105,21 +105,21 @@ void gp_ui_renamelayer_cb (void *gpd_arg, void *gpl_arg) BLI_uniquename(&gpd->layers, gpl, "GP_Layer", offsetof(bGPDlayer, info[0]), 128); gpencil_layer_setactive(gpd, gpl); - force_draw_plus(SPACE_ACTION, 0); + allqueue(REDRAWACTION, 0); } /* add a new layer */ void gp_ui_addlayer_cb (void *gpd, void *dummy) { gpencil_layer_addnew(gpd); - force_draw_plus(SPACE_ACTION, 0); + allqueue(REDRAWACTION, 0); } /* delete active layer */ void gp_ui_dellayer_cb (void *gpd, void *dummy) { gpencil_layer_delactive(gpd); - force_draw_plus(SPACE_ACTION, 0); + allqueue(REDRAWACTION, 0); } /* delete last stroke of active layer */ @@ -139,7 +139,7 @@ void gp_ui_delframe_cb (void *gpd, void *gpl) gpencil_layer_setactive(gpd, gpl); gpencil_layer_delframe(gpl, gpf); - force_draw_plus(SPACE_ACTION, 0); + allqueue(REDRAWACTION, 0); } /* ------- Drawing Code ------- */ @@ -148,6 +148,7 @@ void gp_ui_delframe_cb (void *gpd, void *gpl) static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short *xco, short *yco) { uiBut *but; + short active= (gpl->flag & GP_LAYER_ACTIVE); short width= 314; short height; int rb_col; @@ -160,10 +161,10 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short uiBlockSetEmboss(block, UI_EMBOSSN); /* rounded header */ - //uiBlockSetCol(block, TH_BUT_SETTING1); // FIXME: maybe another color - rb_col= (gpl->flag & GP_LAYER_ACTIVE)?50:20; + if (active) uiBlockSetCol(block, TH_BUT_ACTION); + rb_col= (active)?-20:20; uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-8, *yco-2, width, 24, NULL, 5.0, 0.0, 15 , rb_col-20, ""); - //uiBlockSetCol(block, TH_AUTO); + if (active) uiBlockSetCol(block, TH_AUTO); /* lock toggle */ uiDefIconButBitI(block, ICONTOG, GP_LAYER_LOCKED, B_REDR, ICON_UNLOCKED, *xco-7, *yco-1, 20, 20, &gpl->flag, 0.0, 0.0, 0, 0, "Layer cannot be modified"); @@ -212,9 +213,9 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short } /* draw backdrop */ - //uiBlockSetCol(block, TH_BUT_SETTING1); // fixme: maybe another color + if (active) uiBlockSetCol(block, TH_BUT_ACTION); uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-8, *yco-height, width, height-1, NULL, 5.0, 0.0, 12, rb_col, ""); - //uiBlockSetCol(block, TH_AUTO); + if (active) uiBlockSetCol(block, TH_AUTO); /* draw settings */ { @@ -235,11 +236,13 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short uiBlockEndAlign(block); /* options */ - but= uiDefBut(block, BUT, B_REDR, "Del Active Frame", *xco+160, *yco-75, 140, 20, NULL, 0, 0, 0, 0, "Erases the the active frame for this layer"); - uiButSetFunc(but, gp_ui_delframe_cb, gpd, gpl); - - but= uiDefBut(block, BUT, B_REDR, "Del Last Stroke", *xco+160, *yco-95, 140, 20, NULL, 0, 0, 0, 0, "Erases the last stroke from the active frame"); - uiButSetFunc(but, gp_ui_delstroke_cb, gpd, gpl); + uiBlockBeginAlign(block); + but= uiDefBut(block, BUT, B_REDR, "Del Active Frame", *xco+160, *yco-75, 140, 20, NULL, 0, 0, 0, 0, "Erases the the active frame for this layer (Hotkey = Alt-XKEY/DEL)"); + uiButSetFunc(but, gp_ui_delframe_cb, gpd, gpl); + + but= uiDefBut(block, BUT, B_REDR, "Del Last Stroke", *xco+160, *yco-95, 140, 20, NULL, 0, 0, 0, 0, "Erases the last stroke from the active frame (Hotkey = Alt-XKEY/DEL)"); + uiButSetFunc(but, gp_ui_delstroke_cb, gpd, gpl); + uiBlockEndAlign(block); //uiDefButBitI(block, TOG, GP_LAYER_DRAWDEBUG, B_REDR, "Show Points", *xco+160, *yco-75, 130, 20, &gpl->flag, 0, 0, 0, 0, "Show points which form the strokes"); } @@ -268,8 +271,14 @@ short draw_gpencil_panel (uiBlock *block, bGPdata *gpd, ScrArea *sa) uiButSetFunc(but, gp_ui_addlayer_cb, gpd, NULL); - /* show override lmb-clicks button */ - uiDefButBitI(block, TOG, GP_DATA_EDITPAINT, B_REDR, "Draw Mode", 170, 225, 150, 20, &gpd->flag, 0, 0, 0, 0, "Interpret LMB-click as new strokes (same as holding Shift-Key per stroke)"); + /* show override lmb-clicks button + painting lock */ + uiBlockBeginAlign(block); + uiDefButBitI(block, TOG, GP_DATA_EDITPAINT, B_REDR, "Draw Mode", 170, 225, 130, 20, &gpd->flag, 0, 0, 0, 0, "Interpret LMB-click as new strokes (same as holding Shift-Key per stroke)"); + + uiBlockSetCol(block, TH_BUT_SETTING); + uiDefIconButBitI(block, ICONTOG, GP_DATA_LMBPLOCK, B_REDR, ICON_UNLOCKED, 300, 225, 20, 20, &gpd->flag, 0.0, 0.0, 0, 0, "Painting cannot occur with Shift-LMB (when making selections)"); + uiBlockSetCol(block, TH_AUTO); + uiBlockEndAlign(block); /* 'view align' button (naming depends on context) */ if (sa->spacetype == SPACE_VIEW3D) diff --git a/source/blender/src/editnode.c b/source/blender/src/editnode.c index 5c137e67c1a..7cbf08acce6 100644 --- a/source/blender/src/editnode.c +++ b/source/blender/src/editnode.c @@ -2568,8 +2568,13 @@ void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case DELKEY: case XKEY: - if(fromlib) fromlib= -1; - else node_delete(snode); + if(G.qual==LR_ALTKEY) { + gpencil_delete_menu(); + } + else { + if(fromlib) fromlib= -1; + else node_delete(snode); + } break; } } diff --git a/source/blender/src/gpencil.c b/source/blender/src/gpencil.c index d8299fc2a61..2d44824752a 100644 --- a/source/blender/src/gpencil.c +++ b/source/blender/src/gpencil.c @@ -616,7 +616,7 @@ void gpencil_delete_actframe (bGPdata *gpd) * 2 - active frame * 3 - active layer */ -void gpencil_delete_operation (short mode) // unused +void gpencil_delete_operation (short mode) { bGPdata *gpd; @@ -642,11 +642,15 @@ void gpencil_delete_operation (short mode) // unused } /* display a menu for deleting different grease-pencil elements */ -void gpencil_delete_menu (void) // unused +void gpencil_delete_menu (void) { + bGPdata *gpd= gpencil_data_getactive(NULL); short mode; - mode= pupmenu("Erase...%t|Last Stroke%x1|Active Frame%x2|Active Layer%x3"); + /* only show menu if it will be relevant */ + if (gpd == NULL) return; + + mode= pupmenu("Grease Pencil Erase...%t|Last Stroke%x1|Active Frame%x2|Active Layer%x3"); if (mode <= 0) return; gpencil_delete_operation(mode); @@ -1173,7 +1177,7 @@ short gpencil_do_paint (ScrArea *sa) /* try to paint */ retval = gpencil_paint(mousebutton); } - else if (G.qual == LR_SHIFTKEY) { + else if (!(gpd->flag & GP_DATA_LMBPLOCK) && (G.qual == LR_SHIFTKEY)) { /* try to paint */ retval = gpencil_paint(mousebutton); } diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c index 0403e5d5b37..83ae449b989 100644 --- a/source/blender/src/interface_draw.c +++ b/source/blender/src/interface_draw.c @@ -2351,7 +2351,6 @@ static void ui_draw_roundbox(uiBut *but) { glEnable(GL_BLEND); - //BIF_ThemeColorShadeAlpha(TH_PANEL, but->a2, but->a2); BIF_ThemeColorShadeAlpha(but->themecol, but->a2, but->a2); uiSetRoundBox(but->a1); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 92efb477095..cfd5c7b8d56 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -2711,6 +2711,8 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case DELKEY: if(G.qual==0 || G.qual==LR_SHIFTKEY) delete_context_selected(); + if(G.qual==LR_ALTKEY) + gpencil_delete_menu(); break; case YKEY: if((G.qual==0) && (G.obedit)) { @@ -5099,6 +5101,10 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if((G.qual==0)) del_seq(); } + else if(G.qual==LR_ALTKEY) { + if(sseq->mainb) + gpencil_delete_menu(); + } break; case PAD1: case PAD2: case PAD4: case PAD8: seq_viewzoom(event, (G.qual & LR_SHIFTKEY)==0); |