[Bf-blender-cvs] [b0cd877] soc-2016-layer_manager: Add "Layer Manager" editor

Julian Eisel noreply at git.blender.org
Tue May 24 01:35:26 CEST 2016


Commit: b0cd87715f1f94e12b5f6c447aeb82bffd9f6c8e
Author: Julian Eisel
Date:   Tue May 24 01:31:26 2016 +0200
Branches: soc-2016-layer_manager
https://developer.blender.org/rBb0cd87715f1f94e12b5f6c447aeb82bffd9f6c8e

Add "Layer Manager" editor

We didn't decide yet if the layer manager is going to be placed in an own editor, in the outliner or anywhere else. For now, I'll use this new editor since it allows me to focus on creating a really rough the layer manager GUI. Later we can merge into an other editor if needed.

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

M	build_files/cmake/macros.cmake
M	source/blender/blenkernel/BKE_context.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/context.c
M	source/blender/blenkernel/intern/layer.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/CMakeLists.txt
M	source/blender/editors/space_api/spacetypes.c
A	source/blender/editors/space_layers/CMakeLists.txt
A	source/blender/editors/space_layers/space_layers.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/CMakeLists.txt
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 f14c954..77039bf 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -521,6 +521,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
 		bf_editor_space_userpref
 		bf_editor_space_view3d
 		bf_editor_space_clip
+		bf_editor_space_layers
 
 		bf_editor_transform
 		bf_editor_util
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 65a68a4..2c34156 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -162,6 +162,9 @@ 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);
+#ifdef WITH_ADVANCED_LAYERS
+struct SpaceLayers *CTX_wm_space_layers(const bContext *C);
+#endif
 
 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/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index dc86098..0da285e 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -529,8 +529,9 @@ if(WITH_LEGACY_DEPSGRAPH)
 	add_definitions(-DWITH_LEGACY_DEPSGRAPH)
 endif()
 
-if (WITH_ADVANCED_LAYERS)
-	list (APPEND SRC
+if(WITH_ADVANCED_LAYERS)
+	add_definitions(-DWITH_ADVANCED_LAYERS)
+	list(APPEND SRC
 		intern/layer.c
 		BKE_layer.h
 	)
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 5b76985..53496ef 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -813,6 +813,16 @@ struct SpaceClip *CTX_wm_space_clip(const bContext *C)
 	return NULL;
 }
 
+#ifdef WITH_ADVANCED_LAYERS
+struct SpaceLayers *CTX_wm_space_layers(const bContext *C)
+{
+	ScrArea *sa = CTX_wm_area(C);
+	if (sa && sa->spacetype == SPACE_LAYERS)
+		return sa->spacedata.first;
+	return NULL;
+}
+#endif
+
 void CTX_wm_manager_set(bContext *C, wmWindowManager *wm)
 {
 	C->wm.manager = wm;
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 642a148..4761c2e 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -28,7 +28,7 @@
  *
  * \brief Functions for a generic layer managment system.
  *
- * TODO sorting, renaming, drawing
+ * TODO sorting, renaming, drawing, filtering
  */
 
 #include "BKE_context.h"
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 124b1ef..7a41136 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2865,6 +2865,11 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
 				else if (sl->spacetype == SPACE_INFO) {
 					writestruct(wd, DATA, "SpaceInfo", 1, sl);
 				}
+#ifdef WITH_ADVANCED_LAYERS
+				else if (sl->spacetype == SPACE_LAYERS) {
+					writestruct(wd, DATA, "SpaceLayers", 1, sl);
+				}
+#endif
 
 				sl= sl->next;
 			}
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 084006c..6afecc3 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -43,6 +43,9 @@ if(WITH_BLENDER)
 	add_subdirectory(space_graph)
 	add_subdirectory(space_image)
 	add_subdirectory(space_info)
+	if(WITH_ADVANCED_LAYERS)
+		add_subdirectory(space_layers)
+	endif()
 	add_subdirectory(space_logic)
 	add_subdirectory(space_nla)
 	add_subdirectory(space_node)
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index d268c57..62fb465 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -58,6 +58,9 @@ void ED_spacetype_logic(void);
 void ED_spacetype_console(void);
 void ED_spacetype_userpref(void);
 void ED_spacetype_clip(void);
