[Bf-blender-cvs] [983bcc66129] soc-2020-info-editor: Report filtering: use enum instead of separate bool properties

Mateusz Grzeliński noreply at git.blender.org
Fri Jul 31 12:51:11 CEST 2020


Commit: 983bcc66129ef30a304940a8fe7e60831544144c
Author: Mateusz Grzeliński
Date:   Fri Jul 31 12:36:03 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rB983bcc66129ef30a304940a8fe7e60831544144c

Report filtering: use enum instead of separate bool properties

Introduce new type for reporting unregistered operators

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

M	release/scripts/startup/bl_ui/space_info.py
M	source/blender/blenloader/intern/versioning_250.c
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/editors/space_info/info_draw.c
M	source/blender/editors/space_info/info_report.c
M	source/blender/editors/space_info/space_info.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_windowmanager_types.h
M	source/blender/makesdna/intern/dna_rename_defs.h
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_wm.c

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

diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index 9d6719f5b35..152bef10f92 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -140,12 +140,7 @@ class INFO_PT_report_type_visibility(Panel):
 
         layout.label(text="Report Types Visibility")
         col = layout.column(align=True)
-        col.prop(sinfo, "show_report_debug", text="Debug")
-        col.prop(sinfo, "show_report_info", text="Info")
-        col.prop(sinfo, "show_report_operator", text="Operator")
-        col.prop(sinfo, "show_report_warning", text="Warning")
-        col.prop(sinfo, "show_report_error", text="Error")
-        col.prop(sinfo, "show_report_property", text="Property")
+        col.prop(sinfo, "report_mask")
         layout.separator()
 
 
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index 4ba9712462f..cc10288a873 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -1859,7 +1859,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
             SpaceInfo *sinfo = (SpaceInfo *)sl;
             ARegion *region;
 
