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:
authorTon Roosendaal <ton@blender.org>2013-03-07 22:01:10 +0400
committerTon Roosendaal <ton@blender.org>2013-03-07 22:01:10 +0400
commit8e474517db366f6f88d99b1b83f615f3320b71bd (patch)
treefd8599748dbe3f3edef3b49549cd8e0702697a61 /source/blender/editors/gpencil
parent643b0be4cb3f73bd876493d2a7bd6f76ef27cf06 (diff)
GPencil feature request:
Allow layers to be moved up and down, so you can control drawing order nicer.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_buttons.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c
index 0aa109a0aef..c6763ac949f 100644
--- a/source/blender/editors/gpencil/gpencil_buttons.c
+++ b/source/blender/editors/gpencil/gpencil_buttons.c
@@ -86,6 +86,29 @@ static void gp_ui_dellayer_cb(bContext *C, void *gpd, void *gpl)
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
+/* move layer up */
+static void gp_ui_layer_up_cb(bContext *C, void *gpd_v, void *gpl_v)
+{
+ bGPdata *gpd = gpd_v;
+ bGPDlayer *gpl = gpl_v;
+
+ BLI_remlink(&gpd->layers, gpl);
+ BLI_insertlinkbefore(&gpd->layers, gpl->prev, gpl);
+
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+}
+
+/* move layer down */
+static void gp_ui_layer_down_cb(bContext *C, void *gpd_v, void *gpl_v)
+{
+ bGPdata *gpd = gpd_v;
+ bGPDlayer *gpl = gpl_v;
+
+ BLI_remlink(&gpd->layers, gpl);
+ BLI_insertlinkafter(&gpd->layers, gpl->next, gpl);
+
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+}
/* ------- Drawing Code ------- */
@@ -174,6 +197,18 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
/* name */
uiItemR(sub, &ptr, "info", 0, "", ICON_NONE);
+ /* move up/down */
+ if (gpl->prev) {
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_UP, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Move layer up"));
+ uiButSetFunc(but, gp_ui_layer_up_cb, gpd, gpl);
+ }
+ if (gpl->next) {
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_DOWN, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Move layer down"));
+ uiButSetFunc(but, gp_ui_layer_down_cb, gpd, gpl);
+ }
+
/* delete 'button' */
uiBlockSetEmboss(block, UI_EMBOSSN);
/* right-align ............................... */