(Partial) fix for bug #5289:
Crash using Shape Widget Wizard script, was an error in customdata copy. The script still throws a python error though, but that seems unrelated to this crash.
This commit is contained in:
@@ -431,15 +431,12 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
|
||||
flag = layer->flag & ~CD_FLAG_NOFREE;
|
||||
data = layer->data;
|
||||
|
||||
if (alloctype == CD_CALLOC) {
|
||||
if (alloctype == CD_CALLOC || alloctype == CD_DUPLICATE) {
|
||||
CustomData_add_layer(dest, type, flag, NULL, totelem);
|
||||
}
|
||||
else if (alloctype == CD_REFERENCE) {
|
||||
CustomData_add_layer(dest, type, flag|CD_FLAG_NOFREE, data, totelem);
|
||||
}
|
||||
else if (alloctype == CD_DUPLICATE) {
|
||||
CustomData_add_layer(dest, type, flag, MEM_dupallocN(data), totelem);
|
||||
}
|
||||
else if (alloctype == CD_DEFAULT) {
|
||||
data = CustomData_add_layer(dest, type, flag, NULL, totelem);
|
||||
if(typeInfo->set_default)
|
||||
@@ -447,8 +444,10 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
|
||||
}
|
||||
}
|
||||
|
||||
CustomData_update_offsets(dest);
|
||||
if (alloctype == CD_DUPLICATE)
|
||||
CustomData_copy_data(source, dest, 0, 0, totelem);
|
||||
|
||||
CustomData_update_offsets(dest);
|
||||
}
|
||||
|
||||
void CustomData_copy(const struct CustomData *source, struct CustomData *dest,
|
||||
|
||||
@@ -1690,7 +1690,8 @@ static PyObject *MVertSeq_extend( BPy_MVertSeq * self, PyObject *args )
|
||||
/* create custom vertex data arrays and copy existing vertices into it */
|
||||
|
||||
newlen = mesh->totvert + len;
|
||||
CustomData_copy( &mesh->vdata, &vdata, CD_MASK_MESH, CD_DUPLICATE, newlen );
|
||||
CustomData_copy( &mesh->vdata, &vdata, CD_MASK_MESH, CD_CALLOC, newlen );
|
||||
CustomData_copy_data( &mesh->vdata, &vdata, 0, 0, mesh->totvert );
|
||||
CustomData_set_default( &vdata, mesh->totvert, len );
|
||||
|
||||
if ( !CustomData_has_layer( &vdata, CD_MVERT ) )
|
||||
@@ -2859,7 +2860,8 @@ static PyObject *MEdgeSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
int totedge = mesh->totedge+good_edges;
|
||||
|
||||
/* create custom edge data arrays and copy existing edges into it */
|
||||
CustomData_copy( &mesh->edata, &edata, CD_MASK_MESH, CD_DUPLICATE, totedge );
|
||||
CustomData_copy( &mesh->edata, &edata, CD_MASK_MESH, CD_CALLOC, totedge );
|
||||
CustomData_copy_data( &mesh->edata, &edata, 0, 0, mesh->totedge );
|
||||
CustomData_set_default( &edata, mesh->totedge, good_edges );
|
||||
|
||||
if ( !CustomData_has_layer( &edata, CD_MEDGE ) )
|
||||
@@ -4802,7 +4804,8 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args,
|
||||
int totface = mesh->totface+good_faces; /* new face count */
|
||||
CustomData fdata;
|
||||
|
||||
CustomData_copy( &mesh->fdata, &fdata, CD_MASK_MESH, CD_DUPLICATE, totface );
|
||||
CustomData_copy( &mesh->fdata, &fdata, CD_MASK_MESH, CD_CALLOC, totface );
|
||||
CustomData_copy_data( &mesh->fdata, &fdata, 0, 0, mesh->totface );
|
||||
CustomData_set_default( &fdata, mesh->totface, good_faces );
|
||||
|
||||
if ( !CustomData_has_layer( &fdata, CD_MFACE ) )
|
||||
|
||||
Reference in New Issue
Block a user