[Bf-blender-cvs] [d17e2e8101e] property-search-ui-v2: Merge branch 'master' into property-search-ui-v2

Hans Goudey noreply at git.blender.org
Wed Aug 26 16:24:40 CEST 2020


Commit: d17e2e8101e80d0a42bfc6ef13f5be01fa8124e7
Author: Hans Goudey
Date:   Tue Aug 25 22:24:28 2020 -0500
Branches: property-search-ui-v2
https://developer.blender.org/rBd17e2e8101e80d0a42bfc6ef13f5be01fa8124e7

Merge branch 'master' into property-search-ui-v2

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



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

diff --cc source/blender/editors/include/UI_interface.h
index 57b39eef867,1fa9ed0b2c0..c7a0510b3f6
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@@ -1711,11 -1702,8 +1711,10 @@@ struct PointerRNA *UI_region_panel_cust
                                                              const struct wmEvent *event);
  void UI_panel_custom_data_set(struct Panel *panel, struct PointerRNA *custom_data);
  
 +void UI_region_panels_remove_handlers(const struct bContext *C, struct ARegion *region);
 +
  /* Polyinstantiated panels for representing a list of data. */
- struct Panel *UI_panel_add_instanced(struct ScrArea *area,
-                                      struct ARegion *region,
+ struct Panel *UI_panel_add_instanced(struct ARegion *region,
                                       struct ListBase *panels,
                                       char *panel_idname,
                                       int list_index,
diff --cc source/blender/editors/interface/interface_intern.h
index 3f5c3b9a995,87be3745f87..3f3e93c9d0d
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@@ -806,13 -794,11 +806,13 @@@ extern int ui_handler_panel_region(stru
                                     const struct wmEvent *event,
                                     struct ARegion *region,
                                     const uiBut *active_but);
- extern void ui_draw_aligned_panel(struct uiStyle *style,
-                                   uiBlock *block,
+ extern void ui_draw_aligned_panel(const struct uiStyle *style,
+                                   const uiBlock *block,
                                    const rcti *rect,
                                    const bool show_pin,
 -                                  const bool show_background);
 +                                  const bool show_background,
 +                                  const bool region_search_filter_active);
 +void ui_panel_set_search_filter_match(struct Panel *panel, const bool value);
  
  /* interface_draw.c */
  extern void ui_draw_dropshadow(
diff --cc source/blender/editors/interface/interface_layout.c
index 62606fa2b95,8184962a54b..bb8dec520f6
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@@ -3266,42 -3186,29 +3266,42 @@@ uiPropertySplitWrapper uiItemPropertySp
    return split_wrapper;
  }
  
 -/*
 +/**
   * Helper to add a label and creates a property split layout if needed.
 + *
 + * \param r_layout: Returns a column to put decorators in if property separate is on, otherwise
 + * returns the original layout.
   */
 -uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int icon)
 +uiBut *uiItemL_respect_property_split(uiLayout *layout,
 +                                      const char *text,
 +                                      int icon,
 +                                      uiLayout **r_layout)
  {
 +  uiBut *label_but;
    if (layout->item.flag & UI_ITEM_PROP_SEP) {
      uiBlock *block = uiLayoutGetBlock(layout);
-     uiPropertySplitWrapper split_wrapper = uiItemPropertySplitWrapperCreate(layout);
+     const uiPropertySplitWrapper split_wrapper = uiItemPropertySplitWrapperCreate(layout);
      /* Further items added to 'layout' will automatically be added to split_wrapper.property_row */
  
 -    uiItemL_(split_wrapper.label_column, text, icon);
 +    label_but = uiItemL_(split_wrapper.label_column, text, icon);
      UI_block_layout_set_current(block, split_wrapper.property_row);
  
 -    return split_wrapper.decorate_column;
 +    if (r_layout != NULL) {
 +      *r_layout = split_wrapper.decorate_column;
 +    }
    }
 +  else {
 +    char namestr[UI_MAX_NAME_STR];
 +    if (text) {
 +      text = ui_item_name_add_colon(text, namestr);
 +    }
 +    label_but = uiItemL_(layout, text, icon);
  
 -  char namestr[UI_MAX_NAME_STR];
 -  if (text) {
 -    text = ui_item_name_add_colon(text, namestr);
 +    if (r_layout != NULL) {
 +      *r_layout = layout;
 +    }
    }
 -  uiItemL_(layout, text, icon);
 -
 -  return layout;
 +  return label_but;
  }
  
  void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon)
diff --cc source/blender/editors/interface/interface_panel.c
index fa2983d64a9,0b4bf0493f4..40f65f5c88e
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@@ -910,60 -839,43 +907,46 @@@ void UI_panel_label_offset(uiBlock *blo
    }
  }
  
