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?
This commit is contained in:
Sergey Sharybin 2014-12-02 17:49:40 +05:00
parent e3a6f1c152
commit 9345d2d723
Notes: blender-bot 2024-03-22 15:57:27 +01:00
Referenced by issue #42767, Subsurfacing union boolean with same-named UVs crashes Blender
2 changed files with 5 additions and 22 deletions

View File

@ -77,7 +77,7 @@ static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm);
#include "GPU_glew.h"
/* very slow! enable for testing only! */
// #define USE_MODIFIER_VALIDATE
//#define USE_MODIFIER_VALIDATE
#ifdef USE_MODIFIER_VALIDATE
# define ASSERT_IS_VALID_DM(dm) (BLI_assert((dm == NULL) || (DM_is_valid(dm) == true)))

View File

@ -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);