Index: source/blender/blenkernel/intern/object.c =================================================================== --- source/blender/blenkernel/intern/object.c (revision 13604) +++ source/blender/blenkernel/intern/object.c (working copy) @@ -213,7 +213,6 @@ } ob->data= 0; } - for(a=0; atotcol; a++) { if(ob->mat[a]) ob->mat[a]->id.us--; } @@ -1309,11 +1308,28 @@ /* skip constraints, constraintchannels, nla? */ - + /* set object type and link to data */ ob->type= target->type; ob->data= target->data; id_us_plus((ID *)ob->data); /* ensures lib data becomes LIB_EXTERN */ + /* copy material and index information */ + ob->actcol= ob->totcol= 0; + if (target->totcol > 0 && ob->type==OB_MESH) { + int a; + Mesh *me=ob->data; + for(a=0; atotcol; a++) { + if(target->mat[a]) { + printf("tyrying to assign via object...\n"); + assign_material(ob, target->mat[a], ob->actcol); + } + else if (me->mat[a]) { + printf("trying to assign via mesh...\n"); + assign_material(ob, me->mat[a], ob->actcol); + } + } + } + /* type conversions */ if(target->type == OB_ARMATURE) { copy_object_pose(ob, target); /* data copy, object pointers in constraints */ @@ -1322,6 +1338,7 @@ armature_set_id_extern(ob); } + } Index: source/blender/blenloader/intern/writefile.c =================================================================== --- source/blender/blenloader/intern/writefile.c (revision 13604) +++ source/blender/blenloader/intern/writefile.c (working copy) @@ -876,7 +876,6 @@ static void write_objects(WriteData *wd, ListBase *idbase) { Object *ob; - ob= idbase->first; while(ob) { if(ob->id.us>0 || wd->current) { @@ -2006,7 +2005,6 @@ write_brushes (wd, &G.main->brush); if(current==NULL) write_libraries(wd, G.main->next); /* no library save in undo */ - if (write_user_block) { write_userdef(wd); } @@ -2021,7 +2019,6 @@ blo_join_main(&mainlist); G.main= mainlist.first; - return endwrite(wd); }