[Bf-blender-cvs] [99fc6b7] soc-2016-layer_manager: Move layer type definitions and drawing to own file

Julian Eisel noreply at git.blender.org
Thu Jun 23 02:10:24 CEST 2016


Commit: 99fc6b733c374ec64f3233123d583f88f13eafe6
Author: Julian Eisel
Date:   Thu Jun 23 02:04:21 2016 +0200
Branches: soc-2016-layer_manager
https://developer.blender.org/rB99fc6b733c374ec64f3233123d583f88f13eafe6

Move layer type definitions and drawing to own file

Done because layer drawing should (actually needs to) be registered with layer types on startup. This wasn't possible previously without including editor headers in BKE files. So added editors/scene/ now, and moved layer type definitions including drawing callbacks to a new file layer_types in it.

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

M	build_files/cmake/macros.cmake
M	source/blender/blenkernel/BKE_layer.h
M	source/blender/blenkernel/BKE_object.h
M	source/blender/blenkernel/intern/layer.c
M	source/blender/blenkernel/intern/object_layer.c
M	source/blender/editors/CMakeLists.txt
A	source/blender/editors/include/ED_scene.h
A	source/blender/editors/scene/CMakeLists.txt
A	source/blender/editors/scene/layer_types.c
M	source/blender/editors/space_layers/CMakeLists.txt
M	source/blender/editors/space_layers/layers_draw.c
M	source/blender/editors/space_layers/layers_intern.h
M	source/blender/editors/space_layers/layers_ops.c
D	source/blender/editors/space_layers/layers_types.c
M	source/blender/editors/util/CMakeLists.txt
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/windowmanager/intern/wm_init_exit.c
M	source/creator/creator.c

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

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 8147dda..fb013e0 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -535,6 +535,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
 		bf_editor_armature
 		bf_editor_physics
 		bf_editor_render
+		bf_editor_scene
 		bf_editor_screen
 		bf_editor_sculpt_paint
 		bf_editor_sound
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index 06cad9b..a1d362d 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -93,10 +93,8 @@ typedef struct LayerType {
 	struct StructRNA *srna;
 } LayerType;
 
-void BKE_layertypes_init(void);
-void BKE_layertypes_free(void);
-
 void BKE_layertype_append(void (*ltfunc)(LayerType *));
+void BKE_layertypes_free(void);
 
 /* -------------------------------------------------------------------- */
 /* Layer Tree Item */
