-- 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,13 +4854,18 @@ static PyObject *Mesh_getFromObject( BPy_Mesh * self, PyObject * args )
|
||||
/* save a copy of our ID, dup the temporary mesh, restore the ID */
|
||||
tmpid = self->mesh->id;
|
||||
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 */
|
||||
BLI_remlink( &G.main->mesh, tmpmesh );
|
||||
MEM_freeN( tmpmesh );
|
||||
|
||||
/* make sure materials get updated in objects */
|
||||
test_object_materials( ( ID * ) self->mesh );
|
||||
test_object_materials( ( ID * ) self->mesh );
|
||||
|
||||
mesh_update( self->mesh );
|
||||
return EXPP_incr_ret( Py_None );
|
||||
|
||||
Reference in New Issue
Block a user