[Bf-blender-cvs] [10d3fe3] soc-2016-cycles_images: Further work on the Statistics Editor.

Thomas Dinges noreply at git.blender.org
Fri Aug 26 00:17:54 CEST 2016


Commit: 10d3fe34ecdcc96e097eaeff8378d0793fecc8ea
Author: Thomas Dinges
Date:   Thu Aug 25 23:51:58 2016 +0200
Branches: soc-2016-cycles_images
https://developer.blender.org/rB10d3fe34ecdcc96e097eaeff8378d0793fecc8ea

Further work on the Statistics Editor.

* Fix drawing, now it at least draws a solid main area.
* Add empty UI py file.

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

M	release/scripts/startup/bl_ui/__init__.py
A	release/scripts/startup/bl_ui/space_stats.py
M	source/blender/editors/space_stats/CMakeLists.txt
M	source/blender/editors/space_stats/space_stats.c
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index 2389be6..d478e45 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -75,6 +75,7 @@ _modules = [
     "space_outliner",
     "space_properties",
     "space_sequencer",
+    "space_stats",
     "space_text",
     "space_time",
     "space_userpref",
diff --git a/release/scripts/startup/bl_ui/space_stats.py b/release/scripts/startup/bl_ui/space_stats.py
new file mode 100644
index 0000000..72a4ae6
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_stats.py
@@ -0,0 +1,32 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from bpy.types import Header, Menu
+
+
+class LAYERS_HT_header(Header):
+    bl_space_type = 'STATS'
+
+    def draw(self, context):
+        layout = self.layout
+        layout.template_header()
+
+if __name__ == "__main__":  # only for live edit.
+    bpy.utils.register_module(__name__)
diff --git a/source/blender/editors/space_stats/CMakeLists.txt b/source/blender/editors/space_stats/CMakeLists.txt
index d11156e..ff23513 100644
--- a/source/blender/editors/space_stats/CMakeLists.txt
+++ b/source/blender/editors/space_stats/CMakeLists.txt
@@ -22,10 +22,12 @@ set(INC
 	../include
 	../../blenkernel
 	../../blenlib
+	../../gpu
 	../../makesdna
 	../../makesrna
 	../../windowmanager
 	../../../../intern/guardedalloc
+	../../../../intern/glew-mx
 )
 
 set(INC_SYS
diff --git a/source/blender/editors/space_stats/space_stats.c b/source/blender/editors/space_stats/space_stats.c
index 3ebd321..8665966 100644
--- a/source/blender/editors/space_stats/space_stats.c
+++ b/source/blender/editors/space_stats/space_stats.c
@@ -26,6 +26,8 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BIF_gl.h"
+
 #include "BKE_context.h"
 #include "BKE_screen.h"
 
@@ -38,6 +40,10 @@
 #include "ED_screen.h"
 #include "ED_space_api.h"
 
+#include "UI_interface.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+
 #include "WM_types.h"
 
 
@@ -85,9 +91,26 @@ static void stats_main_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
 	ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
 }
 
-static void stats_main_region_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar))
+static void stats_main_region_draw(const bContext *C, ARegion *ar)
 {
-	printf("Look Sergey, it's an Editor!\n");
+	View2D *v2d = &ar->v2d;
+	float size_x = ar->winx;
+	float size_y = 0.0f;
+
+	UI_ThemeClearColor(TH_BACK);
+	glClear(GL_COLOR_BUFFER_BIT);
+
+	/* update size of tot-rect (extents of data/viewable area) */
+	UI_view2d_totRect_set(v2d, size_x, size_y);
+
+	/* reset view matrix */
+	UI_view2d_view_restore(C);
+
+	/* scrollers */
+	View2DScrollers *scrollers;
+	scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+	UI_view2d_scrollers_draw(C, v2d, scrollers);
+	UI_view2d_scrollers_free(scrollers);
 }
 
 /* add handlers, stuff you only do once or on area/region changes */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index d8c36cb..0028074 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -79,7 +79,7 @@ EnumPropertyItem rna_enum_space_type_items[] = {
 	{0, "", ICON_NONE, NULL, NULL},
 	{SPACE_BUTS, "PROPERTIES", ICON_BUTS, "Properties", "Edit properties of active object and related data-blocks"},
 	{SPACE_OUTLINER, "OUTLINER", ICON_OOPS, "Outliner", "Overview of scene graph and all available data-blocks"},
-	{SPACE_STATS, "STATS", ICON_OOPS, "Statistics", "Display various statistics and logs"},
+	{SPACE_STATS, "STATS", ICON_SCRIPT, "Statistics", "Display various statistics and logs"},
 	{SPACE_USERPREF, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences", "Edit persistent configuration settings"},
 	{SPACE_INFO, "INFO", ICON_INFO, "Info", "Main menu bar and list of error messages (drag down to expand and display)"},
 	{0, "", ICON_NONE, NULL, NULL},




More information about the Bf-blender-cvs mailing list