[Bf-blender-cvs] [3ebfd533cad] topbar: Top-bar operator settings: Add simple "More..." button to show all settings
Julian Eisel
noreply at git.blender.org
Sat Oct 21 15:37:02 CEST 2017
Commit: 3ebfd533cad51979346470d523c9bc97da84c456
Author: Julian Eisel
Date: Sat Oct 21 15:34:17 2017 +0200
Branches: topbar
https://developer.blender.org/rB3ebfd533cad51979346470d523c9bc97da84c456
Top-bar operator settings: Add simple "More..." button to show all settings
Doesn't make much sense yet, but it will once operator settings are
split into basic and advanced ones (see D2883).
===================================================================
M source/blender/editors/include/UI_interface.h
M source/blender/editors/interface/interface_layout.c
M source/blender/editors/interface/interface_templates.c
===================================================================
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 414a2984893..482217cbe5e 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -845,6 +845,9 @@ enum {
UI_LAYOUT_OP_COMPACT = (1 << 3),
/* Don't show the "Redo Unsupported" label */
UI_LAYOUT_OP_HIDE_UNSUPPORTED = (1 << 4),
+ /* Only show non-advanced op-properties by default and add a "More" button invoking
+ * redo popup with all properties. If all properties are advanced, show the first 2. */
+ UI_LAYOUT_OP_SPLIT_ADVANCED = (1 << 5),
};
/* used for transp checkers */
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 485d0ed879e..7e3d1ae9980 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -3517,6 +3517,7 @@ void uiLayoutOperatorButs(
bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
const char label_align, const short flag)
{
+ uiBlock *block = uiLayoutGetBlock(layout);
const char *op_title = RNA_struct_ui_name(op->type->srna);
bool can_repeat;
@@ -3540,14 +3541,14 @@ void uiLayoutOperatorButs(
/* poll() on this operator may still fail, at the moment there is no nice feedback when this happens
* just fails silently */
if (!WM_operator_repeat_check(C, op)) {
- UI_block_lock_set(uiLayoutGetBlock(layout), true, "Operator can't' redo");
+ UI_block_lock_set(block, true, "Operator can't' redo");
/* XXX, could give some nicer feedback or not show redo panel at all? */
uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE);
}
else {
/* useful for macros where only one of the steps can't be re-done */
- UI_block_lock_clear(uiLayoutGetBlock(layout));
+ UI_block_lock_clear(block);
}
/* menu */
@@ -3556,7 +3557,7 @@ void uiLayoutOperatorButs(
PointerRNA op_ptr;
uiLayout *row;
- uiLayoutGetBlock(layout)->ui_operator = op;
+ block->ui_operator = op;
row = uiLayoutRow(layout, true);
uiItemM(row, (bContext *)C, "WM_MT_operator_presets", NULL, ICON_NONE);
@@ -3611,7 +3612,6 @@ void uiLayoutOperatorButs(
/* set various special settings for buttons */
{
- uiBlock *block = uiLayoutGetBlock(layout);
const bool is_popup = (block->flag & UI_BLOCK_KEEP_OPEN) != 0;
uiBut *but;
@@ -3632,6 +3632,10 @@ void uiLayoutOperatorButs(
}
}
}
+
+ if (flag & UI_LAYOUT_OP_SPLIT_ADVANCED) {
+ uiItemO(layout, IFACE_("More..."), ICON_NONE, "SCREEN_OT_redo_last");
+ }
}
/* this is a bit of a hack but best keep it in one place at least */
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 5ef5b677f51..a94fce76978 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1414,7 +1414,8 @@ void uiTemplateOperatorRedo(uiLayout *layout, bContext *C)
if (op) {
uiBlock *block = uiLayoutGetBlock(layout);
- int layout_flags = UI_LAYOUT_OP_SHOW_REDO_BUT | UI_LAYOUT_OP_COMPACT | UI_LAYOUT_OP_HIDE_UNSUPPORTED;
+ int layout_flags = (UI_LAYOUT_OP_SHOW_REDO_BUT | UI_LAYOUT_OP_COMPACT |
+ UI_LAYOUT_OP_HIDE_UNSUPPORTED | UI_LAYOUT_OP_SPLIT_ADVANCED);
uiLayoutOperatorButs(C, layout, op, NULL, '\0', layout_flags);
UI_block_func_handle_set(block, ED_undo_operator_repeat_cb_evt, op);
More information about the Bf-blender-cvs
mailing list