[Bf-blender-cvs] [dc0f41f] soc-2016-cycles_images: Stats Editor: * Add new notifier for the stats space type * Add logging_type DNA/RNA, which will be used to toggle between the different log types. We certainly will have more types here, this needs to be discussed further. For now we have Operators, Rendering and Depsgraph. * Add basic space stats notifier listener.

Thomas Dinges noreply at git.blender.org
Sun Aug 28 00:10:00 CEST 2016


Commit: dc0f41f71665743dabb428d3840c1a9529870b2d
Author: Thomas Dinges
Date:   Sun Aug 28 00:07:45 2016 +0200
Branches: soc-2016-cycles_images
https://developer.blender.org/rBdc0f41f71665743dabb428d3840c1a9529870b2d

Stats Editor:
* Add new notifier for the stats space type
* Add logging_type DNA/RNA, which will be used to toggle between the different log types. We certainly will have more types here, this needs to be discussed further. For now we have
Operators, Rendering and Depsgraph.
* Add basic space stats notifier listener.

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

M	release/scripts/startup/bl_ui/space_stats.py
M	source/blender/editors/space_stats/space_stats.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/windowmanager/WM_types.h

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

diff --git a/release/scripts/startup/bl_ui/space_stats.py b/release/scripts/startup/bl_ui/space_stats.py
index 72a4ae6..e8fb297 100644
--- a/release/scripts/startup/bl_ui/space_stats.py
+++ b/release/scripts/startup/bl_ui/space_stats.py
@@ -26,7 +26,14 @@ class LAYERS_HT_header(Header):
 
     def draw(self, context):
         layout = self.layout
+
+        space = context.space_data
+
         layout.template_header()
 
+        layout.separator()
+
+        layout.prop(space, "logging_type", expand=True)
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)
diff --git a/source/blender/editors/space_stats/space_stats.c b/source/blender/editors/space_stats/space_stats.c
index 8665966..bc79231 100644
--- a/source/blender/editors/space_stats/space_stats.c
+++ b/source/blender/editors/space_stats/space_stats.c
@@ -124,9 +124,16 @@ static void stats_header_region_draw(const bContext *C, ARegion *ar)
 	ED_region_header(C, ar);
 }
 
-static void stats_main_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
+static void stats_main_region_listener(bScreen *UNUSED(sc), ScrArea *sa, ARegion *UNUSED(ar), wmNotifier *wmn)
 {
-	/* context changes */
+	switch(wmn->category) {
+		case NC_SPACE: {
+			if (wmn->data == ND_SPACE_STATS) {
+				ED_area_tag_redraw(sa);
+			}
+			break;
+		}
+	}
 }
 
 /* only called once, from space/spacetypes.c */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index bdcd6a9..d990f88 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1339,9 +1339,15 @@ typedef struct SpaceStats {
 	SpaceLink *next, *prev;
 	ListBase regionbase;        /* storage of regions for inactive spaces */
 	int spacetype;
-	int pad;
+	int logging_type;
 } SpaceStats;
 
+typedef enum eSpaceStats_Logging_Type {
+	LOG_OPERATORS = 0,
+	LOG_RENDERING = 1,
+	LOG_DEPSGRAPH = 2,
+} eSpaceStats_Logging_Type;
+
 /* **************** SPACE DEFINES ********************* */
 
 /* space types, moved from DNA_screen_types.h */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 0028074..a422707 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -4741,10 +4741,23 @@ static void rna_def_space_clip(BlenderRNA *brna)
 static void rna_def_space_stats(BlenderRNA *brna)
 {
 	StructRNA *srna;
+	PropertyRNA *prop;
+
+	static EnumPropertyItem logging_display_items[] = {
+		{LOG_OPERATORS, "LOG_OPERATORS", ICON_POSE_DATA, "Operators", "Show operator logging output"},
+		{LOG_RENDERING,  "LOG_RENDERING", ICON_RENDER_STILL, "Rendering", "Show render logging output"},
+		{LOG_DEPSGRAPH, "LOG_DEPSGRAPH", ICON_SCENE_DATA, "Dependency Graph", "Show dependency graph logging output"},
+		{0, NULL, 0, NULL, NULL}
+	};
 
 	srna = RNA_def_struct(brna, "SpaceStatsEditor", "Space");
 	RNA_def_struct_sdna(srna, "SpaceStats");
 	RNA_def_struct_ui_text(srna, "Space Stats Editor", "Stats Editor space data");
+
+	prop = RNA_def_property(srna, "logging_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, logging_display_items);
+	RNA_def_property_ui_text(prop, "Logging Mode", "Display mode for logging list");
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_STATS, NULL);
 }
 
 
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 0fe3e8a..7fae061 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -361,7 +361,8 @@ typedef struct wmNotifier {
 #define ND_SPACE_NODE_VIEW		(17<<16)
 #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_FILE_PREVIEW	(20<<16)
+#define ND_SPACE_STATS			(21<<16)
 
 /* subtype, 256 entries too */
 #define NOTE_SUBTYPE		0x0000FF00




More information about the Bf-blender-cvs mailing list