[Bf-blender-cvs] [cbe7143589a] filebrowser_redesign: Remove flag to disable categories per region-type

Julian Eisel noreply at git.blender.org
Sun Sep 1 14:05:13 CEST 2019


Commit: cbe7143589ae5147607625fff22084e05c2a4861
Author: Julian Eisel
Date:   Sun Sep 1 14:01:43 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rBcbe7143589ae5147607625fff22084e05c2a4861

Remove flag to disable categories per region-type

Just set a dummy bl_category to avoid warning prints.

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

M	release/scripts/startup/bl_ui/space_filebrowser.py
M	source/blender/blenkernel/BKE_screen.h
M	source/blender/editors/interface/interface_panel.c
M	source/blender/editors/space_file/space_file.c
M	source/blender/makesrna/intern/rna_ui.c

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

diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 888cef50301..e9c11301909 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -361,6 +361,7 @@ class FILEBROWSER_PT_directory_path(Panel):
     bl_space_type = 'FILE_BROWSER'
     bl_region_type = 'UI'
     bl_label = "Directory Path"
+    bl_category = "Attributes"
     bl_options = {'HIDE_HEADER'}
 
     def is_header_visible(self, context):
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 0f398393a24..a2ce522a895 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -177,8 +177,6 @@ typedef struct ARegionType {
   /* header type definitions */
   ListBase headertypes;
 
-  int flag;
-
   /* hardcoded constraints, smaller than these values region is not visible */
   int minsizex, minsizey;
   /* when new region opens (region prefsizex/y are zero then */
@@ -192,12 +190,6 @@ typedef struct ARegionType {
   short event_cursor;
 } ARegionType;
 
-/* ARegionType.flag */
-enum {
-  /** Never show category tabs in this region type. */
-  RGN_TYPE_FLAG_NO_CATEGORIES = (1 << 8),
-};
-
 /* panel types */
 
 typedef struct PanelType {
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 5f1f972ce1e..8adb82a22c8 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1977,9 +1977,6 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
   interp_v3_v3v3_uchar(
       theme_col_tab_highlight_inactive, theme_col_tab_inactive, theme_col_text_hi, 0.12f);
 
-  /* Should be handled on registration (don't register category if not supported in region). */
-  BLI_assert((ar->type->flag & RGN_TYPE_FLAG_NO_CATEGORIES) == 0);
-
   is_alpha = (ar->overlap && (theme_col_back[3] != 255));
 
   if (fstyle->kerning == 1) {
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index a3203d1b8fe..1befdd52d7d 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -690,7 +690,6 @@ void ED_spacetype_file(void)
   /* regions: ui */
   art = MEM_callocN(sizeof(ARegionType), "spacetype file region");
   art->regionid = RGN_TYPE_UI;
-  art->flag = RGN_TYPE_FLAG_NO_CATEGORIES;
   art->keymapflag = ED_KEYMAP_UI;
   art->listener = file_ui_region_listener;
   art->init = file_ui_region_init;
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 8c66d40342e..a7f0c8ff19c 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -269,20 +269,7 @@ static StructRNA *rna_Panel_register(Main *bmain,
     return NULL;
   }
 
-  if (!(art = region_type_find(reports, dummypt.space_type, dummypt.region_type))) {
-    return NULL;
-  }
-
-  if (art->flag & RGN_TYPE_FLAG_NO_CATEGORIES) {
-    /* Skip category registration if region doesn't allow categories. */
-#  ifndef NDEBUG
-    if (dummypt.category[0] != '\0') {
-      printf("Category '%s' can't be registered, category tabs are disabled for this region.",
-             dummypt.category);
-    }
-#  endif
-  }
-  else if ((1 << dummypt.region_type) & RGN_TYPE_HAS_CATEGORY_MASK) {
+  if ((1 << dummypt.region_type) & RGN_TYPE_HAS_CATEGORY_MASK) {
     if (dummypt.category[0] == '\0') {
       /* Use a fallback, otherwise an empty value will draw the panel in every category. */
       strcpy(dummypt.category, PNL_CATEGORY_FALLBACK);
@@ -305,6 +292,10 @@ static StructRNA *rna_Panel_register(Main *bmain,
     }
   }
 
+  if (!(art = region_type_find(reports, dummypt.space_type, dummypt.region_type))) {
+    return NULL;
+  }
+
   /* check if we have registered this panel type before, and remove it */
   for (pt = art->paneltypes.first; pt; pt = pt->next) {
     if (STREQ(pt->idname, dummypt.idname)) {



More information about the Bf-blender-cvs mailing list