diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-25 13:27:43 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-25 13:27:43 +0300 |
commit | 13915c05dd9cedef0956761f3e07c09a224d2e48 (patch) | |
tree | ed7842dd4e2521ef055313431c0f68c4e7fb6258 /source/blender/blenkernel/intern/customdata.c | |
parent | e60bbcafc578ce3d3c737122233aa625b95cb3bc (diff) |
CustomData: Allow copying content of a single layer
Diffstat (limited to 'source/blender/blenkernel/intern/customdata.c')
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 33a96cbe42f..8defb1307ce 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2239,6 +2239,27 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest, } } +void CustomData_copy_layer_type_data(const CustomData *source, + CustomData *destination, + int type, + int source_index, int destination_index, + int count) +{ + const int source_layer_index = CustomData_get_layer_index(source, type); + if (source_layer_index == -1) { + return; + } + const int destinaiton_layer_index = + CustomData_get_layer_index(destination, type); + if (destinaiton_layer_index == -1) { + return; + } + CustomData_copy_data_layer(source, destination, + source_layer_index, destinaiton_layer_index, + source_index, destination_index, + count); +} + void CustomData_free_elem(CustomData *data, int index, int count) { int i; |