-- More of Bugfix #3580: Mesh_getFromObject() was not updating key->from
when it duplicated mesh data. I'm not thrilled with how I implemented this code, but currently don't know a better way. If someone more familiar with how blender duplicates objects and converts things to meshes wants to have a look, it would be appreciated.
This commit is contained in:
@@ -4854,7 +4854,12 @@ static PyObject *Mesh_getFromObject( BPy_Mesh * self, PyObject * args )
|
|||||||
/* save a copy of our ID, dup the temporary mesh, restore the ID */
|
/* save a copy of our ID, dup the temporary mesh, restore the ID */
|
||||||
tmpid = self->mesh->id;
|
tmpid = self->mesh->id;
|
||||||
memcpy( self->mesh, tmpmesh, sizeof( Mesh ) );
|
memcpy( self->mesh, tmpmesh, sizeof( Mesh ) );
|
||||||
self->mesh->id= tmpid;
|
self->mesh->id = tmpid;
|
||||||
|
|
||||||
|
/* if mesh has keys, make sure they point back to this mesh */
|
||||||
|
if( self->mesh->key )
|
||||||
|
self->mesh->key->from = (ID *)self->mesh;
|
||||||
|
|
||||||
/* remove the temporary mesh */
|
/* remove the temporary mesh */
|
||||||
BLI_remlink( &G.main->mesh, tmpmesh );
|
BLI_remlink( &G.main->mesh, tmpmesh );
|
||||||
MEM_freeN( tmpmesh );
|
MEM_freeN( tmpmesh );
|
||||||
|
|||||||
Reference in New Issue
Block a user