[Bf-blender-cvs] [01cfcfaed6f] topbar: Don't show redo buttons in top-bar if redo is not supported
Julian Eisel
noreply at git.blender.org
Sat Oct 14 00:17:49 CEST 2017
Commit: 01cfcfaed6f84447463e1ec1d43214295981459c
Author: Julian Eisel
Date: Sat Oct 14 00:16:57 2017 +0200
Branches: topbar
https://developer.blender.org/rB01cfcfaed6f84447463e1ec1d43214295981459c
Don't show redo buttons in top-bar if redo is not supported
===================================================================
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 b945274957d..414a2984893 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -838,10 +838,14 @@ void UI_exit(void);
#define UI_ITEM_R_COMPACT (1 << 9)
/* uiLayoutOperatorButs flags */
-#define UI_LAYOUT_OP_SHOW_TITLE (1 << 0)
-#define UI_LAYOUT_OP_SHOW_REDO_BUT (UI_LAYOUT_OP_SHOW_TITLE | (1 << 1))
-#define UI_LAYOUT_OP_SHOW_EMPTY (1 << 2)
-#define UI_LAYOUT_OP_COMPACT (1 << 3)
+enum {
+ UI_LAYOUT_OP_SHOW_TITLE = (1 << 0),
+ UI_LAYOUT_OP_SHOW_REDO_BUT = (UI_LAYOUT_OP_SHOW_TITLE | (1 << 1)),
+ UI_LAYOUT_OP_SHOW_EMPTY = (1 << 2),
+ UI_LAYOUT_OP_COMPACT = (1 << 3),
+ /* Don't show the "Redo Unsupported" label */
+ UI_LAYOUT_OP_HIDE_UNSUPPORTED = (1 << 4),
+};
/* used for transp checkers */
#define UI_ALPHA_CHECKER_DARK 100
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index a36e9847fbd..8f69df9404d 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -3518,12 +3518,18 @@ void uiLayoutOperatorButs(
const char label_align, const short flag)
{
const char *op_title = RNA_struct_ui_name(op->type->srna);
+ bool can_repeat;
if (!op->properties) {
IDPropertyTemplate val = {0};
op->properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
}
+ can_repeat = WM_operator_repeat_check(C, op);
+ if (!can_repeat && (flag & UI_LAYOUT_OP_HIDE_UNSUPPORTED)) {
+ return;
+ }
+
if ((flag & UI_LAYOUT_OP_SHOW_REDO_BUT) == UI_LAYOUT_OP_SHOW_REDO_BUT) {
uiItemFullO(layout, "SCREEN_OT_repeat_last", op_title, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0);
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 2388927ad93..b1e3ed27e01 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1425,8 +1425,9 @@ 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;
- uiLayoutOperatorButs(C, layout, op, NULL, '\0', UI_LAYOUT_OP_SHOW_REDO_BUT | UI_LAYOUT_OP_COMPACT);
+ 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