[Bf-blender-cvs] [d369421a1f9] topbar: Fixes for last merge
Julian Eisel
noreply at git.blender.org
Mon Oct 23 01:10:10 CEST 2017
Commit: d369421a1f9ac634eb742a98699171080e14be72
Author: Julian Eisel
Date: Mon Oct 23 01:09:52 2017 +0200
Branches: topbar
https://developer.blender.org/rBd369421a1f9ac634eb742a98699171080e14be72
Fixes for last merge
===================================================================
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 589686cd205..580be265b22 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -840,7 +840,7 @@ void UI_exit(void);
/* uiLayoutOperatorButs flags */
enum {
UI_TEMPLATE_OP_PROPS_SHOW_TITLE = (1 << 0),
- UI_TEMPLATE_OP_PROPS_SHOW_REDO_BUT = (UI_LAYOUT_OP_SHOW_TITLE | (1 << 1)),
+ UI_TEMPLATE_OP_PROPS_SHOW_REDO_BUT = (UI_TEMPLATE_OP_PROPS_SHOW_TITLE | (1 << 1)),
UI_TEMPLATE_OP_PROPS_SHOW_EMPTY = (1 << 2),
UI_TEMPLATE_OP_PROPS_COMPACT = (1 << 3),
/* Don't show the "Redo Unsupported" label */
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 0115f0bc497..a3b8072b918 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -3502,140 +3502,6 @@ const char *uiLayoutIntrospect(uiLayout *layout)
return str;
}
-#ifdef USE_OP_RESET_BUT
-static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt, void *UNUSED(arg_dummy2))
-{
- WM_operator_properties_reset((wmOperator *)op_pt);
-}
-#endif
-
-/* this function does not initialize the layout, functions can be called on the layout before and after */
-void uiLayoutOperatorButs(
- const bContext *C, uiLayout *layout, wmOperator *op,
- 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;
-
- 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);
- }
- 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
- * just fails silently */
- if (!WM_operator_repeat_check(C, op)) {
- 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(block);
- }
-
- /* menu */
- if (op->type->flag & OPTYPE_PRESET) {
- /* XXX, no simple way to get WM_MT_operator_presets.bl_label from python! Label remains the same always! */
- PointerRNA op_ptr;
- uiLayout *row;
-
- block->ui_operator = op;
-
- row = uiLayoutRow(layout, true);
- uiItemM(row, (bContext *)C, "WM_MT_operator_presets", NULL, ICON_NONE);
-
- wmOperatorType *ot = WM_operatortype_find("WM_OT_operator_preset_add", false);
- op_ptr = uiItemFullO_ptr(row, ot, "", ICON_ZOOMIN, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
- RNA_string_set(&op_ptr, "operator", op->type->idname);
-
- op_ptr = uiItemFullO_ptr(row, ot, "", ICON_ZOOMOUT, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
- RNA_string_set(&op_ptr, "operator", op->type->idname);
- RNA_boolean_set(&op_ptr, "remove_active", true);
- }
-
- if (op->type->ui) {
- op->layout = layout;
- op->type->ui((bContext *)C, op);
- op->layout = NULL;
-
- /* UI_LAYOUT_OP_SHOW_EMPTY ignored */
- }
- else {
- wmWindowManager *wm = CTX_wm_manager(C);
- PointerRNA ptr;
- int empty;
-
- RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
-
- /* main draw call */
- empty = uiDefAutoButsRNA(layout, &ptr, check_prop, label_align, (flag & UI_LAYOUT_OP_COMPACT)) == 0;
-
- if (empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) {
- uiItemL(layout, IFACE_("No Properties"), ICON_NONE);
- }
- }
-
-#ifdef USE_OP_RESET_BUT
- /* its possible that reset can do nothing if all have PROP_SKIP_SAVE enabled
- * but this is not so important if this button is drawn in those cases
- * (which isn't all that likely anyway) - campbell */
- if (op->properties->len) {
- uiBlock *block;
- uiBut *but;
- uiLayout *col; /* needed to avoid alignment errors with previous buttons */
-
- col = uiLayoutColumn(layout, false);
- block = uiLayoutGetBlock(col);
- but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_FILE_REFRESH, IFACE_("Reset"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Reset operator defaults"));
- UI_but_func_set(but, ui_layout_operator_buts__reset_cb, op, NULL);
- }
-#endif
-
- /* set various special settings for buttons */
- {
- const bool is_popup = (block->flag & UI_BLOCK_KEEP_OPEN) != 0;
- uiBut *but;
-
-
- for (but = block->buttons.first; but; but = but->next) {
- /* no undo for buttons for operator redo panels */
- UI_but_flag_disable(but, UI_BUT_UNDO);
-
- /* only for popups, see [#36109] */
-
- /* if button is operator's default property, and a text-field, enable focus for it
- * - this is used for allowing operators with popups to rename stuff with fewer clicks
- */
- if (is_popup) {
- if ((but->rnaprop == op->type->prop) && (but->type == UI_BTYPE_TEXT)) {
- UI_but_focus_on_enter_event(CTX_wm_window(C), but);
- }
- }
- }
- }
-
- 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 */
MenuType *UI_but_menutype_get(uiBut *but)
{
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 1378c44e562..863752d78e7 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1417,10 +1417,10 @@ 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 | UI_LAYOUT_OP_SPLIT_ADVANCED);
+ int layout_flags = (UI_TEMPLATE_OP_PROPS_SHOW_REDO_BUT | UI_TEMPLATE_OP_PROPS_COMPACT |
+ UI_TEMPLATE_OP_PROPS_HIDE_UNSUPPORTED | UI_TEMPLATE_OP_PROPS_SPLIT_ADVANCED);
- uiLayoutOperatorButs(C, layout, op, NULL, '\0', layout_flags);
+ uiTemplateOperatorPropertyButs(C, layout, op, NULL, '\0', layout_flags);
UI_block_func_handle_set(block, ED_undo_operator_repeat_cb_evt, op);
}
}
@@ -3783,26 +3783,38 @@ void uiTemplateOperatorPropertyButs(
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;
+
if (!op->properties) {
IDPropertyTemplate val = {0};
op->properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
}
- if (flag & UI_TEMPLATE_OP_PROPS_SHOW_TITLE) {
- uiItemL(layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
+ can_repeat = WM_operator_repeat_check(C, op);
+ if (!can_repeat && (flag & UI_TEMPLATE_OP_PROPS_HIDE_UNSUPPORTED)) {
+ return;
+ }
+
+ if ((flag & UI_TEMPLATE_OP_PROPS_SHOW_REDO_BUT) == UI_TEMPLATE_OP_PROPS_SHOW_REDO_BUT) {
+ uiItemFullO(layout, "SCREEN_OT_repeat_last", op_title, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0);
+ }
+ else if (flag & UI_TEMPLATE_OP_PROPS_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
* 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 */
@@ -3811,7 +3823,7 @@ void uiTemplateOperatorPropertyButs(
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);
@@ -3840,7 +3852,7 @@ void uiTemplateOperatorPropertyButs(
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
/* main draw call */
- empty = uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0;
+ empty = uiDefAutoButsRNA(layout, &ptr, check_prop, label_align, (flag & UI_TEMPLATE_OP_PROPS_COMPACT)) == 0;
if (empty && (flag & UI_TEMPLATE_OP_PROPS_SHOW_EMPTY)) {
uiItemL(layout, IFACE_("No Properties"), ICON_NONE);
@@ -3852,12 +3864,10 @@ void uiTemplateOperatorPropertyButs(
* but this is not so important if this button is drawn in those cases
* (which isn't all that likely anyway) - campbell */
if (op->properties->len) {
- uiBlock *block;
uiBut *but;
uiLayout *col; /* needed to avoid alignment errors with previous buttons */
col = uiLayoutColumn(layout, false);
- block = uiLayoutGetBlock(col);
but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_FILE_REFRESH, IFACE_("Reset"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Reset operator defaults"));
UI_but_func_set(but, ui_layout_operator_buts__reset_cb, op, NULL);
@@ -3866,7 +3876,6 @@ void uiTemplateOperatorPropertyButs(
/* set various special settings for buttons */
{
- uiBlock *block = uiLayoutGetBlock(layout);
const bool is_popup = (block->flag & UI_BLOCK_KEEP_OPEN) != 0;
uiBut *but;
@@ -3886,6 +3895,10 @@ void uiTemplateOperatorPropertyButs(
}
}
}
+
+ if (flag & UI_TEMPLATE_OP_PROPS_SPLIT_A
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list