[Bf-blender-cvs] [63a68bb] soc-2016-layer_manager: Some initial functions for object layers
Julian Eisel
noreply at git.blender.org
Tue May 24 03:04:02 CEST 2016
Commit: 63a68bb9f8f40bbb5e474f434ca19e30013a54e4
Author: Julian Eisel
Date: Tue May 24 02:32:50 2016 +0200
Branches: soc-2016-layer_manager
https://developer.blender.org/rB63a68bb9f8f40bbb5e474f434ca19e30013a54e4
Some initial functions for object layers
===================================================================
M source/blender/blenkernel/BKE_layer.h
M source/blender/blenkernel/intern/layer.c
M source/blender/editors/include/ED_object.h
M source/blender/editors/object/CMakeLists.txt
A source/blender/editors/object/object_layer.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index fe44926..ab86731 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -31,8 +31,9 @@
#define __BKE_LAYER_H__
struct bContext;
-struct LayerTree;
-struct LayerTreeItem;
+
+typedef struct LayerTree LayerTree;
+typedef struct LayerTreeItem LayerTreeItem;
/* -------------------------------------------------------------------- */
@@ -70,5 +71,7 @@ struct LayerTreeItem *BKE_layeritem_add(
const LayerItemPollFunc poll, LayerItemDrawFunc draw, LayerItemDrawSettingsFunc draw_settings);
void BKE_layeritem_remove(struct LayerTree *tree, struct LayerTreeItem *litem);
+const char *BKE_layeritem_name_get(struct LayerTreeItem *litem);
+
#endif /* __BKE_LAYER_H__ */
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 4761c2e..0ce9ae4 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -149,4 +149,9 @@ void BKE_layeritem_remove(LayerTree *tree, LayerTreeItem *litem)
MEM_freeN(litem);
}
+const char *BKE_layeritem_name_get(LayerTreeItem *litem)
+{
+ return litem->name;
+}
+
/** \} */ /* Layer Tree Item */
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 04ff569..8a83175 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -53,6 +53,7 @@ struct wmOperatorType;
struct PointerRNA;
struct PropertyRNA;
struct EnumPropertyItem;
+struct LayerTree;
/* object_edit.c */
struct Object *ED_object_context(struct bContext *C); /* context.object */
@@ -177,6 +178,9 @@ void undo_push_lattice(struct bContext *C, const char *name);
void ED_lattice_flags_set(struct Object *obedit, int flag);
+/* object_layer.c */
+void ED_object_layer_add(struct LayerTree *ltree);
+
/* object_modifier.c */
enum {
MODIFIER_APPLY_DATA = 1,
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index b3d02d4..88a4183 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -49,6 +49,7 @@ set(SRC
object_group.c
object_hook.c
object_lattice.c
+ object_layer.c
object_lod.c
object_modifier.c
object_ops.c
diff --git a/source/blender/editors/object/object_layer.c b/source/blender/editors/object/object_layer.c
new file mode 100644
index 0000000..4fa0134
--- /dev/null
+++ b/source/blender/editors/object/object_layer.c
@@ -0,0 +1,52 @@
+/*
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2016 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/object/object_layer.c
+ * \ingroup edobj
+ *
+ * Functions to define object layer data and UI.
+ */
+
+#include "BKE_layer.h"
+
+#include "BLI_compiler_attrs.h"
+#include "BLI_utildefines.h"
+
+#include "ED_object.h"
+
+static void object_layer_draw(LayerTreeItem *litem)
+{
+ printf("%s\n", BKE_layeritem_name_get(litem));
+}
+
+static void object_layer_draw_settings(LayerTreeItem *UNUSED(litem))
+{
+ /* TODO */
+}
+
+void ED_object_layer_add(LayerTree *ltree)
+{
+ BKE_layeritem_add(ltree, NULL, LAYER_TREETYPE_OBJECT, NULL, object_layer_draw, object_layer_draw_settings);
+}
More information about the Bf-blender-cvs
mailing list