Commit: 80314489f5e5011132acc0275e0b49a83705a944
Author: Brecht Van Lommel
Date:   Fri Jul 20 12:33:20 2018 +0200
Branches: temp-benchmark
https://developer.blender.org/rB80314489f5e5011132acc0275e0b49a83705a944

Benchmark: add space type for drawing benchmark in.

Once we have custom space types, this could be removed. For now all code
is in a branch so some hacks don't matter too much.

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

M       build_files/cmake/macros.cmake
M       release/datafiles/userdef/userdef_default_theme.c
M       release/scripts/startup/bl_ui/__init__.py
A       release/scripts/startup/bl_ui/space_benchmark.py
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_benchmark/CMakeLists.txt
A       source/blender/editors/space_benchmark/space_benchmark.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/makesrna/intern/rna_userdef.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 65f962d2dd9..5f2abb76e0e 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -574,6 +574,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
 
                bf_editor_space_api
                bf_editor_space_action
+               bf_editor_space_benchmark
                bf_editor_space_buttons
                bf_editor_space_console
                bf_editor_space_file
diff --git a/release/datafiles/userdef/userdef_default_theme.c 
b/release/datafiles/userdef/userdef_default_theme.c
index 69ad58ea1c5..882b6d4f91c 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -939,6 +939,31 @@ const bTheme U_theme_default = {
                .facedot_size = 4,
                .gp_vertex_size = 3,
        },
+       .tbenchmark = {
+               .back = RGBA(0x42424200),
+               .title = RGBA(0xd4d4d4ff),
+               .text = RGBA(0xe5e5e5ff),
+               .text_hi = RGBA(0xffffffff),
+               .header = RGBA(0x424242ff),
+               .header_text = RGBA(0xeeeeeeff),
+               .header_text_hi = RGBA(0xffffffff),
+               .tab_active = RGBA(0x5680c2ff),
+               .tab_inactive = RGBA(0x424242ff),
+               .tab_back = RGBA(0x232323ff),
+               .tab_outline = RGBA(0x2d2d2dff),
+               .button = RGBA(0x424242ff),
+               .button_title = RGBA(0xffffffff),
+               .button_text = RGBA(0xe5e5e5ff),
+               .button_text_hi = RGBA(0xffffffff),
+               .panelcolors = {
+                       .header = RGBA(0x42424200),
+                       .back = RGBA(0x00000028),
+                       .sub_back = RGBA(0x00000024),
+               },
+               .vertex_size = 3,
+               .outline_width = 1,
+               .facedot_size = 4,
+       },
        .tarm = {
                {
                        .solid = RGBA(0x9a0000ff),
diff --git a/release/scripts/startup/bl_ui/__init__.py 
b/release/scripts/startup/bl_ui/__init__.py
index 89aed37f055..b21e702a99d 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -72,6 +72,7 @@ _modules = [
     "space_toolsystem_common",
     "space_toolsystem_toolbar",
 
+    "space_benchmark",
     "space_clip",
     "space_console",
     "space_dopesheet",
diff --git a/release/scripts/startup/bl_ui/space_benchmark.py 
b/release/scripts/startup/bl_ui/space_benchmark.py
new file mode 100644
index 00000000000..b8e47804e80
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_benchmark.py
@@ -0,0 +1,28 @@
+# ##### 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
+
+classes = (
+)
+
+if __name__ == "__main__":  # only for live edit.
+    from bpy.utils import register_class
+    for cls in classes:
+        register_class(cls)
diff --git a/source/blender/blenloader/intern/writefile.c 
b/source/blender/blenloader/intern/writefile.c
index 3883e024ab7..e32f0732906 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2952,6 +2952,9 @@ static void write_area_regions(WriteData *wd, ScrArea 
*area)
                else if (sl->spacetype == SPACE_INFO) {
                        writestruct(wd, DATA, SpaceInfo, 1, sl);
                }
+               else if (sl->spacetype == SPACE_BENCHMARK) {
+                       writestruct(wd, DATA, SpaceBenchmark, 1, sl);
+               }
        }
 }
 
diff --git a/source/blender/editors/CMakeLists.txt 
b/source/blender/editors/CMakeLists.txt
index cf1db751c85..d45f0548037 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -42,6 +42,7 @@ if(WITH_BLENDER)
        add_subdirectory(sound)
        add_subdirectory(space_action)
        add_subdirectory(space_api)
+       add_subdirectory(space_benchmark)
        add_subdirectory(space_buttons)
        add_subdirectory(space_clip)
        add_subdirectory(space_console)
diff --git a/source/blender/editors/include/ED_space_api.h 
b/source/blender/editors/include/ED_space_api.h
index ddd8b59c264..f5e6a3e68ae 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -59,6 +59,7 @@ void ED_spacetype_userpref(void);
 void ED_spacetype_clip(void);
 void ED_spacetype_statusbar(void);
 void ED_spacetype_topbar(void);
+void ED_spacetype_benchmark(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 72023ebf2ae..b8dd9b085d5 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -175,6 +175,9 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, 
int spacetype, int colo
                                case SPACE_STATUSBAR:
                                        ts = &btheme->tstatusbar;
                                        break;
+                               case SPACE_BENCHMARK:
+                                       ts = &btheme->tbenchmark;
+                                       break;
                                default:
                                        ts = &btheme->tv3d;
                                        break;
@@ -1586,6 +1589,16 @@ void init_userdef_do_versions(Main *bmain)
                }
        }
 
