[Bf-blender-cvs] [824f80a5d71] modifier-panels-ui: Add Modifier Apply Button Extras Menu - Apply as shape key if supported - Move up and down Makes room for other convenient operations in the future too.
Hans Goudey
noreply at git.blender.org
Thu Apr 9 19:00:02 CEST 2020
Commit: 824f80a5d71aadd03f2462a570e7fea8b5f5c95d
Author: Hans Goudey
Date: Thu Apr 9 11:59:55 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rB824f80a5d71aadd03f2462a570e7fea8b5f5c95d
Add Modifier Apply Button Extras Menu
- Apply as shape key if supported
- Move up and down
Makes room for other convenient operations in the future too.
===================================================================
M source/blender/modifiers/intern/MOD_ui_common.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c
index d28ee8cfcf1..2a20365bce0 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.c
+++ b/source/blender/modifiers/intern/MOD_ui_common.c
@@ -171,6 +171,45 @@ void modifier_panel_get_property_pointers(const bContext *C,
uiLayoutSetContextPointer(panel->layout, "modifier", r_md_ptr);
}
+static void modifier_extras_menu(bContext *UNUSED(C), uiLayout *layout, void *md_v)
+{
+ ModifierData *md = (ModifierData *)md_v;
+
+ if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) {
+ uiItemEnumO(layout,
+ "OBJECT_OT_modifier_apply",
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
+ 0,
+ "apply_as",
+ MODIFIER_APPLY_SHAPE);
+ }
+
+ if (md->prev) {
+ PointerRNA op_ptr;
+ uiItemFullO(layout,
+ "OBJECT_OT_modifier_move_up",
+ IFACE_("Move Up"),
+ ICON_NONE,
+ NULL,
+ WM_OP_EXEC_DEFAULT,
+ 0,
+ &op_ptr);
+ RNA_string_set(&op_ptr, "modifier", md->name);
+ }
+ if (md->next) {
+ PointerRNA op_ptr;
+ uiItemFullO(layout,
+ "OBJECT_OT_modifier_move_down",
+ IFACE_("Move Down"),
+ ICON_NONE,
+ NULL,
+ WM_OP_EXEC_DEFAULT,
+ 0,
+ &op_ptr);
+ RNA_string_set(&op_ptr, "modifier", md->name);
+ }
+}
+
#define ERROR_LIBDATA_MESSAGE TIP_("Can't edit external library data")
void modifier_panel_buttons(const bContext *C, Panel *panel)
{
@@ -216,14 +255,7 @@ void modifier_panel_buttons(const bContext *C, Panel *panel)
"apply_as",
MODIFIER_APPLY_DATA);
- if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) {
- uiItemEnumO(sub,
- "OBJECT_OT_modifier_apply",
- CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
- 0,
- "apply_as",
- MODIFIER_APPLY_SHAPE);
- }
+ uiItemMenuF(sub, "", ICON_DOWNARROW_HLT, modifier_extras_menu, md);
}
if (!ELEM(md->type,
More information about the Bf-blender-cvs
mailing list