+//#ifdef WITH_ADVANCED_LAYERS /* TODO */
+void ED_spacetype_layers(void);
+//#endif
 
 /* 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 e2e2413..f533235 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_LAYERS:
+					ts = &btheme->tlayers;
+					break;
 				default:
 					ts = &btheme->tv3d;
 					break;
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt
index bf32573..3657bfa 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_api/CMakeLists.txt
@@ -37,4 +37,8 @@ set(SRC
 	spacetypes.c
 )
 
+if(WITH_ADVANCED_LAYERS)
+	add_definitions(-DWITH_ADVANCED_LAYERS)
+endif()
+
 blender_add_lib(bf_editor_space_api "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index ac6e312..dace408 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -96,6 +96,9 @@ void ED_spacetypes_init(void)
 	ED_spacetype_console();
 	ED_spacetype_userpref();
 	ED_spacetype_clip();
+#ifdef WITH_ADVANCED_LAYERS
+	ED_spacetype_layers();
+#endif
 //	...
 	
 	/* register operator types for screen and all spaces */
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_layers/CMakeLists.txt
similarity index 91%
copy from source/blender/editors/space_api/CMakeLists.txt
copy to source/blender/editors/space_layers/CMakeLists.txt
index bf32573..f193d5d 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_layers/CMakeLists.txt
@@ -20,7 +20,6 @@
 
 set(INC
 	../include
-	../io
 	../../blenkernel
 	../../blenlib
 	../../makesdna
@@ -30,11 +29,11 @@ set(INC
 )
 
 set(INC_SYS
-
+	
 )
 
 set(SRC
-	spacetypes.c
+	space_layers.c
 )
 
-blender_add_lib(bf_editor_space_api "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_editor_space_layers "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_layers/space_layers.c b/source/blender/editors/space_layers/space_layers.c
new file mode 100644
index 0000000..c1a2232
--- /dev/null
+++ b/source/blender/editors/space_layers/space_layers.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_layers/space_layers.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 layer manager space ***************** */
+
+static SpaceLink *layers_new(const bContext *UNUSED(C))
+{
+	ARegion *ar;
+	SpaceLayers *slayer; /* hmm, that's actually a good band name... */
+
+	slayer = MEM_callocN(sizeof(SpaceLayers), __func__);
+	slayer->spacetype = SPACE_LAYERS;
+
+	/* header */
+	ar = MEM_callocN(sizeof(ARegion), "header for layer manager");
+
+	BLI_addtail(&slayer->regionbase, ar);
+	ar->regiontype = RGN_TYPE_HEADER;
+	ar->alignment = RGN_ALIGN_BOTTOM;
+
+	/* main region */
+	ar = MEM_callocN(sizeof(ARegion), "main region for layer manager");
+
+	BLI_addtail(&slayer->regionbase, ar);
+	ar->regiontype = RGN_TYPE_WINDOW;
+
+	return (SpaceLink *)slayer;
+}
+
+static SpaceLink *layers_duplicate(SpaceLink *sl)
+{
+	SpaceLayers *slayer = MEM_dupallocN(sl);
+
+	/* clear or remove stuff from old */
+
+	return (SpaceLink *)slayer;
+}
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void layer_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 layers_main_region_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar))
+{
+	printf("DRAW!\n");
+}
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void layers_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+{
+	ED_region_header_init(ar);
+}
+
+static void layers_header_region_draw(const bContext *C, ARegion *ar)
+{
+	ED_region_header(C, ar);
+}
+
+static void layers_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_layers(void)
+{
+	SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype layers");
+	ARegionType *art;
+
+	st->spaceid = SPACE_LAYERS;
+	strncpy(st->name, "LayerManager", BKE_ST_MAXNAME);
+
+	st->new = layers_new;
+	st->duplicate = layers_duplicate;
+
+	/* regions: main window */
+	art = MEM_callocN(sizeof(ARegionType), "spacetype layers reg

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list