@@ -106,12 +104,10 @@ typedef void  (*LayerItemDrawSettingsFunc)(const struct bContext *, struct Layer
 
 LayerTreeItem *BKE_layeritem_add(
         LayerTree *tree, LayerTreeItem *parent,
-        const eLayerTreeItem_Type type, const char *name,
-        LayerItemDrawFunc draw, LayerItemDrawSettingsFunc draw_settings);
+        const eLayerTreeItem_Type type, const char *name);
 void BKE_layeritem_register(
         LayerTree *tree, LayerTreeItem *litem, LayerTreeItem *parent,
-        const eLayerTreeItem_Type type, const char *name,
-        LayerItemDrawFunc draw, LayerItemDrawSettingsFunc draw_settings);
+        const eLayerTreeItem_Type type, const char *name);
 void BKE_layeritem_remove(LayerTreeItem *litem, const bool remove_children);
 
 void BKE_layeritem_move(LayerTreeItem *litem, const int newidx);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 2553d5f..8bb6f2a 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -282,9 +282,7 @@ bool BKE_object_modifier_update_subframe(struct Scene *scene, struct Object *ob,
 		Base *base_name = oblayer->bases[idx_name];
 #define BKE_OBJECTLAYER_BASES_ITER_END } (void)0
 
-LayerTreeItem *BKE_objectlayer_add(
-        LayerTree *tree, LayerTreeItem *parent, const char *name,
-        LayerItemDrawFunc draw, LayerItemDrawSettingsFunc draw_settings);
+LayerTreeItem *BKE_objectlayer_add(LayerTree *tree, LayerTreeItem *parent, const char *name);
 void BKE_objectlayer_free(LayerTreeItem *litem);
 void BKE_objectlayer_base_assign(Base *base, LayerTreeItem *litem);
 void BKE_objectlayer_base_unassign(const Base *base, LayerTreeItem *litem);
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index d694d4e..a3dd991 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -136,21 +136,6 @@ int BKE_layertree_get_totitems(const LayerTree *ltree)
 static LayerType *layertypes[LAYER_ITEMTYPE_TOT] = {NULL};
 
 
-static void LAYERTYPE_object(LayerType *lt)
-{
-	/* XXX Will probably get own layer type */
-	lt->type = LAYER_ITEMTYPE_LAYER;
-
-	lt->free = BKE_objectlayer_free;
-
-	RNA_def_enum(lt->srna, "color_set", rna_enum_color_sets_items, 0, "Color Set", "Custom color set for this layer");
-}
-
-static void LAYERTYPE_group(LayerType *lt)
-{
-	lt->type = LAYER_ITEMTYPE_GROUP;
-}
-
 void BKE_layertype_append(void (*ltfunc)(LayerType *))
 {
 	LayerType *lt = MEM_callocN(sizeof(LayerType), __func__);
@@ -161,15 +146,6 @@ void BKE_layertype_append(void (*ltfunc)(LayerType *))
 	layertypes[lt->type] = lt;
 }
 
-/**
- * Startup initialization of layer types.
- */
-void BKE_layertypes_init(void)
-{
-	BKE_layertype_append(LAYERTYPE_object);
-	BKE_layertype_append(LAYERTYPE_group);
-}
-
 void BKE_layertypes_free(void)
 {
 	for (int i = 0; i < ARRAY_SIZE(layertypes); i++) {
@@ -197,8 +173,7 @@ void BKE_layertypes_free(void)
  */
 void BKE_layeritem_register(
         LayerTree *tree, LayerTreeItem *litem, LayerTreeItem *parent,
-        const eLayerTreeItem_Type type, const char *name,
-        LayerItemDrawFunc draw, LayerItemDrawSettingsFunc draw_settings)
+        const eLayerTreeItem_Type type, const char *name)
 {
 	litem->type = layertypes[type];
 
@@ -212,10 +187,6 @@ void BKE_layeritem_register(
 	litem->tree = tree;
 	BLI_strncpy(litem->name, name, sizeof(litem->name));
 
-	/* callbacks */
-	litem->type->draw = draw;
-	litem->type->draw_settings = draw_settings;
-
 	/* add to item array */
 	tree->items_all = MEM_reallocN(tree->items_all, sizeof(*tree->items_all) * ++tree->tot_items);
 	tree->items_all[tree->tot_items - 1] = litem;
@@ -241,11 +212,10 @@ void BKE_layeritem_register(
  */
 LayerTreeItem *BKE_layeritem_add(
         LayerTree *tree, LayerTreeItem *parent,
-        const eLayerTreeItem_Type type, const char *name,
-        LayerItemDrawFunc draw, LayerItemDrawSettingsFunc draw_settings)
+        const eLayerTreeItem_Type type, const char *name)
 {
 	LayerTreeItem *litem = MEM_callocN(sizeof(LayerTreeItem), __func__);
-	BKE_layeritem_register(tree, litem, parent, type, name, draw, draw_settings);
+	BKE_layeritem_register(tree, litem, parent, type, name);
 	return litem;
 }
 
diff --git a/source/blender/blenkernel/intern/object_layer.c b/source/blender/blenkernel/intern/object_layer.c
index cdb61b5..d606b1b 100644
--- a/source/blender/blenkernel/intern/object_layer.c
+++ b/source/blender/blenkernel/intern/object_layer.c
@@ -33,14 +33,12 @@
 #include "MEM_guardedalloc.h"
 
 
-LayerTreeItem *BKE_objectlayer_add(
-        LayerTree *tree, LayerTreeItem *parent, const char *name,
-        LayerItemDrawFunc draw, LayerItemDrawSettingsFunc draw_settings)
+LayerTreeItem *BKE_objectlayer_add(LayerTree *tree, LayerTreeItem *parent, const char *name)
 {
 	LayerTypeObject *oblayer = MEM_callocN(sizeof(LayerTypeObject), __func__);
 
 	BLI_assert(tree->type == LAYER_TREETYPE_OBJECT);
-	BKE_layeritem_register(tree, &oblayer->litem, parent, LAYER_ITEMTYPE_LAYER, name, draw, draw_settings);
+	BKE_layeritem_register(tree, &oblayer->litem, parent, LAYER_ITEMTYPE_LAYER, name);
 
 	return &oblayer->litem;
 }
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 6afecc3..e04ed4c 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -31,6 +31,7 @@ if(WITH_BLENDER)
 	add_subdirectory(object)
 	add_subdirectory(physics)
 	add_subdirectory(render)
+	add_subdirectory(scene)
 	add_subdirectory(screen)
 	add_subdirectory(sculpt_paint)
 	add_subdirectory(sound)
diff --git a/source/blender/editors/include/ED_scene.h b/source/blender/editors/include/ED_scene.h
new file mode 100644
index 0000000..524ad7e
--- /dev/null
+++ b/source/blender/editors/include/ED_scene.h
@@ -0,0 +1,30 @@
+/*
+ * ***** 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 ED_scene.h
+ *  \ingroup editors
+ */
+
+#ifndef __ED_SCENE_H__
+#define __ED_SCENE_H__
+
+void ED_scene_layertypes_init(void);
+
+#endif // __ED_SCENE_H__
diff --git a/source/blender/editors/space_layers/CMakeLists.txt b/source/blender/editors/scene/CMakeLists.txt
similarity index 81%
copy from source/blender/editors/space_layers/CMakeLists.txt
copy to source/blender/editors/scene/CMakeLists.txt
index 5394628..875a7c7 100644
--- a/source/blender/editors/space_layers/CMakeLists.txt
+++ b/source/blender/editors/scene/CMakeLists.txt
@@ -23,12 +23,9 @@ set(INC
 	../../blenkernel
 	../../blenlib
 	../../blentranslation
-	../../gpu
 	../../makesdna
 	../../makesrna
-	../../windowmanager
 	../../../../intern/guardedalloc
-	../../../../intern/glew-mx
 )
 
 set(INC_SYS
@@ -36,13 +33,12 @@ set(INC_SYS
 )
 
 set(SRC
-	layers_draw.c
-	layers_ops.c
-	layers_types.c
-	layers_util.c
-	space_layers.c
-
-	layers_intern.h
 )
 
-blender_add_lib(bf_editor_space_layers "${SRC}" "${INC}" "${INC_SYS}")
+if(WITH_ADVANCED_LAYERS)
+	list(APPEND SRC
+		layer_types.c
+	)
+endif()
+
+blender_add_lib(bf_editor_scene "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/scene/layer_types.c b/source/blender/editors/scene/layer_types.c
new file mode 100644
index 0000000..c96cb4c
--- /dev/null
+++ b/source/blender/editors/scene/layer_types.c
@@ -0,0 +1,110 @@
+/*
+ * ***** 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/scene/layer_types.c
+ *  \ingroup edscene
+ */
+
+#include "BKE_context.h"
+#include "BKE_layer.h"
+#include "BKE_object.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
+
+#include "BLT_translation.h"
+
+#include "DNA_space_types.h"
+
+#include "ED_scene.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RN

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list