diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-02 15:49:40 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-02 15:50:34 +0300 |
commit | 9345d2d723733b84a8c8fb3bc387b812f951f77f (patch) | |
tree | 60c0c1a9aecde46c884e35b502344f619b38843f /source/blender/modifiers | |
parent | e3a6f1c1529f46049076020cbcab68e28de81c91 (diff) |
Fix T42767: Subsurfacing union boolean with same-named UVs crashes Blender
Was own mistake in handling custom data layers in boolean modifier.
Campbell, do you mind double-checking if it's all correct?
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_boolean_util.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 6e62a21ec4c..061b1198f7e 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -365,14 +365,6 @@ BLI_INLINE MPoly *which_mpoly(ExportMeshData *export_data, int which_mesh) return mpoly; } -static void allocate_custom_layers(CustomData *data, int type, int num_elements, int num_layers) -{ - int i; - for (i = 0; i < num_layers; i++) { - CustomData_add_layer(data, type, CD_DEFAULT, NULL, num_elements); - } -} - /* Create new external mesh */ static void exporter_InitGeomArrays(ExportMeshData *export_data, int num_verts, int num_edges, @@ -392,24 +384,15 @@ static void exporter_InitGeomArrays(ExportMeshData *export_data, export_data->mloop = dm->getLoopArray(dm); export_data->mpoly = dm->getPolyArray(dm); - /* Allocate layers for UV layers and vertex colors. - * Without this interpolation of those data will not happen. - */ - allocate_custom_layers(&dm->loopData, CD_MLOOPCOL, num_loops, - CustomData_number_of_layers(&dm_left->loopData, CD_MLOOPCOL)); - allocate_custom_layers(&dm->loopData, CD_MLOOPUV, num_loops, - CustomData_number_of_layers(&dm_left->loopData, CD_MLOOPUV)); - - allocate_custom_layers(&dm->loopData, CD_MLOOPCOL, num_loops, - CustomData_number_of_layers(&dm_right->loopData, CD_MLOOPCOL)); - allocate_custom_layers(&dm->loopData, CD_MLOOPUV, num_loops, - CustomData_number_of_layers(&dm_right->loopData, CD_MLOOPUV)); - /* Merge custom data layers from operands. * * Will only create custom data layers for all the layers which appears in * the operand. Data for those layers will not be allocated or initialized. */ + + CustomData_merge(&dm_left->loopData, &dm->loopData, merge_mask, CD_DEFAULT, num_loops); + CustomData_merge(&dm_right->loopData, &dm->loopData, merge_mask, CD_DEFAULT, num_loops); + CustomData_merge(&dm_left->polyData, &dm->polyData, merge_mask, CD_DEFAULT, num_polys); CustomData_merge(&dm_right->polyData, &dm->polyData, merge_mask, CD_DEFAULT, num_polys); |