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:
authorHans Goudey <h.goudey@me.com>2020-06-17 21:09:17 +0300
committerHans Goudey <h.goudey@me.com>2020-06-17 21:09:17 +0300
commitbcb2b8ab576cbaf4663d9cc8690d40353f2f2651 (patch)
treea20804f53341987f63a2ddf2df8dee28ad4e13f0 /source/blender/modifiers/intern/MOD_ui_common.c
parent4cfdd10c2bf910606ce5570155b1b01f1f838a55 (diff)
UI: Improve Modifier Panel Header Menu
This makes a few changes to the modifier panel header: 1. Adds "move to top" and "move to bottom" buttons. 2. Adds a checkmark icon for "apply" 3. Makes it narrower, the text is closer to the dropdown icon. (Requires the change in ui_block_func_POPUP) Differential Revision: https://developer.blender.org/D8040
Diffstat (limited to 'source/blender/modifiers/intern/MOD_ui_common.c')
-rw-r--r--source/blender/modifiers/intern/MOD_ui_common.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c
index 3a1f8eddc09..67c89d6dc3e 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.c
+++ b/source/blender/modifiers/intern/MOD_ui_common.c
@@ -222,19 +222,29 @@ static bool modifier_can_delete(ModifierData *md)
return true;
}
-static void modifier_ops_extra_draw(bContext *UNUSED(C), uiLayout *layout, void *md_v)
+static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v)
{
+ PointerRNA op_ptr;
+ uiLayout *row;
ModifierData *md = (ModifierData *)md_v;
+ PointerRNA ptr;
+ Object *ob = get_modifier_object(C);
+ RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr);
+ uiLayoutSetContextPointer(layout, "modifier", &ptr);
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
+ uiLayoutSetUnitsX(layout, 4.0f);
+
+ /* Apply. */
uiItemEnumO(layout,
"OBJECT_OT_modifier_apply",
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
- 0,
+ ICON_CHECKMARK,
"apply_as",
MODIFIER_APPLY_DATA);
+ /* Apply as shapekey. */
if (BKE_modifier_is_same_topology(md) && !BKE_modifier_is_non_geometrical(md)) {
uiItemEnumO(layout,
"OBJECT_OT_modifier_apply",
@@ -244,6 +254,7 @@ static void modifier_ops_extra_draw(bContext *UNUSED(C), uiLayout *layout, void
MODIFIER_APPLY_SHAPE);
}
+ /* Duplicate. */
if (!ELEM(md->type,
eModifierType_Fluidsim,
eModifierType_Softbody,
@@ -255,6 +266,38 @@ static void modifier_ops_extra_draw(bContext *UNUSED(C), uiLayout *layout, void
ICON_DUPLICATE,
"OBJECT_OT_modifier_copy");
}
+
+ uiItemS(layout);
+
+ /* Move to first. */
+ row = uiLayoutColumn(layout, false);
+ uiItemFullO(row,
+ "OBJECT_OT_modifier_move_to_index",
+ IFACE_("Move to First"),
+ ICON_TRIA_UP,
+ NULL,
+ WM_OP_EXEC_DEFAULT,
+ 0,
+ &op_ptr);
+ RNA_int_set(&op_ptr, "index", 0);
+ if (!md->prev) {
+ uiLayoutSetEnabled(row, false);
+ }
+
+ /* Move to last. */
+ row = uiLayoutColumn(layout, false);
+ uiItemFullO(row,
+ "OBJECT_OT_modifier_move_to_index",
+ IFACE_("Move to Last"),
+ ICON_TRIA_DOWN,
+ NULL,
+ WM_OP_EXEC_DEFAULT,
+ 0,
+ &op_ptr);
+ RNA_int_set(&op_ptr, "index", BLI_listbase_count(&ob->modifiers) - 1);
+ if (!md->next) {
+ uiLayoutSetEnabled(row, false);
+ }
}
static void modifier_panel_header(const bContext *C, Panel *panel)