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:
authorBen Batt <benbatt@gmail.com>2007-01-29 18:10:55 +0300
committerBen Batt <benbatt@gmail.com>2007-01-29 18:10:55 +0300
commit2a47217cba4123da38d47278a5f52c38080e926e (patch)
tree0127a1a0fd21fefacddee4a72e8f722759dd6255 /source/blender/blenkernel/intern/customdata.c
parent2d361fca0d0ee4ec085459286e75257f6c2f8c9c (diff)
= Updating the UVProject modifier to handle multiple UV layers =
* Removed the "Add UVs" option from the UVProject modifier * Added a UV layer menu to the UVProject modifier * Refactored the Displace modifier UV layer menu code to allow the UVProject modifier to share it * Added two CustomData functions to facilitate getting layers by name
Diffstat (limited to 'source/blender/blenkernel/intern/customdata.c')
-rw-r--r--source/blender/blenkernel/intern/customdata.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index e8964ddeaf9..033c1b26471 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -741,6 +741,26 @@ void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type)
return layer->data;
}
+void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
+ int type, char *name)
+{
+ CustomDataLayer *layer;
+ int layer_index;
+
+ /* get the layer index of the desired layer */
+ layer_index = CustomData_get_named_layer_index(data, type, name);
+ if(layer_index < 0) return NULL;
+
+ layer = &data->layers[layer_index];
+
+ if (layer->flag & CD_FLAG_NOFREE) {
+ layer->data = MEM_dupallocN(layer->data);
+ layer->flag &= ~CD_FLAG_NOFREE;
+ }
+
+ return layer->data;
+}
+
void CustomData_free_temporary(CustomData *data, int totelem)
{
CustomDataLayer *layer;
@@ -953,6 +973,15 @@ void *CustomData_get_layer_n(const CustomData *data, int type, int n)
return data->layers[layer_index+n].data;
}
+void *CustomData_get_layer_named(const struct CustomData *data, int type,
+ char *name)
+{
+ int layer_index = CustomData_get_named_layer_index(data, type, name);
+ if(layer_index < 0) return NULL;
+
+ return data->layers[layer_index].data;
+}
+
void *CustomData_set_layer(const CustomData *data, int type, void *ptr)
{
/* get the layer index of the first layer of type */