- static void ui_draw_aligned_panel_header(uiStyle *style,
-                                          uiBlock *block,
+ static void ui_draw_aligned_panel_header(const uiStyle *style,
+                                          const uiBlock *block,
                                           const rcti *rect,
-                                          char dir,
 -                                         const bool show_background)
 +                                         const bool show_background,
 +                                         const bool region_search_filter_active)
  {
-   Panel *panel = block->panel;
-   rcti hrect;
-   int pnl_icons;
-   const char *activename = panel->drawname;
+   const Panel *panel = block->panel;
    const bool is_subpanel = (panel->type && panel->type->parent);
-   uiFontStyle *fontstyle = (is_subpanel) ? &style->widgetlabel : &style->paneltitle;
-   uchar col_title[4];
+   const uiFontStyle *fontstyle = (is_subpanel) ? &style->widgetlabel : &style->paneltitle;
  
    /* + 0.001f to avoid flirting with float inaccuracy */
-   pnl_icons = (panel->labelofs + (1.1f * PNL_ICON)) / block->aspect + 0.001f;
+   const int pnl_icons = (panel->labelofs + (1.1f * PNL_ICON)) / block->aspect + 0.001f;
  
    /* draw text label */
+   uchar col_title[4];
 -  panel_title_color_get(show_background, col_title);
 +  panel_title_color_get(
 +      panel, show_background, is_subpanel, region_search_filter_active, col_title);
    col_title[3] = 255;
  
-   hrect = *rect;
-   if (dir == 'h') {
-     hrect.xmin = rect->xmin + pnl_icons;
-     hrect.ymin -= 2.0f / block->aspect;
-     UI_fontstyle_draw(fontstyle,
-                       &hrect,
-                       activename,
-                       col_title,
-                       &(struct uiFontStyleDraw_Params){
-                           .align = UI_STYLE_TEXT_LEFT,
-                       });
-   }
-   else {
-     /* ignore 'pnl_icons', otherwise the text gets offset horizontally
-      * + 0.001f to avoid flirting with float inaccuracy
-      */
-     hrect.xmin = rect->xmin + (PNL_ICON + 5) / block->aspect + 0.001f;
-     UI_fontstyle_draw_rotated(fontstyle, &hrect, activename, col_title);
-   }
+   rcti hrect = *rect;
+   hrect.xmin = rect->xmin + pnl_icons;
+   hrect.ymin -= 2.0f / block->aspect;
+   UI_fontstyle_draw(fontstyle,
+                     &hrect,
+                     panel->drawname,
+                     col_title,
+                     &(struct uiFontStyleDraw_Params){
+                         .align = UI_STYLE_TEXT_LEFT,
+                     });
  }
  
  /* panel integrated in buttonswindow, tool/property lists etc */
- void ui_draw_aligned_panel(uiStyle *style,
-                            uiBlock *block,
+ void ui_draw_aligned_panel(const uiStyle *style,
+                            const uiBlock *block,
                             const rcti *rect,
                             const bool show_pin,
 -                           const bool show_background)
 +                           const bool show_background,
 +                           const bool region_search_filter_active)
  {
-   Panel *panel = block->panel;
-   rctf itemrect;
+   const Panel *panel = block->panel;
    float color[4];
    const bool is_subpanel = (panel->type && panel->type->parent);
    const bool show_drag = (!is_subpanel &&
@@@ -1080,8 -992,7 +1064,8 @@@
    if (is_subpanel) {
      titlerect.xmin += (0.7f * UI_UNIT_X) / block->aspect + 0.001f;
    }
 -  ui_draw_aligned_panel_header(style, block, &titlerect, show_background);
 +  ui_draw_aligned_panel_header(
-       style, block, &titlerect, 'h', show_background, region_search_filter_active);
++      style, block, &titlerect, show_background, region_search_filter_active);
  
    if (show_drag) {
      /* itemrect smaller */
@@@ -1166,20 -1078,16 +1151,16 @@@
      immUnbindProgram();
    }
  
-   uchar col_title[4];
-   panel_title_color_get(panel, show_background, false, region_search_filter_active, col_title);
- 
    /* draw collapse icon */
- 
-   /* itemrect smaller */
-   itemrect.xmin = titlerect.xmin;
-   itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&titlerect);
-   itemrect.ymin = titlerect.ymin;
-   itemrect.ymax = titlerect.ymax;
- 
-   BLI_rctf_scale(&itemrect, 0.25f);
- 
    {
+     rctf itemrect = {.xmin = titlerect.xmin,
+                      .xmax = itemrect.xmin + BLI_rcti_size_y(&titlerect),
+                      .ymin = titlerect.ymin,
+                      .ymax = titlerect.ymax};
+     BLI_rctf_scale(&itemrect, 0.25f);
+ 
+     uchar col_title[4];
 -    panel_title_color_get(show_background, col_title);
++    panel_title_color_get(panel, show_background, false, region_search_filter_active, col_title);
      float tria_color[4];
      rgb_uchar_to_float(tria_color, col_title);
      tria_color[3] = 1.0f;
diff --cc source/blender/makesdna/DNA_userdef_types.h
index 7f20b0c5f8f,ec46d2680ca..e75784bd0f8
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@@ -264,8 -264,6 +264,9 @@@ typedef struct ThemeSpace 
    /* note, cannot use name 'panel' because of DNA mapping old files */
    uiPanelColors panelcolors;
  
 +  unsigned char search_match_color[4];
++  char _pad2[4];
 +
    unsigned char shade1[4];
    unsigned char shade2[4];



More information about the Bf-blender-cvs mailing list