Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_buttons.c
| Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, const bool is_v3d) | ||||
| PointerRNA ptr; | PointerRNA ptr; | ||||
| int icon; | int icon; | ||||
| /* make pointer to layer data */ | /* make pointer to layer data */ | ||||
| RNA_pointer_create((ID *)gpd, &RNA_GPencilLayer, gpl, &ptr); | RNA_pointer_create((ID *)gpd, &RNA_GPencilLayer, gpl, &ptr); | ||||
| /* unless button has own callback, it adds this callback to button */ | /* unless button has own callback, it adds this callback to button */ | ||||
| block = uiLayoutGetBlock(layout); | block = uiLayoutGetBlock(layout); | ||||
| uiBlockSetFunc(block, gp_ui_activelayer_cb, gpd, gpl); | UI_block_func_set(block, gp_ui_activelayer_cb, gpd, gpl); | ||||
| /* draw header ---------------------------------- */ | /* draw header ---------------------------------- */ | ||||
| /* get layout-row + UI-block for header */ | /* get layout-row + UI-block for header */ | ||||
| box = uiLayoutBox(layout); | box = uiLayoutBox(layout); | ||||
| row = uiLayoutRow(box, false); | row = uiLayoutRow(box, false); | ||||
| uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND); | uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND); | ||||
| block = uiLayoutGetBlock(row); /* err... */ | block = uiLayoutGetBlock(row); /* err... */ | ||||
| uiBlockSetEmboss(block, UI_EMBOSSN); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| /* left-align ............................... */ | /* left-align ............................... */ | ||||
| sub = uiLayoutRow(row, false); | sub = uiLayoutRow(row, false); | ||||
| /* active */ | /* active */ | ||||
| block = uiLayoutGetBlock(sub); | block = uiLayoutGetBlock(sub); | ||||
| icon = (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF; | icon = (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF; | ||||
| but = uiDefIconButBitI(block, TOG, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, | but = uiDefIconButBitI(block, UI_BTYPE_TOGGLE, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, | ||||
| &gpl->flag, 0.0, 0.0, 0.0, 0.0, TIP_("Set active layer")); | &gpl->flag, 0.0, 0.0, 0.0, 0.0, TIP_("Set active layer")); | ||||
| uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl); | UI_but_func_set(but, gp_ui_activelayer_cb, gpd, gpl); | ||||
| /* locked */ | /* locked */ | ||||
| icon = (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED; | icon = (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED; | ||||
| uiItemR(sub, &ptr, "lock", 0, "", icon); | uiItemR(sub, &ptr, "lock", 0, "", icon); | ||||
| /* when layer is locked or hidden, only draw header */ | /* when layer is locked or hidden, only draw header */ | ||||
| if (gpl->flag & (GP_LAYER_LOCKED | GP_LAYER_HIDE)) { | if (gpl->flag & (GP_LAYER_LOCKED | GP_LAYER_HIDE)) { | ||||
| char name[256]; /* gpl->info is 128, but we need space for 'locked/hidden' as well */ | char name[256]; /* gpl->info is 128, but we need space for 'locked/hidden' as well */ | ||||
| Show All 11 Lines | if (gpl->flag & (GP_LAYER_LOCKED | GP_LAYER_HIDE)) { | ||||
| /* delete button (only if hidden but not locked!) */ | /* delete button (only if hidden but not locked!) */ | ||||
| if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) { | if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) { | ||||
| /* right-align ............................... */ | /* right-align ............................... */ | ||||
| sub = uiLayoutRow(row, true); | sub = uiLayoutRow(row, true); | ||||
| uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); | uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); | ||||
| block = uiLayoutGetBlock(sub); /* XXX... err... */ | block = uiLayoutGetBlock(sub); /* XXX... err... */ | ||||
| but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, | but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, | ||||
| NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer")); | NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer")); | ||||
| uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl); | UI_but_func_set(but, gp_ui_dellayer_cb, gpd, gpl); | ||||
| } | } | ||||
| uiBlockSetEmboss(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| } | } | ||||
| else { | else { | ||||
| /* draw rest of header -------------------------------- */ | /* draw rest of header -------------------------------- */ | ||||
| /* visibility button */ | /* visibility button */ | ||||
| uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF); | uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF); | ||||
| /* frame locking */ | /* frame locking */ | ||||
| /* TODO: this needs its own icons... */ | /* TODO: this needs its own icons... */ | ||||
| icon = (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION; | icon = (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION; | ||||
| uiItemR(sub, &ptr, "lock_frame", 0, "", icon); | uiItemR(sub, &ptr, "lock_frame", 0, "", icon); | ||||
| uiBlockSetEmboss(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| /* name */ | /* name */ | ||||
| uiItemR(sub, &ptr, "info", 0, "", ICON_NONE); | uiItemR(sub, &ptr, "info", 0, "", ICON_NONE); | ||||
| /* move up/down */ | /* move up/down */ | ||||
| uiBlockBeginAlign(block); | UI_block_align_begin(block); | ||||
| if (gpl->prev) { | if (gpl->prev) { | ||||
| but = uiDefIconBut(block, BUT, 0, ICON_TRIA_UP, 0, 0, UI_UNIT_X, UI_UNIT_Y, | but = uiDefIconBut(block, UI_BTYPE_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")); | NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Move layer up")); | ||||
| uiButSetFunc(but, gp_ui_layer_up_cb, gpd, gpl); | UI_but_func_set(but, gp_ui_layer_up_cb, gpd, gpl); | ||||
| } | } | ||||
| if (gpl->next) { | if (gpl->next) { | ||||
| but = uiDefIconBut(block, BUT, 0, ICON_TRIA_DOWN, 0, 0, UI_UNIT_X, UI_UNIT_Y, | but = uiDefIconBut(block, UI_BTYPE_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")); | NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Move layer down")); | ||||
| uiButSetFunc(but, gp_ui_layer_down_cb, gpd, gpl); | UI_but_func_set(but, gp_ui_layer_down_cb, gpd, gpl); | ||||
| } | } | ||||
| uiBlockEndAlign(block); | UI_block_align_end(block); | ||||
| /* delete 'button' */ | /* delete 'button' */ | ||||
| uiBlockSetEmboss(block, UI_EMBOSSN); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| /* right-align ............................... */ | /* right-align ............................... */ | ||||
| sub = uiLayoutRow(row, true); | sub = uiLayoutRow(row, true); | ||||
| uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); | uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); | ||||
| block = uiLayoutGetBlock(sub); /* XXX... err... */ | block = uiLayoutGetBlock(sub); /* XXX... err... */ | ||||
| but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, | but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, | ||||
| NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer")); | NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer")); | ||||
| uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl); | UI_but_func_set(but, gp_ui_dellayer_cb, gpd, gpl); | ||||
| uiBlockSetEmboss(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| /* new backdrop ----------------------------------- */ | /* new backdrop ----------------------------------- */ | ||||
| box = uiLayoutBox(layout); | box = uiLayoutBox(layout); | ||||
| split = uiLayoutSplit(box, 0.5f, false); | split = uiLayoutSplit(box, 0.5f, false); | ||||
| /* draw settings ---------------------------------- */ | /* draw settings ---------------------------------- */ | ||||
| /* left column ..................... */ | /* left column ..................... */ | ||||
| col = uiLayoutColumn(split, false); | col = uiLayoutColumn(split, false); | ||||
| ▲ Show 20 Lines • Show All 145 Lines • Show Last 20 Lines | |||||