[Bf-blender-cvs] [45a954a8587] temp-checkbox-layout-tweaks: Merge branch 'master' into temp-checkbox-layout-tweaks

Julian Eisel noreply at git.blender.org
Tue Apr 14 16:33:19 CEST 2020


Commit: 45a954a8587d29526ebddc6b6b90260ea9c03a30
Author: Julian Eisel
Date:   Tue Apr 14 16:32:32 2020 +0200
Branches: temp-checkbox-layout-tweaks
https://developer.blender.org/rB45a954a8587d29526ebddc6b6b90260ea9c03a30

Merge branch 'master' into temp-checkbox-layout-tweaks

===================================================================



===================================================================

diff --cc source/blender/editors/interface/interface_templates.c
index 146404f984e,1c1d7b8c766..1486560ca95
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@@ -7556,8 -7338,191 +7568,10 @@@ void uiTemplateMenuSearch(uiLayout *lay
    UI_but_func_menu_search(but);
  }
  
+ #undef MENU_SEP
+ 
  /** \} */
  
 -/* -------------------------------------------------------------------- */
 -/** \name Operator Redo Properties Template
 - * \{ */
 -
 -#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
 -
 -struct uiTemplateOperatorPropertyPollParam {
 -  const bContext *C;
 -  wmOperator *op;
 -  short flag;
 -};
 -
 -static bool ui_layout_operator_buts_poll_property(struct PointerRNA *UNUSED(ptr),
 -                                                  struct PropertyRNA *prop,
 -                                                  void *user_data)
 -{
 -  struct uiTemplateOperatorPropertyPollParam *params = user_data;
 -  if ((params->flag & UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED) &&
 -      (RNA_property_tags(prop) & OP_PROP_TAG_ADVANCED)) {
 -    return false;
 -  }
 -  return params->op->type->poll_property(params->C, params->op, prop);
 -}
 -
 -/**
 - * Draw Operator property buttons for redoing execution with different settings.
 - * This function does not initialize the layout,
 - * functions can be called on the layout before and after.
 - */
 -eAutoPropButsReturn uiTemplateOperatorPropertyButs(const bContext *C,
 -                                                   uiLayout *layout,
 -                                                   wmOperator *op,
 -                                                   const eButLabelAlign label_align,
 -                                                   const short flag)
 -{
 -  uiBlock *block = uiLayoutGetBlock(layout);
 -  eAutoPropButsReturn return_info = 0;
 -
 -  if (!op->properties) {
 -    IDPropertyTemplate val = {0};
 -    op->properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
 -  }
 -
 -  /* 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");
 -    return return_info;
 -  }
 -  else {
 -    /* useful for macros where only one of the steps can't be re-done */
 -    UI_block_lock_clear(block);
 -  }
 -
 -  if (flag & UI_TEMPLATE_OP_PROPS_SHOW_TITLE) {
 -    uiItemL(layout, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
 -  }
 -
 -  /* 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, "WM_MT_operator_presets", NULL, ICON_NONE);
 -
 -    wmOperatorType *ot = WM_operatortype_find("WM_OT_operator_preset_add", false);
 -    uiItemFullO_ptr(row, ot, "", ICON_ADD, NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
 -    RNA_string_set(&op_ptr, "operator", op->type->idname);
 -
 -    uiItemFullO_ptr(row, ot, "", ICON_REMOVE, NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
 -    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. return_info is ignored too. We could
 -     * allow ot.ui callback to return this, but not needed right now. */
 -  }
 -  else {
 -    wmWindowManager *wm = CTX_wm_manager(C);
 -    PointerRNA ptr;
 -    struct uiTemplateOperatorPropertyPollParam user_data = {
 -        .C = C,
 -        .op = op,
 -        .flag = flag,
 -    };
 -
 -    RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
 -
 -    uiLayoutSetPropSep(layout, true);
 -    uiLayoutSetPropDecorate(layout, false);
 -
 -    /* main draw call */
 -    return_info = uiDefAutoButsRNA(
 -        layout,
 -        &ptr,
 -        op->type->poll_property ? ui_layout_operator_buts_poll_property : NULL,
 -        op->type->poll_property ? &user_data : NULL,
 -        op->type->prop,
 -        label_align,
 -        (flag & UI_TEMPLATE_OP_PROPS_COMPACT));
 -
 -    if ((return_info & UI_PROP_BUTS_NONE_ADDED) && (flag & UI_TEMPLATE_OP_PROPS_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) {
 -    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 */
 -
 -  /* Only do this if we're not refreshing an existing UI. */
 -  if (block->oldblock == NULL) {
 -    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);
 -        }
 -      }
 -    }
 -  }
 -
 -  return return_info;
 -}
 -
 -/** \} */
 -
  /* -------------------------------------------------------------------- */
  /** \name Running Jobs Template
   * \{ */



More information about the Bf-blender-cvs mailing list