Skip to content
Snippets Groups Projects
Commit ec4cccef authored by Joseph Gilbert's avatar Joseph Gilbert
Browse files

-bug fixes for materials updating - BalaGi found these bugs

- NMesh.c added support for materials updating while converting a python NMesh to a Mesh object
- Object.c added support for materials updating in Link() and shareFrom() when two objects share a mesh linked to a material
parent 52e5a15b
Branches
Tags
No related merge requests found
......@@ -1949,6 +1949,13 @@ static int convert_NMeshToMesh (Mesh *mesh, BPy_NMesh *nmesh)
if (newmc) newmc += 4; /* there are 4 MCol's per face */
}
}
//-- balagi 01/14/2004 , fix supplied by ascotan
if(nmesh->materials){
mesh->mat = EXPP_newMaterialList_fromPyList (nmesh->materials);
}
//-- balagi end
return 1;
}
......
......@@ -271,7 +271,7 @@ PyObject *M_Object_New(PyObject *self, PyObject *args)
else if (strcmp (str_type, "Lattice") == 0) type = OB_LATTICE;
/* else if (strcmp (str_type, "Mball") == 0) type = OB_MBALL; */
else if (strcmp (str_type, "Mesh") == 0) type = OB_MESH;
else if (strcmp (str_type, "Surf") == 0) type = OB_SURF;
/* else if (strcmp (str_type, "Surf") == 0) type = OB_SURF; */
/* else if (strcmp (str_type, "Wave") == 0) type = OB_WAVE; */
else if (strcmp (str_type, "Empty") == 0) type = OB_EMPTY;
else
......@@ -991,6 +991,17 @@ static PyObject *Object_link (BPy_Object *self, PyObject *args)
"Linking this object type is not supported"));
}
self->object->data = data;
//-- balagi 01/14/2004
/*
if a mesh is shared the self->object material list must be setup properly !
*/
if ( self->object->type == OB_MESH && id )
{
EXPP_synchronizeMaterialLists(self->object, id);
}
//-- balagi end
id_us_plus (id);
if (oldid)
{
......@@ -1325,12 +1336,21 @@ static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args)
case OB_CAMERA: /* we can probably add the other types, too */
case OB_ARMATURE:
case OB_CURVE:
case OB_SURF:
case OB_LATTICE:
oldid = (ID*) self->object->data;
id = (ID*) object->object->data;
self->object->data = object->object->data;
//-- balagi 01/14/2004
/*
if a mesh is shared the self->object material list must be setup properly !
*/
if ( self->object->type == OB_MESH && id )
{
EXPP_synchronizeMaterialLists(self->object, id);
}
//-- balagi end
id_us_plus (id);
if (oldid)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment