diff options
Diffstat (limited to 'source/blender/yafray')
-rwxr-xr-x | source/blender/yafray/intern/export_File.cpp | 20 | ||||
-rw-r--r-- | source/blender/yafray/intern/export_Plugin.cpp | 19 | ||||
-rw-r--r-- | source/blender/yafray/intern/yafray_Render.cpp | 2 |
3 files changed, 33 insertions, 8 deletions
diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp index 740431dd3a0..ba76a110606 100755 --- a/source/blender/yafray/intern/export_File.cpp +++ b/source/blender/yafray/intern/export_File.cpp @@ -1177,10 +1177,24 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li xmlfile << ostr.str(); ostr.str(""); - // if objects are externally linked from a library, they could have a name that is already - // defined locally, so to prevent name clashes, prefix name with 'lib' + + // using the ObjectRen database, contruct a new name if object has a parent. + // This is done to prevent name clashes (group/library link related) string obname(obj->id.name); - if (obj->id.flag & (LIB_EXTERN|LIB_INDIRECT))obname = "lib_" + obname; + // previous implementation, keep around, in case this is still useful + //if (obj->id.flag & (LIB_EXTERN|LIB_INDIRECT))obname = "lib_" + obname; + ObjectRen *obren; + for (obren = static_cast<ObjectRen*>(re->objecttable.first); + obren; obren=static_cast<ObjectRen*>(obren->next)) + { + Object *db_ob = obren->ob, *db_par = obren->par; + if (db_ob==obj) + if ((db_ob!=NULL) && (db_par!=NULL)) { + obname += "_" + string(db_par->id.name); + break; + } + } + ostr << "<object name=\"" << obname << "\""; // Yafray still needs default shader name in object def., // since we write a shader with every face, simply use the material of the first face. diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp index 48f4b126d69..8993b656b9a 100644 --- a/source/blender/yafray/intern/export_Plugin.cpp +++ b/source/blender/yafray/intern/export_Plugin.cpp @@ -1352,10 +1352,23 @@ void yafrayPluginRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_ genCompleFace(faces, faceshader, uvcoords, vcol, vert_idx, vlr, has_orco, has_uv); } - // if objects are externally linked from a library, they could have a name that is already - // defined locally, so to prevent name clashes, prefix name with 'lib' + // using the ObjectRen database, contruct a new name if object has a parent. + // This is done to prevent name clashes (group/library link related) string obname(obj->id.name); - if (obj->id.flag & (LIB_EXTERN|LIB_INDIRECT))obname = "lib_" + obname; + // previous implementation, keep around, in case this is still useful + //if (obj->id.flag & (LIB_EXTERN|LIB_INDIRECT))obname = "lib_" + obname; + ObjectRen *obren; + for (obren = static_cast<ObjectRen*>(re->objecttable.first); + obren; obren=static_cast<ObjectRen*>(obren->next)) + { + Object *db_ob = obren->ob, *db_par = obren->par; + if (db_ob==obj) + if ((db_ob!=NULL) && (db_par!=NULL)) { + obname += "_" + string(db_par->id.name); + break; + } + } + yafrayGate->addObject_trimesh(obname, verts, faces, uvcoords, vcol, shaders, faceshader, sm_angle, castShadows, true, true, caus, has_orco, caus_rcolor, caus_tcolor, caus_IOR); diff --git a/source/blender/yafray/intern/yafray_Render.cpp b/source/blender/yafray/intern/yafray_Render.cpp index b91f572dd2c..32adc38543f 100644 --- a/source/blender/yafray/intern/yafray_Render.cpp +++ b/source/blender/yafray/intern/yafray_Render.cpp @@ -68,13 +68,11 @@ bool yafrayRender_t::exportScene(Render* re) else return true; } - // gets all unique face materials & textures, // and sorts the facelist rejecting anything that is not a quad or tri, // as well as associating them again with the original Object. bool yafrayRender_t::getAllMatTexObs() { - VlakRen* vlr; // Blender does not include object which have total 0 alpha materials, |