[Bf-blender-cvs] [2dc5d82ba8a] modifier-panels-ui: Merge branch 'master' into modifier-panels-ui

Hans Goudey noreply at git.blender.org
Sun Apr 5 15:45:02 CEST 2020


Commit: 2dc5d82ba8a02764ebee545153baf58923141787
Author: Hans Goudey
Date:   Sun Apr 5 08:44:54 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rB2dc5d82ba8a02764ebee545153baf58923141787

Merge branch 'master' into modifier-panels-ui

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



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

diff --cc source/blender/blenkernel/BKE_screen.h
index e1b981716ff,c49b6e27bba..788a9653c9f
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@@ -222,31 -222,12 +222,31 @@@ typedef struct PanelType 
    /* verify if the panel should draw or not */
    bool (*poll)(const struct bContext *C, struct PanelType *pt);
    /* draw header (optional) */
-   void (*draw_header)(const struct bContext *C, struct Panel *pa);
+   void (*draw_header)(const struct bContext *C, struct Panel *panel);
    /* draw header preset (optional) */
-   void (*draw_header_preset)(const struct bContext *C, struct Panel *pa);
+   void (*draw_header_preset)(const struct bContext *C, struct Panel *panel);
    /* draw entirely, view changes should be handled here */
-   void (*draw)(const struct bContext *C, struct Panel *pa);
+   void (*draw)(const struct bContext *C, struct Panel *panel);
  
 +  /* For recreate panels corresponding to a list. */
 +
 +  /** Reorder function, called when drag and drop finishes. */
 +  void (*re_order)(struct bContext *C, struct Panel *pa, int new_index);
 +  /**
 +   * Set the panel and subpanel's expansion state from the corresponding expansion flag. Called
 +   * on draw updates.
 +   * NOTE: Subpanels are indexed in depth first order, the visual order you would see if all panels
 +   * were expanded.
 +   */
 +  void (*set_expand_from_flag)(const struct bContext *C, struct Panel *pa);
 +  /**
 +   * Set the expand bitfield from the closed / open state of this panel and its subpanels. Called
 +   * when the expansion state of the panel changes by user input.
 +   * NOTE: Subpanels are indexed in depth first order, the visual order you would see if all panels
 +   * were expanded.
 +   */
 +  void (*set_expand_flag_from_panel)(const struct bContext *C, struct Panel *pa);
 +
    /* sub panels */
    struct PanelType *parent;
    ListBase children;
diff --cc source/blender/editors/include/UI_interface.h
index 7048233f584,eb134646649..7d43851c503
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@@ -1663,18 -1663,9 +1663,18 @@@ void UI_panel_end(const struct ScrArea 
                    int width,
                    int height,
                    bool open);
 +struct Panel *UI_panel_add_recreate(struct ScrArea *sa,
 +                                    struct ARegion *region,
 +                                    struct ListBase *panels,
 +                                    struct PanelType *panel_type,
 +                                    int modifier_index);
 +void UI_panel_set_list_index(struct Panel *panel, int i);
 +void UI_panel_delete(struct ListBase *panels, struct Panel *panel);
 +
 +void UI_panels_free_recreate(struct ListBase *panels);
  void UI_panels_scale(struct ARegion *region, float new_width);
  void UI_panel_label_offset(struct uiBlock *block, int *r_x, int *r_y);
- int UI_panel_size_y(const struct Panel *pa);
+ int UI_panel_size_y(const struct Panel *panel);
  
  bool UI_panel_category_is_visible(const struct ARegion *region);
  void UI_panel_category_add(struct ARegion *region, const char *name);
diff --cc source/blender/editors/interface/interface_panel.c
index 232a5611ebc,b3854cfc4ae..bca985dbcf4
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@@ -235,32 -234,7 +235,32 @@@ static bool panels_need_realign(ScrAre
  
  /****************************** panels ******************************/
  
 -static void panels_collapse_all(ScrArea *area, ARegion *region, const Panel *from_panel)
 +/**
 + * Call the callback to store the panel and subpanel expansion settings in the list item that
 + * corresponds to this panel.
 + *
 + * NOTE: This needs to iterate through all of the regions panels because that panel with changed
 + * expansion could have been the subpanel of a recreate panel and might not know about its
 + * corresponding list item.
 + */
 +static void set_list_panel_item_expansion_flag(const bContext *C, ARegion *region)
 +{
 +  LISTBASE_FOREACH (Panel *, panel, &region->panels) {
 +    PanelType *panel_type = panel->type;
 +    if (panel_type == NULL) {
 +      continue;
 +    }
 +
 +    if (panel->type->flag & PANELTYPE_RECREATE) {
 +      panel->type->set_expand_flag_from_panel(C, panel);
 +    }
 +  }
 +}
 +
 +static void panels_collapse_all(const bContext *C,
 +                                ScrArea *area,
 +                                ARegion *region,
-                                 const Panel *from_pa)
++                                const Panel *from_panel)
  {
    const bool has_category_tabs = UI_panel_category_is_visible(region);
    const char *category = has_category_tabs ? UI_panel_category_active_get(region, false) : NULL;
@@@ -1645,8 -1483,7 +1647,8 @@@ static void ui_panel_drag_collapse(bCon
      if (BLI_rctf_isect_segment(&rect, xy_a_block, xy_b_block)) {
        /* force panel to close */
        if (dragcol_data->was_first_open == true) {
-         pa->flag |= (is_horizontal ? PNL_CLOSEDX : PNL_CLOSEDY);
+         panel->flag |= (is_horizontal ? PNL_CLOSEDX : PNL_CLOSEDY);
 +        set_list_panel_item_expansion_flag(C, region);
        }
        /* force panel to open */
        else {
@@@ -2702,15 -2536,11 +2704,15 @@@ static void panel_activate_state(const 
    }
  
    if (state == PANEL_STATE_EXIT) {
 +    if (data->is_drag_drop) {
 +      reorder_recreate_panel_list(C, region, pa);
 +    }
 +
      MEM_freeN(data);
-     pa->activedata = NULL;
+     panel->activedata = NULL;
  
      WM_event_remove_ui_handler(
-         &win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa, false);
+         &win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, panel, false);
    }
    else {
      if (!data) {



More information about the Bf-blender-cvs mailing list