-            sinfo->report_mask_exclude = RPT_DEBUG_ALL;
+            sinfo->rpt_mask = RPT_MASK_DEFAULT;
 
             for (region = area->regionbase.first; region; region = region->next) {
               if (region->regiontype == RGN_TYPE_WINDOW) {
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 8b5d5ac5b21..04621e6fac9 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -178,7 +178,7 @@ static void blo_update_defaults_screen(bScreen *screen,
     }
     else if (area->spacetype == SPACE_INFO) {
       SpaceInfo *sinfo = area->spacedata.first;
-      sinfo->report_mask_exclude = RPT_DEBUG_ALL;
+      sinfo->rpt_mask = RPT_MASK_DEFAULT;
     }
     else if (area->spacetype == SPACE_TEXT) {
       /* Show syntax and line numbers in Script workspace text editor. */
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 7957e52ff32..2d17d708498 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -114,12 +114,12 @@ static enum eTextViewContext_LineFlag report_line_draw_data(TextViewContext *tvc
     icon_bg_id = TH_INFO_DEBUG;
     *r_icon = ICON_SYSTEM;
   }
-  else if (report->type & RPT_PROPERTY) {
+  else if (report->type & RPT_PROPERTY_ALL) {
     icon_fg_id = TH_INFO_PROPERTY_TEXT;
     icon_bg_id = TH_INFO_PROPERTY;
     *r_icon = ICON_OPTIONS;
   }
-  else if (report->type & RPT_OPERATOR) {
+  else if (report->type & RPT_OPERATOR_ALL) {
     icon_fg_id = TH_INFO_OPERATOR_TEXT;
     icon_bg_id = TH_INFO_OPERATOR;
     *r_icon = ICON_CHECKMARK;
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index 06894affa64..ab7195a3d4b 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -88,28 +88,7 @@ static void reports_select_all(ReportList *reports,
 
 int info_report_mask(const SpaceInfo *sinfo)
 {
-  int report_mask = 0;
-
-  if (!(sinfo->report_mask_exclude & INFO_RPT_DEBUG)) {
-    report_mask |= RPT_DEBUG_ALL;
-  }
-  if (!(sinfo->report_mask_exclude & INFO_RPT_INFO)) {
-    report_mask |= RPT_INFO_ALL;
-  }
-  if (!(sinfo->report_mask_exclude & INFO_RPT_OP)) {
-    report_mask |= RPT_OPERATOR_ALL;
-  }
-  if (!(sinfo->report_mask_exclude & INFO_RPT_WARN)) {
-    report_mask |= RPT_WARNING_ALL;
-  }
-  if (!(sinfo->report_mask_exclude & INFO_RPT_ERR)) {
-    report_mask |= RPT_ERROR_ALL;
-  }
-  if (!(sinfo->report_mask_exclude & INFO_RPT_PROP)) {
-    report_mask |= RPT_PROPERTY_ALL;
-  }
-
-  return report_mask;
+  return sinfo->rpt_mask;
 }
 
 // TODO, get this working again!
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 45379ae5782..eda2bd0221b 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -64,7 +64,7 @@ static SpaceLink *info_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen
   sinfo = MEM_callocN(sizeof(SpaceInfo), "initinfo");
   sinfo->spacetype = SPACE_INFO;
 
-  sinfo->report_mask_exclude = RPT_DEBUG_ALL;
+  sinfo->rpt_mask = RPT_MASK_DEFAULT;
 
   /* header */
   region = MEM_callocN(sizeof(ARegion), "header for info");
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 2b656011696..50da69d703f 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -112,8 +112,7 @@ typedef struct SpaceInfo {
   char _pad0[6];
   /* End 'SpaceLink' header. */
 
-  char report_mask_exclude;
-  char _pad[3];
+  int rpt_mask;
   int active_report_index;
   char search_string[64];
   char view;
@@ -134,16 +133,6 @@ typedef enum eSpaceInfo_ClogShow {
   // ...
 } eSpaceInfo_ClogShow;
 
-/* SpaceInfo.report_mask_exclude */
-typedef enum eSpaceInfo_RptMask {
-  INFO_RPT_DEBUG = (1 << 0),
-  INFO_RPT_INFO = (1 << 1),
-  INFO_RPT_OP = (1 << 2),
-  INFO_RPT_WARN = (1 << 3),
-  INFO_RPT_ERR = (1 << 4),
-  INFO_RPT_PROP = (1 << 5),
-} eSpaceInfo_RptMask;
-
 /** \} */
 
 /* -------------------------------------------------------------------- */
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 3c266bb8a44..537d0296ad1 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -68,15 +68,18 @@ typedef enum ReportType {
   RPT_ERROR_INVALID_INPUT = (1 << 6),
   RPT_ERROR_INVALID_CONTEXT = (1 << 7),
   RPT_ERROR_OUT_OF_MEMORY = (1 << 8),
+  RPT_OPERATOR_UNREGISTERED = (1 << 9),
 } ReportType;
 
 #define RPT_DEBUG_ALL (RPT_DEBUG)
 #define RPT_INFO_ALL (RPT_INFO)
-#define RPT_OPERATOR_ALL (RPT_OPERATOR)
+#define RPT_OPERATOR_ALL (RPT_OPERATOR | RPT_OPERATOR_UNREGISTERED)
 #define RPT_PROPERTY_ALL (RPT_PROPERTY)
 #define RPT_WARNING_ALL (RPT_WARNING)
 #define RPT_ERROR_ALL \
   (RPT_ERROR | RPT_ERROR_INVALID_INPUT | RPT_ERROR_INVALID_CONTEXT | RPT_ERROR_OUT_OF_MEMORY)
+#define RPT_MASK_DEFAULT \
+  RPT_ERROR_ALL | RPT_INFO_ALL | RPT_WARNING_ALL | RPT_PROPERTY_ALL | RPT_OPERATOR
 
 enum ReportListFlags {
   /* RPT_PRINT = (1 << 0), unused, replaced with logs */
diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h
index 87c73e7e112..a73fc747f84 100644
--- a/source/blender/makesdna/intern/dna_rename_defs.h
+++ b/source/blender/makesdna/intern/dna_rename_defs.h
@@ -88,7 +88,6 @@ DNA_STRUCT_RENAME_ELEM(Object, size, scale)
 DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_group, instance_collection)
 DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_ob, instance_object)
 DNA_STRUCT_RENAME_ELEM(ParticleSettings, dupliweights, instance_weights)
-DNA_STRUCT_RENAME_ELEM(SpaceInfo, rpt_mask, report_mask_exclude)
 DNA_STRUCT_RENAME_ELEM(Text, name, filepath)
 DNA_STRUCT_RENAME_ELEM(ThemeSpace, scrubbing_background, time_scrub_background)
 DNA_STRUCT_RENAME_ELEM(ThemeSpace, show_back_grad, background_type)
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 0a7fb5d3971..5a8e6544903 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -6004,41 +6004,12 @@ static void rna_def_space_info(BlenderRNA *brna)
   RNA_def_struct_sdna(srna, "SpaceInfo");
   RNA_def_struct_ui_text(srna, "Space Info", "Info space data");
 
-  /* reporting display */
-  prop = RNA_def_property(srna, "show_report_debug", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_negative_sdna(prop, NULL, "report_mask_exclude", INFO_RPT_DEBUG);
-  RNA_def_property_ui_text(prop, "Show Debug", "Display debug reporting info");
-  RNA_def_property_ui_icon(prop, ICON_SYSTEM, 0);
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
-
-  prop = RNA_def_property(srna, "show_report_info", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_negative_sdna(prop, NULL, "report_mask_exclude", INFO_RPT_INFO);
-  RNA_def_property_ui_text(prop, "Show Info", "Display general information");
-  RNA_def_property_ui_icon(prop, ICON_INFO, 0);
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
-
-  prop = RNA_def_property(srna, "show_report_operator", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_negative_sdna(prop, NULL, "report_mask_exclude", INFO_RPT_OP);
-  RNA_def_property_ui_text(prop, "Show Operator", "Display the operator log");
-  RNA_def_property_ui_icon(prop, ICON_CHECKMARK, 0);
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
-
-  prop = RNA_def_property(srna, "show_report_warning", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_negative_sdna(prop, NULL, "report_mask_exclude", INFO_RPT_WARN);
-  RNA_def_property_ui_text(prop, "Show Warn", "Display warnings");
-  RNA_def_property_ui_icon(prop, ICON_ERROR, 0);
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
-
-  prop = RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_negative_sdna(prop, NULL, "report_mask_exclude", INFO_RPT_ERR);
-  RNA_def_property_ui_text(prop, "Show Error", "Display error text");
-  RNA_def_property_ui_icon(prop, ICON_CANCEL, 0);
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
-
-  prop = RNA_def_property(srna, "show_report_property", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_negative_sdna(prop, NULL, "report_mask_exclude", INFO_RPT_PROP);
-  RNA_def_property_ui_text(prop, "Show Property", "Display property change");
-  RNA_def_property_ui_icon(prop, ICON_PROPERTIES, 0);
+  prop = RNA_def_property(srna, "report_mask", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(pro

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list