[Bf-blender-cvs] [f888f3aa1f3] master: Cleanup: Make panel function static

Hans Goudey noreply at git.blender.org
Wed Nov 4 22:55:03 CET 2020


Commit: f888f3aa1f3c3d2b9ef22fc96de3bda13d234be0
Author: Hans Goudey
Date:   Wed Nov 4 15:54:56 2020 -0600
Branches: master
https://developer.blender.org/rBf888f3aa1f3c3d2b9ef22fc96de3bda13d234be0

Cleanup: Make panel function static

These functions were not used elsewhere, and the handling for the panel
tabs should be kept local to this file where possible. Also remove
another unused function and removed an unecessary "_ex" function.

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_panel.c

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index c987a8ac13b..c5005f71218 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1708,16 +1708,9 @@ struct PanelCategoryStack *UI_panel_category_active_find(struct ARegion *region,
 const char *UI_panel_category_active_get(struct ARegion *region, bool set_fallback);
 void UI_panel_category_active_set(struct ARegion *region, const char *idname);
 void UI_panel_category_active_set_default(struct ARegion *region, const char *idname);
-struct PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(struct ARegion *region,
-                                                              const int x,
-                                                              const int y);
-struct PanelCategoryDyn *UI_panel_category_find_mouse_over(struct ARegion *region,
-                                                           const struct wmEvent *event);
 void UI_panel_category_clear_all(struct ARegion *region);
 void UI_panel_category_draw_all(struct ARegion *region, const char *category_id_active);
 
-struct PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname);
-
 /* Panel custom data. */
 struct PointerRNA *UI_panel_custom_data_get(const struct Panel *panel);
 struct PointerRNA *UI_region_panel_custom_data_under_cursor(const struct bContext *C,
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index d02cfdc8940..d9469981811 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -2305,10 +2305,10 @@ const char *UI_panel_category_active_get(ARegion *region, bool set_fallback)
   return NULL;
 }
 
-PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *region, const int x, const int y)
+static PanelCategoryDyn *panel_categories_find_mouse_over(ARegion *region, const wmEvent *event)
 {
   LISTBASE_FOREACH (PanelCategoryDyn *, ptd, &region->panels_category) {
-    if (BLI_rcti_isect_pt(&ptd->rect, x, y)) {
+    if (BLI_rcti_isect_pt(&ptd->rect, event->mval[0], event->mval[1])) {
       return ptd;
     }
   }
@@ -2316,11 +2316,6 @@ PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *region, const in
   return NULL;
 }
 
-PanelCategoryDyn *UI_panel_category_find_mouse_over(ARegion *region, const wmEvent *event)
-{
-  return UI_panel_category_find_mouse_over_ex(region, event->mval[0], event->mval[1]);
-}
-
 void UI_panel_category_add(ARegion *region, const char *name)
 {
   PanelCategoryDyn *pc_dyn = MEM_callocN(sizeof(*pc_dyn), __func__);
@@ -2416,7 +2411,7 @@ int ui_handler_panel_region(bContext *C,
   /* Handle category tabs. */
   if (UI_panel_category_is_visible(region)) {
     if (event->type == LEFTMOUSE) {
-      PanelCategoryDyn *pc_dyn = UI_panel_category_find_mouse_over(region, event);
+      PanelCategoryDyn *pc_dyn = panel_categories_find_mouse_over(region, event);
       if (pc_dyn) {
         UI_panel_category_active_set(region, pc_dyn->idname);
         ED_region_tag_redraw(region);
@@ -2670,16 +2665,4 @@ static void panel_activate_state(const bContext *C, Panel *panel, uiHandlePanelS
   ED_region_tag_redraw(region);
 }
 
-PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname)
-{
-  SpaceType *st = BKE_spacetype_from_id(space_id);
-  if (st) {
-    ARegionType *art = BKE_regiontype_from_id(st, region_id);
-    if (art) {
-      return BLI_findstring(&art->paneltypes, idname, offsetof(PanelType, idname));
-    }
-  }
-  return NULL;
-}
-
 /** \} */



More information about the Bf-blender-cvs mailing list