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:
authorNicholas Bishop <nicholasbishop@gmail.com>2007-01-10 09:09:10 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2007-01-10 09:09:10 +0300
commit043be070504b8d7742b62ce5404f7cab1251dd6c (patch)
treef83cc2ba061330a3a916facaf9c0f906333a7e52 /source/blender/blenkernel/intern/customdata.c
parent3f5bd9b3918d636c6510bd9c63f238005905e494 (diff)
Large fix for multires. Changed UV coordinates (MTFaces) to be special first-level data in multires. The data is now stored in a standard CustomData struct in Multires, rather than being stored for each level. (The UVs can now only be edited on level 1.) Changes allow multiple sets of UVs to work correctly. This change should also decrease multires memory usage some (though only when UVs are being used, of course.)
Changes to CustomData: Some functions would only return the current active layer, added extra variants that take an index to select the level (modeled after CustomData_get_layer_n.) Still todo: * UVs are being interpolated linearly, should probably offer Catmull-Clark subdivision like Subsurf modifier. * Vertex Colors still don't support multiple customdata layers. * Editing UV data on levels other than 1 should be disabled in the interface (same for weights)
Diffstat (limited to 'source/blender/blenkernel/intern/customdata.c')
-rw-r--r--source/blender/blenkernel/intern/customdata.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index b6bcce96ad4..e8964ddeaf9 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -965,6 +965,17 @@ void *CustomData_set_layer(const CustomData *data, int type, void *ptr)
return ptr;
}
+void *CustomData_set_layer_n(const struct CustomData *data, int type, int n, void *ptr)
+{
+ /* get the layer index of the first layer of type */
+ int layer_index = CustomData_get_layer_index(data, type);
+ if(layer_index < 0) return NULL;
+
+ data->layers[layer_index+n].data = ptr;
+
+ return ptr;
+}
+
void CustomData_set(const CustomData *data, int index, int type, void *source)
{
void *dest = CustomData_get(data, index, type);
@@ -1070,6 +1081,17 @@ void *CustomData_em_get(const CustomData *data, void *block, int type)
return (char *)block + data->layers[layer_index].offset;
}
+void *CustomData_em_get_n(const CustomData *data, void *block, int type, int n)
+{
+ int layer_index;
+
+ /* get the layer index of the first layer of type */
+ layer_index = CustomData_get_active_layer_index(data, type);
+ if(layer_index < 0) return NULL;
+
+ return (char *)block + data->layers[layer_index+n].offset;
+}
+
void CustomData_em_set(CustomData *data, void *block, int type, void *source)
{
void *dest = CustomData_em_get(data, block, type);
@@ -1083,6 +1105,19 @@ void CustomData_em_set(CustomData *data, void *block, int type, void *source)
memcpy(dest, source, typeInfo->size);
}
+void CustomData_em_set_n(CustomData *data, void *block, int type, int n, void *source)
+{
+ void *dest = CustomData_em_get_n(data, block, type, n);
+ const LayerTypeInfo *typeInfo = layerType_getInfo(type);
+
+ if(!dest) return;
+
+ if(typeInfo->copy)
+ typeInfo->copy(source, dest, 1);
+ else
+ memcpy(dest, source, typeInfo->size);
+}
+
void CustomData_em_interp(CustomData *data, void **src_blocks, float *weights,
float *sub_weights, int count, void *dest_block)
{