Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2008-07-24 13:23:13 +0400
committerJoshua Leung <aligorith@gmail.com>2008-07-24 13:23:13 +0400
commitf9dc77c1c89e2970b2b1f95186dcb58541dfb7f9 (patch)
tree4b2ff7bc226b93947fa4decbb20d850690c6f556 /source/blender/src
parent955ffb4abf74b3b590b32e31515af5e80bf6bc42 (diff)
== 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.
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/drawaction.c30
-rw-r--r--source/blender/src/drawgpencil.c43
-rw-r--r--source/blender/src/editnode.c9
-rw-r--r--source/blender/src/gpencil.c12
-rw-r--r--source/blender/src/interface_draw.c1
-rw-r--r--source/blender/src/space.c6
6 files changed, 66 insertions, 35 deletions
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);