[Bf-blender-cvs] [a00890d] soc-2016-cycles_images: Initial commit for new Statistics Editor.

Thomas Dinges noreply at git.blender.org
Fri Aug 19 23:16:02 CEST 2016


Commit: a00890deb70da2b8cf85569f793bd5b82e80119c
Author: Thomas Dinges
Date:   Fri Aug 19 23:15:23 2016 +0200
Branches: soc-2016-cycles_images
https://developer.blender.org/rBa00890deb70da2b8cf85569f793bd5b82e80119c

Initial commit for new Statistics Editor.

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

M	build_files/cmake/macros.cmake
M	source/blender/blenkernel/BKE_context.h
M	source/blender/blenkernel/intern/context.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/editors/CMakeLists.txt
M	source/blender/editors/include/ED_space_api.h
M	source/blender/editors/interface/resources.c
M	source/blender/editors/space_api/spacetypes.c
A	source/blender/editors/space_stats/CMakeLists.txt
A	source/blender/editors/space_stats/space_stats.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/python/intern/bpy_rna_callback.c

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

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index c4e1c56..78ae27f 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -568,6 +568,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
 		bf_editor_space_userpref
 		bf_editor_space_view3d
 		bf_editor_space_clip
+		bf_editor_space_stats
 
 		bf_editor_transform
 		bf_editor_util
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 4da6a61..cb1bc9b 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -166,6 +166,7 @@ struct SpaceAction *CTX_wm_space_action(const bContext *C);
 struct SpaceInfo *CTX_wm_space_info(const bContext *C);
 struct SpaceUserPref *CTX_wm_space_userpref(const bContext *C);
 struct SpaceClip *CTX_wm_space_clip(const bContext *C);
+struct SpaceStats *CTX_wm_space_stats(const bContext *C);
 
 void CTX_wm_manager_set(bContext *C, struct wmWindowManager *wm);
 void CTX_wm_window_set(bContext *C, struct wmWindow *win);
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 926ca8d..d324e9f 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -813,6 +813,14 @@ struct SpaceClip *CTX_wm_space_clip(const bContext *C)
 	return NULL;
 }
 
+struct SpaceStats *CTX_wm_space_stats(const bContext *C)
+{
+	ScrArea *sa = CTX_wm_area(C);
+	if (sa && sa->spacetype == SPACE_STATS)
+		return sa->spacedata.first;
+	return NULL;
+}
+
 void CTX_wm_manager_set(bContext *C, wmWindowManager *wm)
 {
 	C->wm.manager = wm;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index b6a5471..a74bd3b 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -3157,6 +3157,9 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
 				else if (sl->spacetype == SPACE_INFO) {
 					writestruct(wd, DATA, SpaceInfo, 1, sl);
 				}
+				else if (sl->spacetype == SPACE_STATS) {
+					writestruct(wd, DATA, SpaceStats, 1, sl);
+				}
 
 				sl = sl->next;
 			}
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 1559512..985bbf5 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -53,6 +53,7 @@ if(WITH_BLENDER)
 	add_subdirectory(space_outliner)
 	add_subdirectory(space_script)
 	add_subdirectory(space_sequencer)
+	add_subdirectory(space_stats)
 	add_subdirectory(space_text)
 	add_subdirectory(space_time)
 	add_subdirectory(space_userpref)
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index d268c57..064bee3 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -58,6 +58,7 @@ void ED_spacetype_logic(void);
 void ED_spacetype_console(void);
 void ED_spacetype_userpref(void);
 void ED_spacetype_clip(void);
+void ED_spacetype_stats(void);
 
 /* calls for instancing and freeing spacetype static data 
  * called in WM_init_exit */
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index c8ff335..943e635 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -165,6 +165,9 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
 				case SPACE_CLIP:
 					ts = &btheme->tclip;
 					break;
+				case SPACE_STATS:
+					ts = &btheme->tstats;
+					break;
 				default:
 					ts = &btheme->tv3d;
 					break;
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index ac6e312..7be2d0d 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -96,6 +96,7 @@ void ED_spacetypes_init(void)
 	ED_spacetype_console();
 	ED_spacetype_userpref();
 	ED_spacetype_clip();
+	ED_spacetype_stats();
 //	...
 	
 	/* register operator types for screen and all spaces */
