Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-04-30 22:54:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-30 22:54:14 +0400
commit1d743d11dcd48807c4dc13c109f5199573015b9d (patch)
treeac38b4a0af53bd23198bd8281afb525e863cf5fb /source/blender/blenkernel
parentdf74a51bac173b8e47882801bf0f5d47d856f897 (diff)
bmesh - python api
- bm.*.layers.*.verify() - bm.*.layers.*.is_singleton - bm.*.layers.*.copy_from(other) also added api functons - BM_data_layer_copy(...) - CustomData_layertype_is_singleton(type)
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_customdata.h1
-rw-r--r--source/blender/blenkernel/intern/customdata.c16
2 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 6a3625e2133..4b52189d8b7 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -305,6 +305,7 @@ int CustomData_sizeof(int type);
/* get the name of a layer type */
const char *CustomData_layertype_name(int type);
+int CustomData_layertype_is_singleton(int type);
/* make sure the name of layer at index is unique */
void CustomData_set_layer_unique_name(struct CustomData *data, int index);
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 4666aa6a456..4cf48ff6005 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -71,7 +71,11 @@ typedef struct LayerTypeInfo {
int size; /* the memory size of one element of this layer's data */
const char *structname; /* name of the struct used, for file writing */
int structnum; /* number of structs per element, for file writing */
- const char *defaultname; /* default layer name */
+
+ /* default layer name.
+ * note! when NULL this is a way to ensure there is only ever one item
+ * see: CustomData_layertype_is_singleton() */
+ const char *defaultname;
/* a function to copy count elements of this layer's data
* (deep copy if appropriate)
@@ -2601,6 +2605,16 @@ const char *CustomData_layertype_name(int type)
return layerType_getName(type);
}
+
+/**
+ * Can only ever be one of these.
+ */
+int CustomData_layertype_is_singleton(int type)
+{
+ const LayerTypeInfo *typeInfo = layerType_getInfo(type);
+ return typeInfo->defaultname != NULL;
+}
+
static int CustomData_is_property_layer(int type)
{
if ((type == CD_PROP_FLT) || (type == CD_PROP_INT) || (type == CD_PROP_STR))