From 6327771bc968c14440eb30f971916cc913e77977 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Mon, 14 Dec 2020 10:25:37 +0100 Subject: Fix T83696: Add Additional menu to Effects panel This adds the missing options for the effects as it is done in modifiers. Reviewed By: HooglyBoogly Maniphest Tasks: T83696 Differential Revision: https://developer.blender.org/D9838 --- source/blender/shader_fx/intern/FX_ui_common.c | 56 ++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'source/blender/shader_fx/intern') diff --git a/source/blender/shader_fx/intern/FX_ui_common.c b/source/blender/shader_fx/intern/FX_ui_common.c index c1e3b2e21cd..9a86e1e96f5 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.c +++ b/source/blender/shader_fx/intern/FX_ui_common.c @@ -124,6 +124,59 @@ PointerRNA *shaderfx_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ #define ERROR_LIBDATA_MESSAGE TIP_("External library data") +static void gpencil_shaderfx_ops_extra_draw(bContext *C, uiLayout *layout, void *fx_v) +{ + PointerRNA op_ptr; + uiLayout *row; + ShaderFxData *fx = (ShaderFxData *)fx_v; + + PointerRNA ptr; + Object *ob = ED_object_active_context(C); + RNA_pointer_create(&ob->id, &RNA_ShaderFx, fx, &ptr); + uiLayoutSetContextPointer(layout, "shaderfx", &ptr); + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); + + uiLayoutSetUnitsX(layout, 4.0f); + + /* Duplicate. */ + uiItemO(layout, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), + ICON_DUPLICATE, + "OBJECT_OT_shaderfx_copy"); + + uiItemS(layout); + + /* Move to first. */ + row = uiLayoutColumn(layout, false); + uiItemFullO(row, + "OBJECT_OT_shaderfx_move_to_index", + IFACE_("Move to First"), + ICON_TRIA_UP, + NULL, + WM_OP_INVOKE_DEFAULT, + 0, + &op_ptr); + RNA_int_set(&op_ptr, "index", 0); + if (!fx->prev) { + uiLayoutSetEnabled(row, false); + } + + /* Move to last. */ + row = uiLayoutColumn(layout, false); + uiItemFullO(row, + "OBJECT_OT_shaderfx_move_to_index", + IFACE_("Move to Last"), + ICON_TRIA_DOWN, + NULL, + WM_OP_INVOKE_DEFAULT, + 0, + &op_ptr); + RNA_int_set(&op_ptr, "index", BLI_listbase_count(&ob->shader_fx) - 1); + if (!fx->next) { + uiLayoutSetEnabled(row, false); + } +} + static void shaderfx_panel_header(const bContext *UNUSED(C), Panel *panel) { uiLayout *layout = panel->layout; @@ -159,6 +212,9 @@ static void shaderfx_panel_header(const bContext *UNUSED(C), Panel *panel) uiItemR(row, ptr, "show_viewport", 0, "", ICON_NONE); uiItemR(row, ptr, "show_render", 0, "", ICON_NONE); + /* Extra operators. */ + uiItemMenuF(row, "", ICON_DOWNARROW_HLT, gpencil_shaderfx_ops_extra_draw, fx); + row = uiLayoutRow(row, false); uiLayoutSetEmboss(row, UI_EMBOSS_NONE); uiItemO(row, "", ICON_X, "OBJECT_OT_shaderfx_remove"); -- cgit v1.2.3