== Grease Pencil - More Tweaks (I) ==
New Stuff: * Alt-XKEY / Alt-DelKey will now activate the Grease Pencil "Erase" menu. This will only show up when it's relevant (i.e. when there exists Grease Pencil data). It should make it faster to quickly delete the last stroke made. This hotkey has been added to the tooltips of the relevant buttons. * Finished off colouring of 'active' layers panel so that they are now easily identify-able. This could also be done for Constraints, but the 'active' one isn't that important there. Bugfixes: * Fixed bug with drawing gp-data sources in the Action Editor, which resulted in missing icons. * Fixed buttons in Grease Pencil panel. My hasty attempt last night at making the Action Editor to refresh was causing problems. * Added a (hopefully temporary) button that will be used to prevent drawing from occurring with Shift-LMB. This is useful when trying to select stuff sometimes, with LMB as select-button, especially when selecting a bunch of closely spaced bones might be interpreted as a new stroke.
This commit is contained in:
parent
955ffb4abf
commit
f9dc77c1c8
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user