+       if (!USER_VERSION_ATLEAST(280, 16)) {
+               for (bTheme *btheme = U.themes.first; btheme; btheme = 
btheme->next) {
+                       btheme->tstatusbar = btheme->tv3d;
+               }
+       }
+
+       for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
+               btheme->tbenchmark = btheme->tima;
+       }
+
        /**
         * Include next version bump.
         */
diff --git a/source/blender/editors/space_api/spacetypes.c 
b/source/blender/editors/space_api/spacetypes.c
index 7246812dc82..70803993d21 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -99,6 +99,7 @@ void ED_spacetypes_init(void)
        ED_spacetype_clip();
        ED_spacetype_statusbar();
        ED_spacetype_topbar();
+       ED_spacetype_benchmark();
 //     ...
 
        /* register operator types for screen and all spaces */
diff --git a/source/blender/editors/space_benchmark/CMakeLists.txt 
b/source/blender/editors/space_benchmark/CMakeLists.txt
new file mode 100644
index 00000000000..e820415f5ce
--- /dev/null
+++ b/source/blender/editors/space_benchmark/CMakeLists.txt
@@ -0,0 +1,48 @@
+# ***** 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
+       ../../blenfont
+       ../../blenkernel
+       ../../blenlib
+       ../../gpu
+       ../../makesdna
+       ../../makesrna
+       ../../windowmanager
+       ../../../../intern/guardedalloc
+       ../../../../intern/glew-mx
+)
+
+set(INC_SYS
+       ${GLEW_INCLUDE_PATH}
+)
+
+set(SRC
+       space_benchmark.c
+)
+
+if(WITH_PYTHON)
+       add_definitions(-DWITH_PYTHON)
+endif()
+
+add_definitions(${GL_DEFINITIONS})
+
+blender_add_lib(bf_editor_space_benchmark "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_benchmark/space_benchmark.c 
b/source/blender/editors/space_benchmark/space_benchmark.c
new file mode 100644
index 00000000000..62c9dfbb752
--- /dev/null
+++ b/source/blender/editors/space_benchmark/space_benchmark.c
@@ -0,0 +1,125 @@
+/*
+ * ***** 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): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/space_benchmark/space_benchmark.c
+ *  \ingroup spbenchmark
+ */
+
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_context.h"
+#include "BKE_screen.h"
+
+#include "ED_space_api.h"
+#include "ED_screen.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+/* ******************** default callbacks for benchmark space 
***************** */
+
+static SpaceLink *benchmark_new(const ScrArea *UNUSED(area), const Scene 
*UNUSED(scene))
+{
+       SpaceBenchmark *sbenchmark = MEM_callocN(sizeof(SpaceBenchmark), 
"initbenchmark");
+       sbenchmark->spacetype = SPACE_BENCHMARK;
+
+       // TODO sbenchmark->lheight =  14;
+
+       /* main region */
+       ARegion *ar = MEM_callocN(sizeof(ARegion), "main region for text");
+       BLI_addtail(&sbenchmark->regionbase, ar);
+       ar->regiontype = RGN_TYPE_WINDOW;
+
+       return (SpaceLink *)sbenchmark;
+}
+
+/* not spacelink itself */
+static void benchmark_free(SpaceLink *UNUSED(sl))
+{
+}
+
+/* spacetype; init callback */
+static void benchmark_init(struct wmWindowManager *UNUSED(wm), ScrArea 
*UNUSED(sa))
+{
+}
+
+static SpaceLink *benchmark_duplicate(SpaceLink *sl)
+{
+       SpaceBenchmark *sbenchmarkn = MEM_dupallocN(sl);
+       return (SpaceLink *)sbenchmarkn;
+}
+
+/* add handlers, stuff you only do once or on area/region changes */
+sta

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to