diff --git a/source/blender/editors/space_stats/CMakeLists.txt b/source/blender/editors/space_stats/CMakeLists.txt
new file mode 100644
index 0000000..e34b7e6
--- /dev/null
+++ b/source/blender/editors/space_stats/CMakeLists.txt
@@ -0,0 +1,39 @@
+# ***** 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.
+#
+# Contributor(s): Jacques Beaurain.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC
+    ../include
+    ../../blenkernel
+    ../../blenlib
+    ../../makesdna
+    ../../makesrna
+    ../../windowmanager
+    ../../../../intern/guardedalloc
+)
+
+set(INC_SYS
+
+)
+
+set(SRC
+    space_stats.c
+)
+
+blender_add_lib(bf_editor_space_stats "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_stats/space_stats.c b/source/blender/editors/space_stats/space_stats.c
new file mode 100644
index 0000000..fc8480c
--- /dev/null
+++ b/source/blender/editors/space_stats/space_stats.c
@@ -0,0 +1,140 @@
+/*
+ * ***** 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 *****
+ */
+
+/** \file blender/editors/space_stats/space_stats.c
+ *  \ingroup splayers
+ */
+
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BKE_context.h"
+#include "BKE_screen.h"
+
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_space_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "ED_screen.h"
+#include "ED_space_api.h"
+
+#include "WM_types.h"
+
+
+/* ******************** default callbacks for stats editor space ***************** */
+
+static SpaceLink *stats_new(const bContext *UNUSED(C))
+{
+    ARegion *ar;
+    SpaceStats *sstats;
+
+    sstats = MEM_callocN(sizeof(SpaceStats), __func__);
+    sstats->spacetype = SPACE_STATS;
+
+    /* header */
+    ar = MEM_callocN(sizeof(ARegion), "header for stats editor");
+
+    BLI_addtail(&sstats->regionbase, ar);
+    ar->regiontype = RGN_TYPE_HEADER;
+    ar->alignment = RGN_ALIGN_BOTTOM;
+
+    /* main region */
+    ar = MEM_callocN(sizeof(ARegion), "main region for stats editor");
+
+    BLI_addtail(&sstats->regionbase, ar);
+    ar->regiontype = RGN_TYPE_WINDOW;
+
+    return (SpaceLink *)sstats;
+}
+
+static SpaceLink *stats_duplicate(SpaceLink *sl)
+{
+    SpaceStats *sstats = MEM_dupallocN(sl);
+
+    /* clear or remove stuff from old */
+
+    return (SpaceLink *)sstats;
+}
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void stats_main_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+{
+    /* do not use here, the properties changed in userprefs do a system-wide refresh, then scroller jumps back */
+    /*    ar->v2d.flag &= ~V2D_IS_INITIALISED; */
+
+    ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
+}
+
+static void stats_main_region_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar))
+{
+    printf("Look Sergey, it's an Editor!\n");
+}
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void stats_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+{
+    ED_region_header_init(ar);
+}
+
+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))
+{
+    /* context changes */
+}
+
+/* only called once, from space/spacetypes.c */
+void ED_spacetype_stats(void)
+{
+    SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype stats");
+    ARegionType *art;
+
+    st->spaceid = SPACE_STATS;
+    strncpy(st->name, "StatsEditor", BKE_ST_MAXNAME);
+
+    st->new = stats_new;
+    st->duplicate = stats_duplicate;
+
+    /* regions: main window */
+    art = MEM_callocN(sizeof(ARegionType), "stats editor region");
+    art->regionid = RGN_TYPE_WINDOW;
+    art->init = stats_main_region_init;
+    art->draw = stats_main_region_draw;
+    art->listener = stats_main_region_listener;
+    art->keymapflag = ED_KEYMAP_UI;
+    BLI_addhead(&st->regiontypes, art);
+
+    /* regions: header */
+    art = MEM_callocN(sizeof(ARegionType), "spacetype stats header");
+    art->regionid = RGN_TYPE_HEADER;
+    art->prefsizey = HEADERY;
+    art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
+    art->init = stats_header_region_init;
+    art->draw = stats_header_region_draw;
+    BLI_addhead(&st->regiontypes, art);
+
+    BKE_spacetype_register(st);
+}
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 41188c2..f1417e3 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1333,6 +1333,15

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list