[Bf-blender-cvs] [dbbbc1649b1] topbar: Fix glitches when using repeat button in top-bar
Julian Eisel
noreply at git.blender.org
Thu Nov 23 19:05:25 CET 2017
Commit: dbbbc1649b1fa7b085bccca5031a795b214595c4
Author: Julian Eisel
Date: Thu Nov 23 19:00:51 2017 +0100
Branches: topbar
https://developer.blender.org/rBdbbbc1649b1fa7b085bccca5031a795b214595c4
Fix glitches when using repeat button in top-bar
Repeat button is the one with the operator name in it.
In some cases it wouldn't work at all, e.g. Edit Mode toggle operator.
===================================================================
M source/blender/editors/interface/interface_templates.c
===================================================================
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index a89dbe387bd..c7e1a60b05c 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1442,21 +1442,24 @@ void uiTemplateOperatorRedoProperties(uiLayout *layout, bContext *C)
wmOperator *op = WM_operator_last_redo(C);
uiBlock *block = uiLayoutGetBlock(layout);
- if (op) {
- /* Repeat button with operator name as text. */
- uiItemFullO(layout, "SCREEN_OT_repeat_last", RNA_struct_ui_name(op->type->srna),
- ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
+ if (op == NULL) {
+ return;
+ }
- if (WM_operator_repeat_check(C, op)) {
- bool has_advanced = false;
+ /* Repeat button with operator name as text. */
+ uiItemFullO(layout, "SCREEN_OT_repeat_last", RNA_struct_ui_name(op->type->srna),
+ ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
- template_operator_redo_property_buts_draw(C, op, layout, UI_TEMPLATE_OP_PROPS_COMPACT, &has_advanced);
- if (has_advanced) {
- uiItemO(layout, IFACE_("More..."), ICON_NONE, "SCREEN_OT_redo_last");
- }
- }
+ if (WM_operator_repeat_check(C, op)) {
+ bool has_advanced = false;
+
+ UI_block_func_set(block, ED_undo_operator_repeat_cb, op, NULL);
+ template_operator_redo_property_buts_draw(C, op, layout, UI_TEMPLATE_OP_PROPS_COMPACT, &has_advanced);
+ UI_block_func_set(block, NULL, NULL, NULL); /* may want to reset to old state instead of NULLing all */
- UI_block_func_handle_set(block, ED_undo_operator_repeat_cb_evt, op);
+ if (has_advanced) {
+ uiItemO(layout, IFACE_("More..."), ICON_NONE, "SCREEN_OT_redo_last");
+ }
}
}
More information about the Bf-blender-cvs
mailing list