diff options
author | Alfredo de Greef <eeshlo@yahoo.com> | 2004-01-18 23:00:17 +0300 |
---|---|---|
committer | Alfredo de Greef <eeshlo@yahoo.com> | 2004-01-18 23:00:17 +0300 |
commit | 41144750da7d0dab39bc487fe086f627347fb16d (patch) | |
tree | 6295631518b642e4f502208689025aa1335e5be7 /source/blender/yafray/intern | |
parent | 8139587af5100b05dded09a162607021b2c3dd7a (diff) |
corrected particle object dupliverts and aramature duplivert export problems
corrected power slider increment update
Diffstat (limited to 'source/blender/yafray/intern')
-rwxr-xr-x | source/blender/yafray/intern/export_File.cpp | 39 | ||||
-rw-r--r-- | source/blender/yafray/intern/yafray_Render.cpp | 25 |
2 files changed, 26 insertions, 38 deletions
diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp index 04614efb2af..8d20eb3e681 100755 --- a/source/blender/yafray/intern/export_File.cpp +++ b/source/blender/yafray/intern/export_File.cpp @@ -898,9 +898,10 @@ void yafrayFileRender_t::writeAllObjects() for (map<Object*, vector<VlakRen*> >::const_iterator obi=all_objects.begin(); obi!=all_objects.end(); ++obi) { - // skip main duplivert, written later - if (obi->first->flag & OB_YAF_DUPLISOURCE) continue; - writeObject(obi->first, obi->second, obi->first->obmat); + // skip main duplivert object if in dupliMtx_list, written later + Object* obj = obi->first; + if (dupliMtx_list.find(string(obj->id.name))!=dupliMtx_list.end()) continue; + writeObject(obj, obi->second, obi->first->obmat); } // Now all duplivert objects (if any) as instances of main object @@ -954,19 +955,18 @@ void yafrayFileRender_t::writeAllObjects() } -void yafrayFileRender_t::writeAreaLamp(LampRen* lamp,int num) +void yafrayFileRender_t::writeAreaLamp(LampRen* lamp, int num) { - if(lamp->area_shape != LA_AREA_SQUARE) return; - float *a=lamp->area[0],*b=lamp->area[1],*c=lamp->area[2],*d=lamp->area[3]; + if (lamp->area_shape!=LA_AREA_SQUARE) return; + float *a=lamp->area[0], *b=lamp->area[1], *c=lamp->area[2], *d=lamp->area[3]; ostr.str(""); - ostr << "<light type=\"arealight\" name=\"LAMP" << num+1 << "\" dummy=\"on\" " <<endl; - ostr << "\tpower=\"" << lamp->energy <<"\">" <<endl; - ostr << "\t<color r=\""<<lamp->r<<"\" g=\""<<lamp->g<<"\" b=\""<<lamp->b<<"\"/>"<<endl; - ostr << "\t<a x=\""<<a[0]<<"\" y=\""<<a[1]<<"\" z=\""<<a[2]<<"\"/>"<<endl; - ostr << "\t<b x=\""<<b[0]<<"\" y=\""<<b[1]<<"\" z=\""<<b[2]<<"\"/>"<<endl; - ostr << "\t<c x=\""<<c[0]<<"\" y=\""<<c[1]<<"\" z=\""<<c[2]<<"\"/>"<<endl; - ostr << "\t<d x=\""<<d[0]<<"\" y=\""<<d[1]<<"\" z=\""<<d[2]<<"\"/>"<<endl; - ostr << "</light>"<<endl<<endl; + ostr << "<light type=\"arealight\" name=\"LAMP" << num+1 << "\" dummy=\"on\" power=\"" << lamp->dist <<"\">\n"; + ostr << "\t<a x=\""<< a[0] <<"\" y=\""<< a[1] <<"\" z=\"" << a[2] <<"\" />\n"; + ostr << "\t<b x=\""<< b[0] <<"\" y=\""<< b[1] <<"\" z=\"" << b[2] <<"\" />\n"; + ostr << "\t<c x=\""<< c[0] <<"\" y=\""<< c[1] <<"\" z=\"" << c[2] <<"\" />\n"; + ostr << "\t<d x=\""<< d[0] <<"\" y=\""<< d[1] <<"\" z=\"" << d[2] <<"\" />\n"; + ostr << "\t<color r=\"" << lamp->r << "\" g=\"" << lamp->g << "\" b=\"" << lamp->b << "\" />\n"; + ostr << "</light>\n\n"; xmlfile << ostr.str(); } @@ -977,14 +977,14 @@ void yafrayFileRender_t::writeLamps() { ostr.str(""); LampRen* lamp = R.la[i]; - if(lamp->type==LA_AREA) {writeAreaLamp(lamp,i);continue;} + if (lamp->type==LA_AREA) { writeAreaLamp(lamp,i); continue; } // TODO: add decay setting in yafray ostr << "<light type=\""; if (lamp->type==LA_LOCAL) ostr << "pointlight"; else if (lamp->type==LA_SPOT) ostr << "spotlight"; - else if (lamp->type==LA_SUN) // for now, hemi == sun + else if ((lamp->type==LA_SUN) || (lamp->type==LA_HEMI)) // for now, hemi same as sun ostr << "sunlight"; else { // possibly unknown type, ignore @@ -1024,9 +1024,10 @@ void yafrayFileRender_t::writeLamps() ostr << "\t<from x=\"" << lamp->co[0] << "\" y=\"" << lamp->co[1] << "\" z=\"" << lamp->co[2] << "\" />\n"; // 'to' for spot, already calculated by Blender if (lamp->type==LA_SPOT) - ostr << "\t<to x=\"" << lamp->co[0]+1e6*lamp->vec[0] - << "\" y=\"" << lamp->co[1]+1e6*lamp->vec[1] - << "\" z=\"" << lamp->co[2]+1e6*lamp->vec[2] << "\" />\n"; + ostr << "\t<to x=\"" << lamp->co[0] //+1e6*lamp->vec[0] + << "\" y=\"" << lamp->co[1] //+1e6*lamp->vec[1] + << "\" z=\"" << lamp->co[2] //+1e6*lamp->vec[2] + << "\" />\n"; // color // rgb in LampRen is premultiplied by energy, power is compensated for that above ostr << "\t<color r=\"" << lamp->r << "\" g=\"" << lamp->g << "\" b=\"" << lamp->b << "\" />\n"; diff --git a/source/blender/yafray/intern/yafray_Render.cpp b/source/blender/yafray/intern/yafray_Render.cpp index aa031126966..a8f6746f36e 100644 --- a/source/blender/yafray/intern/yafray_Render.cpp +++ b/source/blender/yafray/intern/yafray_Render.cpp @@ -33,7 +33,7 @@ bool yafrayRender_t::exportScene() maxraydepth = 5; // will be set to maximum depth used in blender materials // recreate the scene as object data, as well as sorting the material & textures, ignoring duplicates - if (!getAllMatTexObs()) + if (!getAllMatTexObs()) { // error found, clear for next call clearAll(); @@ -137,30 +137,22 @@ bool yafrayRender_t::getAllMatTexObs() // in case dupliMtx_list not empty, make sure that there is at least one source object // in all_objects with the name given in dupliMtx_list - if (dupliMtx_list.size()!=0) { + if (!dupliMtx_list.empty()) { for (map<Object*, vector<VlakRen*> >::const_iterator obn=all_objects.begin(); obn!=all_objects.end();++obn) { Object* obj = obn->first; - if (obj->flag & OB_YAF_DUPLISOURCE) dup_srcob[string(obj->id.name)] = obj; + string obname = obj->id.name; + if (dupliMtx_list.find(obname)!=dupliMtx_list.end()) dup_srcob[obname] = obj; } // if the name reference list is empty, return now, something was seriously wrong - if (dup_srcob.size()==0) { + if (dup_srcob.empty()) { // error() doesn't work to well, when switching from Blender to console at least, so use stdout instead cout << "ERROR: Duplilist non_empty, but no srcobs\n"; return false; } - // else make sure every object is found in dupliMtx_list - for (map<string, Object*>::const_iterator obn2=dup_srcob.begin(); - obn2!=dup_srcob.end();++obn2) - { - if (dupliMtx_list.find(obn2->first)==dupliMtx_list.end()) { - cout << "ERROR: Source ob missing for dupli's\n"; - return false; - } - } } return true; @@ -180,12 +172,10 @@ bool yafrayRender_t::objectKnownData(Object* obj) { // if object data already known, no need to include in renderlist, otherwise save object datapointer if (objectData.find(obj->data)!=objectData.end()) { - // set OB_YAF_DUPLISOURCE flag for known object Object* orgob = objectData[obj->data]; - orgob->flag |= OB_YAF_DUPLISOURCE; // first save original object matrix in dupliMtx_list, if not added yet if (dupliMtx_list.find(orgob->id.name)==dupliMtx_list.end()) { - cout << "Added orignal matrix\n"; + cout << "Added original matrix\n"; addDupliMtx(orgob); } // then save matrix of linked object in dupliMtx_list, using name of ORIGINAL object @@ -198,6 +188,3 @@ bool yafrayRender_t::objectKnownData(Object* obj) objectData[obj->data] = obj; return false; } - - - |