[Bf-blender-cvs] [f447c497720] topbar: Show 'Redo Last' button in the topbar, in front of redo settings
Julian Eisel
noreply at git.blender.org
Sat Jul 29 20:48:47 CEST 2017
Commit: f447c49772024ac47e09fcf313d0679b0e937c64
Author: Julian Eisel
Date: Sat Jul 29 20:47:44 2017 +0200
Branches: topbar
https://developer.blender.org/rBf447c49772024ac47e09fcf313d0679b0e937c64
Show 'Redo Last' button in the topbar, in front of redo settings
===================================================================
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 fc03eb32599..3cc9dec3f5b 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -838,9 +838,10 @@ 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_EMPTY (1 << 1)
-#define UI_LAYOUT_OP_COMPACT (1 << 2)
+#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)
/* 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 904ba9e2013..b0cb03e5252 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -3506,13 +3506,18 @@ void uiLayoutOperatorButs(
bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
const char label_align, const short flag)
{
+ const char *op_title = RNA_struct_ui_name(op->type->srna);
+
if (!op->properties) {
IDPropertyTemplate val = {0};
op->properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
}
- if (flag & UI_LAYOUT_OP_SHOW_TITLE) {
- uiItemL(layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
+ 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);
+ }
+ else if (flag & UI_LAYOUT_OP_SHOW_TITLE) {
+ uiItemL(layout, op_title, ICON_NONE);
}
/* poll() on this operator may still fail, at the moment there is no nice feedback when this happens
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index e08b99db294..8570a9b0993 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1421,7 +1421,7 @@ void uiTemplateOperatorRedo(uiLayout *layout, bContext *C)
if (op) {
uiBlock *block = uiLayoutGetBlock(layout);
- uiLayoutOperatorButs(C, layout, op, NULL, '\0', UI_LAYOUT_OP_COMPACT);
+ uiLayoutOperatorButs(C, layout, op, NULL, '\0', UI_LAYOUT_OP_SHOW_REDO_BUT | UI_LAYOUT_OP_COMPACT);
UI_block_func_handle_set(block, ED_undo_operator_repeat_cb_evt, op);
}
}
More information about the Bf-blender-cvs
mailing list