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-23 16:27:08 +0400
committerJoshua Leung <aligorith@gmail.com>2008-07-23 16:27:08 +0400
commit8a1dbea3638fb94c57d457c1aa3867d454afb5ef (patch)
treedd918fb1286f58356f52354fcf86dc9e725cb1ab /source/blender/src
parentab722cf7b1aa596867cbbcbc0940aec37dfc22bb (diff)
== Grease Pencil - UI Improvements ==
Based on user feedback, I've made some changes to the Grease Pencil UI (most notably in 'Time Editing' facilities). * 'Edit Timing' button gone * Pin button and '<Grease Pencil Data' string gone from Action Editor * Action Editor in 'Grease Pencil' mode now displays all grease-pencil datablocks for current screen. * AE: GP-Datablocks are drawn like 'groups', with an expand/collapse button to show/hide layers. Its name shows the type of space it comes from, and shows indicative status info (i.e. for 3d-view, it shows view-angle) * Added refresh calls for action editor after editing relevant data. I haven't tested all tools yet, but most should be stable. Also, I've removed some unnecessary buttons, and added a few tooltips. There's also some experimental code to try to get clearer indication of 'active' layer.
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/drawaction.c91
-rw-r--r--source/blender/src/drawgpencil.c74
-rw-r--r--source/blender/src/drawnode.c2
-rw-r--r--source/blender/src/drawseq.c2
-rw-r--r--source/blender/src/drawview.c42
-rw-r--r--source/blender/src/editaction.c95
-rw-r--r--source/blender/src/editaction_gpencil.c7
-rw-r--r--source/blender/src/gpencil.c107
-rw-r--r--source/blender/src/header_action.c21
-rw-r--r--source/blender/src/interface.c2
-rw-r--r--source/blender/src/interface_draw.c3
11 files changed, 212 insertions, 234 deletions
diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c
index 9b1af3f1a06..fc629b7c1b0 100644
--- a/source/blender/src/drawaction.c
+++ b/source/blender/src/drawaction.c
@@ -89,6 +89,7 @@
#include "BSE_drawnla.h"
#include "BSE_drawipo.h"
+#include "BSE_drawview.h"
#include "BSE_editaction_types.h"
#include "BSE_editipo.h"
#include "BSE_time.h"
@@ -467,7 +468,7 @@ static void draw_channel_names(void)
bActionGroup *grp = NULL;
short indent= 0, offset= 0, sel= 0, group=0;
int expand= -1, protect = -1, special= -1, mute = -1;
- char name[32];
+ char name[64];
/* determine what needs to be drawn */
switch (ale->type) {
@@ -625,6 +626,70 @@ static void draw_channel_names(void)
sprintf(name, "Constraint");
}
break;
+ case ACTTYPE_GPDATABLOCK: /* gpencil datablock */
+ {
+ bGPdata *gpd = (bGPdata *)ale->data;
+ ScrArea *sa = (ScrArea *)ale->owner;
+
+ indent = 0;
+ group= 3;
+
+ /* only show expand if there are any channels */
+ if (gpd->layers.first) {
+ if (gpd->flag & GP_DATA_EXPAND)
+ expand = ICON_TRIA_DOWN;
+ else
+ expand = ICON_TRIA_RIGHT;
+ }
+
+ switch (sa->spacetype) {
+ case SPACE_VIEW3D:
+ {
+ /* this shouldn't cause any overflow... */
+ sprintf(name, "3D-View: <%s>", view3d_get_name(sa->spacedata.first));
+ special= ICON_VIEW3D;
+ }
+ break;
+ case SPACE_NODE:
+ {
+ SpaceNode *snode= sa->spacedata.first;
+ char treetype[12];
+
+ if (snode->treetype == 1)
+ sprintf(treetype, "Composite");
+ else
+ sprintf(treetype, "Material");
+ sprintf(name, "Nodes: %s", treetype);
+
+ special= ICON_NODE;
+ }
+ break;
+ case SPACE_SEQ:
+ {
+ SpaceSeq *sseq= sa->spacedata.first;
+ char imgpreview[10];
+
+ switch (sseq->mainb) {
+ case 1: sprintf(imgpreview, "Image..."); break;
+ case 2: sprintf(imgpreview, "Luma..."); break;
+ case 3: sprintf(imgpreview, "Chroma..."); break;
+ case 4: sprintf(imgpreview, "Histogram"); break;
+
+ default: sprintf(imgpreview, "Sequence"); break;
+ }
+ sprintf(name, "Sequencer: %s", imgpreview);
+
+ special= ICON_SEQUENCE;
+ }
+ break;
+
+ default:
+ sprintf(name, "GP-Data");
+ special= -1;
+ break;
+ }
+ }
+ break;
case ACTTYPE_GPLAYER: /* gpencil layer */
{
bGPDlayer *gpl = (bGPDlayer *)ale->data;
@@ -632,7 +697,8 @@ static void draw_channel_names(void)
indent = 0;
special = -1;
expand = -1;
-
+ group = 1;
+
if (EDITABLE_GPL(gpl))
protect = ICON_UNLOCKED;
else
@@ -651,8 +717,19 @@ static void draw_channel_names(void)
/* now, start drawing based on this information */
/* draw backing strip behind channel name */
- if (group == 2) {
- /* only for group-channels */
+ if (group == 3) {
+ /* only for gp-data channels */
+ if (ale->owner == curarea) // fixme... currently useless
+ BIF_ThemeColorShade(TH_GROUP_ACTIVE, 10);
+ else
+ BIF_ThemeColorShade(TH_GROUP, 20);
+ uiSetRoundBox((expand == ICON_TRIA_DOWN)? (1):(1|8));
+ gl_round_box(GL_POLYGON, x, yminc, (float)NAMEWIDTH, ymaxc, 8);
+
+ offset = 0;
+ }
+ else if (group == 2) {
+ /* only for action group channels */
if (ale->flag & AGRP_ACTIVE)
BIF_ThemeColorShade(TH_GROUP_ACTIVE, 10);
else
@@ -1148,12 +1225,6 @@ void drawactionspace(ScrArea *sa, void *spacedata)
G.saction->action= NULL;
}
break;
- case SACTCONT_GPENCIL:
- {
- /* this searching could be slow (so users should pin after this is found) */
- G.saction->gpd= gpencil_data_getetime(G.curscreen);
- }
- break;
}
}
diff --git a/source/blender/src/drawgpencil.c b/source/blender/src/drawgpencil.c
index 55d0464b9af..2e1586c369b 100644
--- a/source/blender/src/drawgpencil.c
+++ b/source/blender/src/drawgpencil.c
@@ -94,6 +94,7 @@
void gp_ui_activelayer_cb (void *gpd, void *gpl)
{
gpencil_layer_setactive(gpd, gpl);
+ force_draw_plus(SPACE_ACTION, 0);
}
/* rename layer and set active */
@@ -104,18 +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);
}
/* add a new layer */
void gp_ui_addlayer_cb (void *gpd, void *dummy)
{
gpencil_layer_addnew(gpd);
+ force_draw_plus(SPACE_ACTION, 0);
}
/* delete active layer */
void gp_ui_dellayer_cb (void *gpd, void *dummy)
{
gpencil_layer_delactive(gpd);
+ force_draw_plus(SPACE_ACTION, 0);
}
/* delete last stroke of active layer */
@@ -134,22 +138,10 @@ void gp_ui_delframe_cb (void *gpd, void *gpl)
gpencil_layer_setactive(gpd, gpl);
gpencil_layer_delframe(gpl, gpf);
-}
-
-
-/* set this set of gpencil data for editing in action editor */
-void gp_ui_dotime_cb (void *gpd_arg, void *dummy)
-{
- bGPdata *gpd= (bGPdata *)gpd_arg;
- /* check if setting or clearing (note: setting was just set...) */
- if (gpd->flag & GP_DATA_EDITTIME)
- gpencil_data_setetime(G.curscreen, gpd);
- else
- gpencil_data_setetime(G.curscreen, NULL);
+ force_draw_plus(SPACE_ACTION, 0);
}
-
/* ------- Drawing Code ------- */
/* draw the controls for a given layer */
@@ -168,35 +160,31 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short
uiBlockSetEmboss(block, UI_EMBOSSN);
/* rounded header */
- rb_col= (gpl->flag & GP_LAYER_ACTIVE)?50:20;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-8, *yco-2, width, 24, NULL, 5.0, 0.0, 15 , rb_col-20, "");
+ //uiBlockSetCol(block, TH_BUT_SETTING1); // FIXME: maybe another color
+ rb_col= (gpl->flag & GP_LAYER_ACTIVE)?50: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);
/* 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");
}
- /* when layer is locked or hidden, don't draw the rest of its settings */
+ /* when layer is locked or hidden, only draw header */
if (gpl->flag & (GP_LAYER_LOCKED|GP_LAYER_HIDE)) {
- height= 26;
+ char name[256]; /* gpl->info is 128, but we need space for 'locked/hidden' as well */
- /* draw rest of header */
- {
- /* visibility button (only if hidden but not locked!) */
- if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED))
- uiDefIconButBitI(block, ICONTOG, GP_LAYER_HIDE, B_REDR, ICON_RESTRICT_VIEW_OFF, *xco+12, *yco-1, 20, 20, &gpl->flag, 0.0, 0.0, 0, 0, "Visibility of layer");
-
- /* name */
- uiDefBut(block, LABEL, 1, gpl->info, *xco+35, *yco, 240, 20, NULL, 0.0, 0.0, 0, 0, "Short description of what this layer is for (optional)");
- }
+ height= 26;
- /* draw backdrop */
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-8, *yco-height, width, height-1, NULL, 5.0, 0.0, 12, rb_col, "");
+ /* visibility button (only if hidden but not locked!) */
+ if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED))
+ uiDefIconButBitI(block, ICONTOG, GP_LAYER_HIDE, B_REDR, ICON_RESTRICT_VIEW_OFF, *xco+12, *yco-1, 20, 20, &gpl->flag, 0.0, 0.0, 0, 0, "Visibility of layer");
- /* draw settings... (i.e. just warning for this one) */
+ /* name */
if (gpl->flag & GP_LAYER_HIDE)
- uiDefBut(block, LABEL, 1, "Grease Pencil Layer Hidden", *xco+60, *yco-26, 205, 20, NULL, 0.0, 0.0, 0, 0, "");
+ sprintf(name, "%s (Hidden)", gpl->info);
else
- uiDefBut(block, LABEL, 1, "Grease Pencil Layer Locked", *xco+60, *yco-26, 205, 20, NULL, 0.0, 0.0, 0, 0, "");
+ sprintf(name, "%s (Locked)", gpl->info);
+ uiDefBut(block, LABEL, 1, name, *xco+35, *yco, 240, 20, NULL, 0.0, 0.0, 0, 0, "Short description of what this layer is for (optional)");
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -211,7 +199,7 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short
uiBlockSetEmboss(block, UI_EMBOSS);
/* name */
- but= uiDefButC(block, TEX, B_REDR, "Info:", *xco+35, *yco, 240, 20, gpl->info, 0, 127, 0, 0, "Short description of what this layer is for (optional)");
+ but= uiDefButC(block, TEX, B_REDR, "Info:", *xco+36, *yco, 240, 19, gpl->info, 0, 127, 0, 0, "Short description of what this layer is for (optional)");
uiButSetFunc(but, gp_ui_renamelayer_cb, gpd, gpl);
/* delete 'button' */
@@ -224,7 +212,9 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short
}
/* draw backdrop */
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-8, *yco-height, width, height-1, NULL, 5.0, 0.0, 12, rb_col, "");
+ //uiBlockSetCol(block, TH_BUT_SETTING1); // fixme: maybe another color
+ uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-8, *yco-height, width, height-1, NULL, 5.0, 0.0, 12, rb_col, "");
+ //uiBlockSetCol(block, TH_AUTO);
/* draw settings */
{
@@ -241,7 +231,7 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short
/* onion-skinning */
uiBlockBeginAlign(block);
uiDefButBitI(block, TOG, GP_LAYER_ONIONSKIN, B_REDR, "Onion-Skin", *xco+160, *yco-26, 140, 20, &gpl->flag, 0, 0, 0, 0, "Ghost frames on either side of frame");
- uiDefButS(block, NUMSLI, B_REDR, "GStep:", *xco+160, *yco-46, 140, 20, &gpl->gstep, 0, 120, 0, 0, "Maximum frame range on either side of active frame to show (0 = just 'first' available frame on either side)");
+ uiDefButS(block, NUMSLI, B_REDR, "GStep:", *xco+160, *yco-46, 140, 20, &gpl->gstep, 0, 120, 0, 0, "Max number of frames on either side of active frame to show (0 = just 'first' available sketch on either side)");
uiBlockEndAlign(block);
/* options */
@@ -262,21 +252,19 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short
/* Draw the contents for a grease-pencil panel. This assumes several things:
* - that panel has been created, is 318 x 204. max yco is 225
* - that a toggle for turning on/off gpencil drawing is 150 x 20, starting from (10,225)
+ * which is basically the top left-hand corner
* It will return the amount of extra space to extend the panel by
*/
short draw_gpencil_panel (uiBlock *block, bGPdata *gpd, ScrArea *sa)
{
uiBut *but;
bGPDlayer *gpl;
- short xco= 10, yco= 155;
+ short xco= 10, yco= 170;
/* draw gpd settings first */
{
- /* show status info button */
- uiDefButBitI(block, TOG, GP_DATA_DISPINFO, B_REDR, "Show Status Info", 10, 205, 150, 20, &gpd->flag, 0, 0, 0, 0, "Display status info about current status of Grease Pencil");
-
- /* add new/duplicate layer buttons */
- but= uiDefBut(block, BUT, B_REDR, "Add New Layer", 10,182,150,20, 0, 0, 0, 0, 0, "Adds a new Grease Pencil Layer");
+ /* add new layer buttons */
+ but= uiDefBut(block, BUT, B_REDR, "Add New Layer", 10,205,150,20, 0, 0, 0, 0, 0, "Adds a new Grease Pencil Layer");
uiButSetFunc(but, gp_ui_addlayer_cb, gpd, NULL);
@@ -285,13 +273,9 @@ short draw_gpencil_panel (uiBlock *block, bGPdata *gpd, ScrArea *sa)
/* 'view align' button (naming depends on context) */
if (sa->spacetype == SPACE_VIEW3D)
- uiDefButBitI(block, TOG, GP_DATA_VIEWALIGN, B_REDR, "Draw in 3D", 170, 205, 150, 20, &gpd->flag, 0, 0, 0, 0, "New strokes are added in 3D-space");
+ uiDefButBitI(block, TOG, GP_DATA_VIEWALIGN, B_REDR, "Sketch in 3D", 170, 205, 150, 20, &gpd->flag, 0, 0, 0, 0, "New strokes are added in 3D-space");
else if (sa->spacetype != SPACE_SEQ) /* not available for sequencer yet */
uiDefButBitI(block, TOG, GP_DATA_VIEWALIGN, B_REDR, "Stick to View", 170, 205, 150, 20, &gpd->flag, 0, 0, 0, 0, "New strokes are added on 2d-canvas");
-
- /* show edit-in-action button */
- but= uiDefButBitI(block, TOG, GP_DATA_EDITTIME, B_REDR, "Edit Timing", 170, 182, 150, 20, &gpd->flag, 0, 0, 0, 0, "Edit timing of frames for the Grease Pencil block");
- uiButSetFunc(but, gp_ui_dotime_cb, gpd, NULL);
}
/* draw for each layer */
diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c
index 3a73ee84ead..853df3bedfc 100644
--- a/source/blender/src/drawnode.c
+++ b/source/blender/src/drawnode.c
@@ -3336,7 +3336,7 @@ static void nodes_panel_gpencil(short cntrl) // NODES_HANDLER_GREASEPENCIL
uiNewPanelHeight(block, 204);
/* draw button for showing gpencil settings and drawings */
- uiDefButBitS(block, TOG, SNODE_DISPGP, B_REDR, "Use Grease Pencil", 10, 225, 150, 20, &snode->flag, 0, 0, 0, 0, "Display freehand annotations overlay over this Node Editor");
+ uiDefButBitS(block, TOG, SNODE_DISPGP, B_REDR, "Use Grease Pencil", 10, 225, 150, 20, &snode->flag, 0, 0, 0, 0, "Display freehand annotations overlay over this Node Editor (draw using Shift-LMB)");
/* extend the panel if the contents won't fit */
newheight= draw_gpencil_panel(block, gpd, curarea);
diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c
index c8c74ad8279..cc431c73a2e 100644
--- a/source/blender/src/drawseq.c
+++ b/source/blender/src/drawseq.c
@@ -134,7 +134,7 @@ static void seq_panel_gpencil(short cntrl) // SEQ_HANDLER_GREASEPENCIL
uiNewPanelHeight(block, 204);
/* draw button for showing gpencil settings and drawings */
- uiDefButBitI(block, TOG, SEQ_DRAW_GPENCIL, B_REDR, "Use Grease Pencil", 10, 225, 150, 20, &sseq->flag, 0, 0, 0, 0, "Display freehand annotations overlay over this Sequencer View");
+ uiDefButBitI(block, TOG, SEQ_DRAW_GPENCIL, B_REDR, "Use Grease Pencil", 10, 225, 150, 20, &sseq->flag, 0, 0, 0, 0, "Display freehand annotations overlay over this Sequencer View (draw using Shift-LMB)");
/* extend the panel if the contents won't fit */
newheight= draw_gpencil_panel(block, gpd, curarea);
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 14434504e7a..8c7c78de837 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -1502,44 +1502,52 @@ static void draw_view_icon(void)
glDisable(GL_BLEND);
}
-static void draw_viewport_name(ScrArea *sa)
+char *view3d_get_name(View3D *v3d)
{
char *name = NULL;
- char *printable = NULL;
- switch(G.vd->view) {
+ switch (v3d->view) {
case 1:
- if (G.vd->persp == V3D_ORTHO)
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Ortho" : "Front Ortho";
+ if (v3d->persp == V3D_ORTHO)
+ name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Ortho" : "Front Ortho";
else
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Persp" : "Front Persp";
+ name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Persp" : "Front Persp";
break;
case 3:
- if (G.vd->persp == V3D_ORTHO)
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Ortho" : "Right Ortho";
+ if (v3d->persp == V3D_ORTHO)
+ name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Ortho" : "Right Ortho";
else
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Persp" : "Right Persp";
+ name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Persp" : "Right Persp";
break;
case 7:
- if (G.vd->persp == V3D_ORTHO)
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Ortho" : "Top Ortho";
+ if (v3d->persp == V3D_ORTHO)
+ name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Ortho" : "Top Ortho";
else
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Persp" : "Top Persp";
+ name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Persp" : "Top Persp";
break;
default:
- if (G.vd->persp==V3D_CAMOB) {
- if ((G.vd->camera) && (G.vd->camera->type == OB_CAMERA)) {
+ if (v3d->persp==V3D_CAMOB) {
+ if ((v3d->camera) && (v3d->camera->type == OB_CAMERA)) {
Camera *cam;
- cam = G.vd->camera->data;
+ cam = v3d->camera->data;
name = (cam->type != CAM_ORTHO) ? "Camera Persp" : "Camera Ortho";
} else {
name = "Object as Camera";
}
} else {
- name = (G.vd->persp == V3D_ORTHO) ? "User Ortho" : "User Persp";
+ name = (v3d->persp == V3D_ORTHO) ? "User Ortho" : "User Persp";
}
+ break;
}
+ return name;
+}
+
+static void draw_viewport_name(ScrArea *sa)
+{
+ char *name = view3d_get_name(sa->spacedata.first);
+ char *printable = NULL;
+
if (G.vd->localview) {
printable = malloc(strlen(name) + strlen(" (Local)_")); /* '_' gives space for '\0' */
strcpy(printable, name);
@@ -2654,7 +2662,7 @@ static void view3d_panel_gpencil(short cntrl) // VIEW3D_HANDLER_GREASEPENCIL
uiNewPanelHeight(block, 204);
/* draw button for showing gpencil settings and drawings */
- uiDefButBitS(block, TOG, V3D_DISPGP, B_REDR, "Use Grease Pencil", 10, 225, 150, 20, &vd->flag2, 0, 0, 0, 0, "Display freehand annotations overlay over this 3D View");
+ uiDefButBitS(block, TOG, V3D_DISPGP, B_REDR, "Use Grease Pencil", 10, 225, 150, 20, &vd->flag2, 0, 0, 0, 0, "Display freehand annotations overlay over this 3D View (draw using Shift-LMB)");
/* extend the panel if the contents won't fit */
newheight= draw_gpencil_panel(block, gpd, curarea);
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index 3251cb33b53..c454715b1df 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -517,23 +517,43 @@ static void actdata_filter_shapekey (ListBase *act_data, Key *key, int filter_mo
}
}
-static void actdata_filter_gpencil (ListBase *act_data, bGPdata *gpd, int filter_mode)
+
+static void actdata_filter_gpencil (ListBase *act_data, bScreen *sc, int filter_mode)
{
bActListElem *ale;
+ ScrArea *sa;
+ bGPdata *gpd;
bGPDlayer *gpl;
/* check if filtering types are appropriate */
if ( !(filter_mode & (ACTFILTER_IPOKEYS|ACTFILTER_ONLYICU|ACTFILTER_ACTGROUPED)) )
{
- /* loop over layers as the conditions are acceptable */
- for (gpl= gpd->layers.first; gpl; gpl= gpl->next) {
- /* only if selected */
- if (!(filter_mode & ACTFILTER_SEL) || SEL_GPL(gpl)) {
- /* only if editable */
- if (!(filter_mode & ACTFILTER_FOREDIT) || EDITABLE_GPL(gpl)) {
- /* add to list */
- ale= make_new_actlistelem(gpl, ACTTYPE_GPLAYER, NULL, ACTTYPE_NONE);
- if (ale) BLI_addtail(act_data, ale);
+ /* loop over spaces in current screen, finding gpd blocks (could be slow!) */
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ /* try to get gp data */
+ gpd= gpencil_data_getactive(sa);
+ if (gpd == NULL) continue;
+
+ /* add gpd as channel too (if for drawing, and it has layers) */
+ if ((filter_mode & ACTFILTER_FORDRAWING) && (gpd->layers.first)) {
+ /* add to list */
+ ale= make_new_actlistelem(gpd, ACTTYPE_GPDATABLOCK, sa, ACTTYPE_SPECIALDATA);
+ if (ale) BLI_addtail(act_data, ale);
+ }
+
+ /* only add layers if they will be visible (if drawing channels) */
+ if ( !(filter_mode & ACTFILTER_VISIBLE) || (EXPANDED_GPD(gpd)) ) {
+ /* loop over layers as the conditions are acceptable */
+ for (gpl= gpd->layers.first; gpl; gpl= gpl->next) {
+ /* only if selected */
+ if (!(filter_mode & ACTFILTER_SEL) || SEL_GPL(gpl)) {
+ /* only if editable */
+ if (!(filter_mode & ACTFILTER_FOREDIT) || EDITABLE_GPL(gpl)) {
+ /* add to list */
+ ale= make_new_actlistelem(gpl, ACTTYPE_GPLAYER, gpd, ACTTYPE_GPDATABLOCK);
+ if (ale) BLI_addtail(act_data, ale);
+ }
+ }
}
}
}
@@ -637,11 +657,8 @@ int get_nearest_key_num (Key *key, short *mval, float *x)
return (num + 1);
}
-/* this function is used to get a pointer to an action or shapekey
- * datablock, thus simplying that process.
- */
-/* this function is intended for use */
-void *get_nearest_act_channel (short mval[], short *ret_type)
+/* this function finds the channel that mouse is floating over */
+void *get_nearest_act_channel (short mval[], short *ret_type, void **owner)
{
ListBase act_data = {NULL, NULL};
bActListElem *ale;
@@ -652,6 +669,9 @@ void *get_nearest_act_channel (short mval[], short *ret_type)
int clickmin, clickmax;
float x,y;
+ /* init 'owner' return val */
+ *owner= NULL;
+
/* determine what type of data we are operating on */
data = get_action_context(&datatype);
if (data == NULL) {
@@ -679,6 +699,7 @@ void *get_nearest_act_channel (short mval[], short *ret_type)
/* found match */
*ret_type= ale->type;
data= ale->data;
+ *owner= ale->owner;
BLI_freelistN(&act_data);
@@ -854,10 +875,7 @@ void *get_action_context (short *datatype)
case SACTCONT_GPENCIL:
*datatype= ACTCONT_GPENCIL;
- if (G.saction->pin)
- return G.saction->gpd;
- else
- return gpencil_data_getetime(G.curscreen);
+ return G.curscreen; // FIXME: add that dopesheet type thing here!
default: /* includes SACTCONT_DOPESHEET for now */
*datatype= ACTCONT_NONE;
@@ -2327,7 +2345,7 @@ static void numbuts_action ()
void *data;
short datatype;
- void *act_channel;
+ void *act_channel, *channel_owner;
short chantype;
bActionGroup *agrp= NULL;
@@ -2335,6 +2353,7 @@ static void numbuts_action ()
bConstraintChannel *conchan= NULL;
IpoCurve *icu= NULL;
KeyBlock *kb= NULL;
+ bGPdata *gpd= NULL;
bGPDlayer *gpl= NULL;
short mval[2];
@@ -2353,7 +2372,7 @@ static void numbuts_action ()
getmouseco_areawin(mval);
if (mval[0] > NAMEWIDTH)
return;
- act_channel= get_nearest_act_channel(mval, &chantype);
+ act_channel= get_nearest_act_channel(mval, &chantype, &channel_owner);
/* create items for clever-numbut */
if (chantype == ACTTYPE_ACHAN) {
@@ -2451,6 +2470,7 @@ static void numbuts_action ()
}
else if (chantype == ACTTYPE_GPLAYER) {
/* Grease-Pencil Layer */
+ gpd= (bGPdata *)channel_owner;
gpl= (bGPDlayer *)act_channel;
strcpy(str, gpl->info);
@@ -2511,7 +2531,7 @@ static void numbuts_action ()
}
else if (gpl) {
strcpy(gpl->info, str);
- BLI_uniquename(&( ((bGPdata *)data)->layers ), gpl, "GP_Layer", offsetof(bGPDlayer, info), 128);
+ BLI_uniquename(&gpd->layers, gpl, "GP_Layer", offsetof(bGPDlayer, info), 128);
if (mute) gpl->flag |= GP_LAYER_HIDE;
else gpl->flag &= ~GP_LAYER_HIDE;;
@@ -2871,9 +2891,10 @@ int select_gplayer_channel (bGPdata *gpd, bGPDlayer *gpl, int selectmode)
gpl->flag ^= GP_LAYER_SELECT;
break;
}
+
flag = (gpl->flag & GP_LAYER_SELECT) ? 1 : 0;
-
- gpencil_layer_setactive(gpd, gpl);
+ if (flag)
+ gpencil_layer_setactive(gpd, gpl);
return flag;
}
@@ -3100,11 +3121,11 @@ void selectall_action_keys (short mval[], short mode, short select_mode)
switch (mode) {
case 0: /* all in channel*/
{
- void *act_channel;
+ void *act_channel, *channel_owner;
short chantype;
/* get channel, and act according to type */
- act_channel= get_nearest_act_channel(mval, &chantype);
+ act_channel= get_nearest_act_channel(mval, &chantype, &channel_owner);
switch (chantype) {
case ACTTYPE_GROUP:
{
@@ -3939,8 +3960,7 @@ static void mouse_action (int selectmode)
static void mouse_actionchannels (short mval[])
{
bAction *act= G.saction->action;
- bGPdata *gpd= G.saction->gpd;
- void *data, *act_channel;
+ void *data, *act_channel, *channel_owner;
short datatype, chantype;
/* determine what type of data we are operating on */
@@ -3948,7 +3968,7 @@ static void mouse_actionchannels (short mval[])
if (data == NULL) return;
/* get channel to work on */
- act_channel= get_nearest_act_channel(mval, &chantype);
+ act_channel= get_nearest_act_channel(mval, &chantype, &channel_owner);
/* action to take depends on what channel we've got */
switch (chantype) {
@@ -4086,8 +4106,17 @@ static void mouse_actionchannels (short mval[])
}
}
break;
+ case ACTTYPE_GPDATABLOCK:
+ {
+ bGPdata *gpd= (bGPdata *)act_channel;
+
+ /* toggle expand */
+ gpd->flag ^= GP_DATA_EXPAND;
+ }
+ break;
case ACTTYPE_GPLAYER:
{
+ bGPdata *gpd= (bGPdata *)channel_owner;
bGPDlayer *gpl= (bGPDlayer *)act_channel;
if (mval[0] >= (NAMEWIDTH-16)) {
@@ -4100,7 +4129,13 @@ static void mouse_actionchannels (short mval[])
}
else {
/* select/deselect */
- select_gplayer_channel(gpd, gpl, SELECT_INVERT);
+ if (G.qual & LR_SHIFTKEY) {
+ select_gplayer_channel(gpd, gpl, SELECT_INVERT);
+ }
+ else {
+ deselect_gpencil_layers(data, 0);
+ select_gplayer_channel(gpd, gpl, SELECT_INVERT);
+ }
}
}
break;
diff --git a/source/blender/src/editaction_gpencil.c b/source/blender/src/editaction_gpencil.c
index b91c5a8b332..14269080b1f 100644
--- a/source/blender/src/editaction_gpencil.c
+++ b/source/blender/src/editaction_gpencil.c
@@ -246,7 +246,7 @@ void borderselect_gplayer_frames (bGPDlayer *gpl, float min, float max, short se
/* De-selects or inverts the selection of Layers for a grease-pencil block
* mode: 0 = default behaviour (select all), 1 = test if (de)select all, 2 = invert all
*/
-void deselect_gpencil_layers (bGPdata *gpd, short mode)
+void deselect_gpencil_layers (void *data, short mode)
{
ListBase act_data = {NULL, NULL};
bActListElem *ale;
@@ -254,7 +254,7 @@ void deselect_gpencil_layers (bGPdata *gpd, short mode)
/* filter data */
filter= ACTFILTER_VISIBLE;
- actdata_filter(&act_data, filter, gpd, ACTCONT_GPENCIL);
+ actdata_filter(&act_data, filter, data, ACTCONT_GPENCIL);
/* See if we should be selecting or deselecting */
if (mode == 1) {
@@ -294,7 +294,6 @@ void delete_gpencil_layers (void)
{
ListBase act_data = {NULL, NULL};
bActListElem *ale, *next;
- bGPdata *gpd;
void *data;
short datatype;
int filter;
@@ -303,7 +302,6 @@ void delete_gpencil_layers (void)
data = get_action_context(&datatype);
if (data == NULL) return;
if (datatype != ACTCONT_GPENCIL) return;
- gpd= (bGPdata *)data;
/* filter data */
filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_CHANNELS | ACTFILTER_SEL);
@@ -311,6 +309,7 @@ void delete_gpencil_layers (void)
/* clean up grease-pencil layers */
for (ale= act_data.first; ale; ale= next) {
+ bGPdata *gpd= (bGPdata *)ale->owner;
bGPDlayer *gpl= (bGPDlayer *)ale->data;
next= ale->next;
diff --git a/source/blender/src/gpencil.c b/source/blender/src/gpencil.c
index fa32b0ac7d4..d8299fc2a61 100644
--- a/source/blender/src/gpencil.c
+++ b/source/blender/src/gpencil.c
@@ -383,111 +383,6 @@ short gpencil_data_setactive (ScrArea *sa, bGPdata *gpd)
return 0;
}
-/* Find gp-data destined for editing in animation editor (for editing time) */
-bGPdata *gpencil_data_getetime (bScreen *sc)
-{
- bGPdata *gpd= NULL;
- ScrArea *sa;
-
- /* error checking */
- if (sc == NULL)
- return NULL;
-
- /* search through areas, checking if an appropriate gp-block is available
- * (this assumes that only one will have the active flag set)
- */
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- /* handle depending on space type */
- switch (sa->spacetype) {
- case SPACE_VIEW3D: /* 3d-view */
- {
- View3D *v3d= sa->spacedata.first;
- gpd= v3d->gpd;
- }
- break;
- case SPACE_NODE: /* Node Editor */
- {
- SpaceNode *snode= sa->spacedata.first;
- gpd= snode->gpd;
- }
- break;
- case SPACE_SEQ: /* Sequence Editor - Image Preview */
- {
- SpaceSeq *sseq= sa->spacedata.first;
-
- if (sseq->mainb)
- gpd= sseq->gpd;
- else
- gpd= NULL;
- }
- break;
-
- default: /* unsupported space-type */
- gpd= NULL;
- break;
- }
-
- /* check if ok */
- if ((gpd) && (gpd->flag & GP_DATA_EDITTIME))
- return gpd;
- }
-
- /* didn't find a match */
- return NULL;
-}
-
-/* make sure only the specified view can have gp-data for time editing
- * - gpd can be NULL, if we wish to make sure no gp-data is being edited
- */
-void gpencil_data_setetime (bScreen *sc, bGPdata *gpd)
-{
- bGPdata *gpdn= NULL;
- ScrArea *sa;
-
- /* error checking */
- if (sc == NULL)
- return;
-
- /* search through areas, checking if an appropriate gp-block is available
- * (this assumes that only one will have the active flag set)
- */
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- /* handle depending on space type */
- switch (sa->spacetype) {
- case SPACE_VIEW3D: /* 3d-view */
- {
- View3D *v3d= sa->spacedata.first;
- gpdn= v3d->gpd;
- }
- break;
- case SPACE_NODE: /* Node Editor */
- {
- SpaceNode *snode= sa->spacedata.first;
- gpdn= snode->gpd;
- }
- break;
- case SPACE_SEQ: /* Sequence Editor - Image Preview */
- {
- SpaceSeq *sseq= sa->spacedata.first;
- gpdn= sseq->gpd;
- }
- break;
-
- default: /* unsupported space-type */
- gpdn= NULL;
- break;
- }
-
- /* clear flag if a gp-data block found */
- if (gpdn)
- gpdn->flag &= ~GP_DATA_EDITTIME;
- }
-
- /* set active flag for this block (if it is provided) */
- if (gpd)
- gpd->flag |= GP_DATA_EDITTIME;
-}
-
/* -------- GP-Frame API ---------- */
/* delete the last stroke of the given frame */
@@ -1151,7 +1046,7 @@ static void gp_paint_cleanup (tGPsdata *p)
//BIF_undo_push("GPencil Stroke");
/* force redraw after drawing action */
- force_draw(0);
+ force_draw_plus(SPACE_ACTION, 0);
}
/* -------- */
diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c
index 50d343ca470..4bb7bb9677e 100644
--- a/source/blender/src/header_action.c
+++ b/source/blender/src/header_action.c
@@ -1683,7 +1683,7 @@ void action_buttons(void)
"Channel", xco, -2, xmax-3, 24, "");
xco+= xmax;
}
- else if ((G.saction->gpd) && (G.saction->mode==SACTCONT_GPENCIL)) {
+ else if (G.saction->mode==SACTCONT_GPENCIL) {
xmax= GetButStringLength("Channel");
uiDefPulldownBut(block, action_gplayermenu, NULL,
"Channel", xco, -2, xmax-3, 24, "");
@@ -1722,24 +1722,7 @@ void action_buttons(void)
xco += (90 + 8);
/* MODE-DEPENDENT DRAWING */
- if (G.saction->mode == SACTCONT_GPENCIL) {
- char gp_name[64];
-
- /* pin button */
- uiDefIconButS(block, ICONTOG, B_ACTPIN, ICON_PIN_DEHLT, xco,0,XIC,YIC, &G.saction->pin, 0, 0, 0, 0, "Keeps this view displaying the current data regardless of what Grease Pencil set is active");
- xco += (XIC + 5);
-
- /* just a simple string to help identify if any content */
- glRasterPos2f((float)xco, 5.0);
- BIF_RasterPos((float)xco, 5.0); // stupid texture fonts
- BIF_ThemeColor(TH_TEXT);
-
- sprintf(gp_name, (G.saction->gpd)?"Grease Pencil Data":"<None>");
- xmax= GetButStringLength(gp_name);
- BIF_DrawString(uiBlockGetCurFont(block), gp_name, (U.transopts & USER_TR_BUTTONS));
- xco += xmax;
- }
- else {
+ if (G.saction->mode != SACTCONT_GPENCIL) {
/* NAME ETC */
ob= OBACT;
from = (ID *)ob;
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index ba8649eaa86..18e596abcc7 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -5651,6 +5651,8 @@ static int ui_auto_themecol(uiBut *but)
// (weak!) detect if it is a blockloop
if(but->block->dt == UI_EMBOSSP) return TH_MENU_ITEM;
return TH_BUT_POPUP;
+ case ROUNDBOX:
+ return TH_PANEL;
default:
return TH_BUT_NEUTRAL;
}
diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c
index e7041e60003..0403e5d5b37 100644
--- a/source/blender/src/interface_draw.c
+++ b/source/blender/src/interface_draw.c
@@ -2351,7 +2351,8 @@ static void ui_draw_roundbox(uiBut *but)
{
glEnable(GL_BLEND);
- BIF_ThemeColorShadeAlpha(TH_PANEL, but->a2, but->a2);
+ //BIF_ThemeColorShadeAlpha(TH_PANEL, but->a2, but->a2);
+ BIF_ThemeColorShadeAlpha(but->themecol, but->a2, but->a2);
uiSetRoundBox(but->a1);
gl_round_box(GL_POLYGON, but->x1, but->y1, but->x2, but->y2, but->min);