Commit: b6223890124971142266f52a796f493fc2e60ee0
Author: Mateusz Grzeliński
Date:   Tue Aug 18 13:17:16 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rBb6223890124971142266f52a796f493fc2e60ee0

Cleanup: redraw info editor only when needed

Introduce ND_SPACE_INFO_CLOG tag.

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

M       source/blender/editors/space_info/space_info.c
M       source/blender/makesrna/intern/rna_space.c
M       source/blender/windowmanager/WM_types.h
M       source/creator/creator.c

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

diff --git a/source/blender/editors/space_info/space_info.c 
b/source/blender/editors/space_info/space_info.c
index 8edc90be59e..04fa469b586 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -252,17 +252,24 @@ static void info_header_region_draw(const bContext *C, 
ARegion *region)
 }
 
 static void info_main_region_listener(wmWindow *UNUSED(win),
-                                      ScrArea *UNUSED(area),
+                                      ScrArea *area,
                                       ARegion *region,
                                       wmNotifier *wmn,
                                       const Scene *UNUSED(scene))
 {
+  SpaceInfo *sinfo = area->spacedata.first;
   /* context changes */
   switch (wmn->category) {
     case NC_SPACE:
-      if (wmn->data == ND_SPACE_INFO_REPORT) {
+      if (wmn->data == ND_SPACE_INFO_REPORT && (sinfo->view == 
INFO_VIEW_REPORTS)) {
+        /* redraw also but only for report view, could do less redraws by 
checking the type */
+        ED_region_tag_redraw(region);
+        break;
+      }
+      if (wmn->data == ND_SPACE_INFO_CLOG && (sinfo->view == INFO_VIEW_CLOG)) {
         /* redraw also but only for report view, could do less redraws by 
checking the type */
         ED_region_tag_redraw(region);
+        break;
       }
       break;
   }
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 066d020514d..dcda14c8322 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -6122,27 +6122,27 @@ static void rna_def_space_info(BlenderRNA *brna)
   RNA_def_property_flag(prop, PROP_ENUM_FLAG);
   RNA_def_property_enum_default(prop, INFO_CLOG_SEVERITY_MASK_ALL);
   RNA_def_property_ui_text(prop, "Filter Log Severity", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "use_log_level_filter", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "use_log_filter", 
INFO_FILTER_CLOG_LEVEL);
   RNA_def_property_ui_text(prop, "Use Log Level Filter", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "use_log_file_line_filter", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "use_log_filter", 
INFO_FILTER_CLOG_FILE_LINE);
   RNA_def_property_ui_text(prop, "Use Log File Line Filter", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "use_log_type_filter", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "use_log_filter", 
INFO_FILTER_CLOG_TYPE);
   RNA_def_property_ui_text(prop, "Use Log Type Filter", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "use_log_function_filter", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "use_log_filter", 
INFO_FILTER_CLOG_FUNCTION);
   RNA_def_property_ui_text(prop, "Use Log Function Filter", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   rna_def_space_info_filter(brna);
 
@@ -6150,30 +6150,30 @@ static void rna_def_space_info(BlenderRNA *brna)
   RNA_def_property_pointer_sdna(prop, NULL, "search_filter");
   RNA_def_property_struct_type(prop, "SpaceInfoFilter");
   RNA_def_property_ui_text(prop, "General Search", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT | 
ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "filter_log_file_line", PROP_COLLECTION, 
PROP_NONE);
   RNA_def_property_collection_sdna(prop, NULL, "filter_log_file_line", NULL);
   RNA_def_property_struct_type(prop, "SpaceInfoFilter");
   RNA_def_property_ui_text(prop, "Log File Line Filter", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "filter_log_type", PROP_COLLECTION, PROP_NONE);
   RNA_def_property_collection_sdna(prop, NULL, "filter_log_type", NULL);
   RNA_def_property_struct_type(prop, "SpaceInfoFilter");
   RNA_def_property_ui_text(prop, "Log File Line Filter", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "filter_log_function", PROP_COLLECTION, 
PROP_NONE);
   RNA_def_property_collection_sdna(prop, NULL, "filter_log_function", NULL);
   RNA_def_property_struct_type(prop, "SpaceInfoFilter");
   RNA_def_property_ui_text(prop, "Log File Line Filter", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "filter_log_level", PROP_INT, PROP_NONE);
   RNA_def_property_int_sdna(prop, NULL, "filter_log_level");
   RNA_def_property_ui_text(prop, "Filter Log Level", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   static const EnumPropertyItem rna_enum_log_format_items[] = {
       {INFO_CLOG_SHOW_TIMESTAMP, "SHOW_TIMESTAMP", 0, "Show Timestamp", ""},
@@ -6189,17 +6189,17 @@ static void rna_def_space_info(BlenderRNA *brna)
   RNA_def_property_enum_items(prop, rna_enum_log_format_items);
   RNA_def_property_ui_text(prop, "Log Printing format", "");
   RNA_def_property_flag(prop, PROP_ENUM_FLAG);
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "use_log_message_new_line", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "log_format", 
INFO_CLOG_USE_MESSAGE_NEW_LINE);
   RNA_def_property_ui_text(prop, "Print Log Message In New Line", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "use_short_file_line", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "log_format", 
INFO_CLOG_USE_SHORT_FILTE_LINE);
   RNA_def_property_ui_text(prop, "Shorten File Path", "");
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
 
   static const EnumPropertyItem rna_enum_view_type_items[] = {
       {INFO_VIEW_REPORTS, "REPORTS", 0, "Reports", ""},
@@ -6211,11 +6211,13 @@ static void rna_def_space_info(BlenderRNA *brna)
   RNA_def_property_enum_items(prop, rna_enum_view_type_items);
   RNA_def_property_ui_text(prop, "View reports or logs", "");
   RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
-  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, NULL);
+  RNA_def_property_update(
+      prop, NC_SPACE | ND_SPACE_INFO | ND_SPACE_INFO_REPORT | 
ND_SPACE_INFO_CLOG, NULL);
 
   prop = RNA_def_property(srna, "use_autoscroll", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "view_options", 
INFO_VIEW_USE_AUTOSCROLL);
   RNA_def_property_ui_text(prop, "Use Autoscroll", "");
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, NULL);
 }
 
 static void rna_def_space_userpref(BlenderRNA *brna)
diff --git a/source/blender/windowmanager/WM_types.h 
b/source/blender/windowmanager/WM_types.h
index 7d7c9edc241..e46e189910a 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -419,6 +419,7 @@ typedef struct wmNotifier {
 #define ND_SPACE_CHANGED (18 << 16) /*sent to a new editor type after it's 
replaced an old one*/
 #define ND_SPACE_CLIP (19 << 16)
 #define ND_SPACE_FILE_PREVIEW (20 << 16)
+#define ND_SPACE_INFO_CLOG (21 << 16)
 
 /* subtype, 256 entries too */
 #define NOTE_SUBTYPE 0x0000FF00
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 45c4f8b7842..ebdc3606ba2 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -85,8 +85,8 @@
 #  include "FRS_freestyle.h"
 #endif
 
-#include <signal.h>
 #include <WM_types.h>
+#include <signal.h>
 
 #ifdef __FreeBSD__
 #  include <floatingpoint.h>
@@ -191,7 +191,7 @@ static void callback_clg_log_write_fn(const CLG_LogType *lg,
                                       const char *fn,
                                       const char *message)
 {
-  WM_main_add_notifier(NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+  WM_main_add_notifier(NC_SPACE | ND_SPACE_INFO_CLOG, NULL);
   CLG_log_write_callback_default(lg, severity, verbosity, file_line, fn, 
message);
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to