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-29 22:00:25 +0300
committerHans Goudey <h.goudey@me.com>2020-06-29 22:00:25 +0300
commit1fa40c9f8a81036476d5051b09ff15e27b628012 (patch)
tree37a5fa840d8eae820b5aff81fbe4e3e36599aab3 /source/blender/modifiers/intern/MOD_ui_common.c
parent4f8a881715ca71599c1f4ee82b76cbce0a02b4d9 (diff)
UI: Add shortcuts for modifier panels
The shortcuts act on the modifier with its panel under the mouse. The following shortcuts are enabled by default: - Remove modifier: X, Delete - Apply modifier: Ctrl A - Duplicate modifier: Shift D More shortcuts can be added in the keymap. Each panel can now store a custom data RNA pointer, and a new function is added to get the custom data for the panel under the cursor. This custom data could be used to refactor the "List Panel System" to generalize it and integrate it further with RNA. The same functionality will be added in further commits where it applies to constraints, grease pencil modifiers, and effects. Differential Revision: https://developer.blender.org/D8031
Diffstat (limited to 'source/blender/modifiers/intern/MOD_ui_common.c')
-rw-r--r--source/blender/modifiers/intern/MOD_ui_common.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c
index 88e095c549e..563aa3f091f 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.c
+++ b/source/blender/modifiers/intern/MOD_ui_common.c
@@ -236,12 +236,15 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v)
uiLayoutSetUnitsX(layout, 4.0f);
/* Apply. */
- uiItemEnumO(layout,
+ uiItemFullO(layout,
"OBJECT_OT_modifier_apply",
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
ICON_CHECKMARK,
- "apply_as",
- MODIFIER_APPLY_DATA);
+ NULL,
+ WM_OP_INVOKE_DEFAULT,
+ 0,
+ &op_ptr);
+ RNA_boolean_set(&op_ptr, "report", true);
/* Apply as shapekey. */
if (BKE_modifier_is_same_topology(md) && !BKE_modifier_is_non_geometrical(md)) {
@@ -371,7 +374,10 @@ static void modifier_panel_header(const bContext *C, Panel *panel)
if (modifier_can_delete(md) && !modifier_is_simulation(md)) {
sub = uiLayoutRow(row, false);
uiLayoutSetEmboss(sub, UI_EMBOSS_NONE);
- uiItemO(sub, "", ICON_X, "OBJECT_OT_modifier_remove");
+ PointerRNA op_ptr;
+ uiItemFullO(
+ sub, "OBJECT_OT_modifier_remove", "", ICON_X, NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
+ RNA_boolean_set(&op_ptr, "report", true);
buttons_number++;
}