corrected particle object dupliverts and aramature duplivert export problems
corrected power slider increment update
This commit is contained in:
parent
8139587af5
commit
41144750da
|
@ -278,8 +278,6 @@ extern Object workob;
|
|||
#define OB_DONE 1024
|
||||
#define OB_RADIO 2048
|
||||
#define OB_FROMGROUP 4096
|
||||
/* yafray: flag to indicate this object is a source object for duplivert instancing, see convertBlenderScene.c */
|
||||
#define OB_YAF_DUPLISOURCE 8192
|
||||
|
||||
/* ob->gameflag */
|
||||
#define OB_DYNAMIC 1
|
||||
|
|
|
@ -2855,12 +2855,9 @@ void RE_rotateBlenderScene(void)
|
|||
ob= G.main->object.first;
|
||||
while(ob) {
|
||||
ob->flag &= ~OB_DONE;
|
||||
/* yafray: OB_YAF_DUPLISOURCE flag should be cleared as well here, otherwise is saved in .blend */
|
||||
ob->flag &= ~OB_YAF_DUPLISOURCE;
|
||||
ob= ob->id.next;
|
||||
}
|
||||
|
||||
|
||||
/* layers: render in foreground current 3D window */
|
||||
lay= G.scene->lay;
|
||||
if(G.vd) lay= G.vd->lay;
|
||||
|
@ -2876,15 +2873,15 @@ void RE_rotateBlenderScene(void)
|
|||
This only works for dupliverts, dupliframes handled below.
|
||||
This is based on the assumption that OB_DONE is only set for duplivert objects,
|
||||
before scene conversion, there are no other flags set to indicate it's use as far as I know...
|
||||
A special flag only used by yafray is set to indicate this object is the 'source' object
|
||||
of which all other duplivert objects are an instance of.
|
||||
Correction: NOT done for lamps, these are included as separate objects, see below */
|
||||
if ((ob->type!=OB_LAMP) && (R.r.mode & R_YAFRAY)) {
|
||||
NOT done for lamps, these are included as separate objects, see below.
|
||||
correction: also ignore lattices, armatures and camera's (.....) */
|
||||
if ((ob->type!=OB_LATTICE) && (ob->type!=OB_ARMATURE) &&
|
||||
(ob->type!=OB_LAMP) && (ob->type!=OB_CAMERA) && (R.r.mode & R_YAFRAY))
|
||||
{
|
||||
printf("Adding %s to renderlist\n", ob->id.name);
|
||||
ob->flag &= ~OB_DONE;
|
||||
init_render_object(ob);
|
||||
ob->flag |= OB_DONE;
|
||||
ob->flag |= OB_YAF_DUPLISOURCE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -2900,7 +2897,6 @@ void RE_rotateBlenderScene(void)
|
|||
if ((ob->type!=OB_MBALL) && ((ob->transflag & OB_DUPLIFRAMES)!=0)) {
|
||||
printf("Object %s has OB_DUPLIFRAMES set, adding to renderlist\n", ob->id.name);
|
||||
init_render_object(ob);
|
||||
ob->flag |= OB_YAF_DUPLISOURCE;
|
||||
}
|
||||
}
|
||||
make_duplilist(sce, ob);
|
||||
|
@ -2929,8 +2925,11 @@ void RE_rotateBlenderScene(void)
|
|||
/* yafray: special handling of duplivert objects for yafray:
|
||||
only the matrix is stored, together with the source object name.
|
||||
Since the original object is needed as well, it is included in the renderlist (see above)
|
||||
correction: NOT done for lamps, these need to be included as normal lamps separately */
|
||||
if ((obd->type!=OB_LAMP) && (R.r.mode & R_YAFRAY)) {
|
||||
NOT done for lamps, these need to be included as normal lamps separately
|
||||
correction: also ignore lattices, armatures and cameras (....) */
|
||||
if ((obd->type!=OB_LATTICE) && (obd->type!=OB_ARMATURE) &&
|
||||
(obd->type!=OB_LAMP) && (obd->type!=OB_CAMERA) && (R.r.mode & R_YAFRAY))
|
||||
{
|
||||
printf("Adding dupli matrix for object %s\n", obd->id.name);
|
||||
YAF_addDupliMtx(obd);
|
||||
}
|
||||
|
@ -2944,8 +2943,7 @@ void RE_rotateBlenderScene(void)
|
|||
else {
|
||||
/* yafray: if there are linked data objects (except lamps),
|
||||
yafray only needs to know about one, the rest can be instanciated.
|
||||
The dupliMtx list is used for this purpose, so the test function sets the OB_YAF_DUPLISOURCE
|
||||
flag when for the already known object as well. */
|
||||
The dupliMtx list is used for this purpose */
|
||||
if (R.r.mode & R_YAFRAY) {
|
||||
if ((ob->type!=OB_LAMP) && (YAF_objectKnownData(ob)))
|
||||
printf("Added dupli matrix for linked data object %s\n", ob->id.name);
|
||||
|
|
|
@ -1219,7 +1219,7 @@ static void render_panel_yafrayGI()
|
|||
|
||||
if (G.scene->r.GImethod>0) {
|
||||
if (G.scene->r.GIpower==0) G.scene->r.GIpower=1;
|
||||
uiDefButF(block, NUM, 0, "Power:", 5,35,154,20, &G.scene->r.GIpower, 0.01, 100.0, 0, 0, "GI lighting intensity scale, 1 is normal");
|
||||
uiDefButF(block, NUM, 0, "Power:", 5,35,154,20, &G.scene->r.GIpower, 0.01, 10.0, 10, 0, "GI lighting intensity scale, 1 is normal");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1269,10 +1269,8 @@ static void render_panel_yafrayGlobal()
|
|||
// label to force a boundbox for buttons not to be centered
|
||||
uiDefBut(block, LABEL, 0, " ", 305,180,10,10, 0, 0, 0, 0, 0, "");
|
||||
|
||||
if(G.scene->r.YF_raybias==0.0) G.scene->r.YF_raybias=0.001;
|
||||
uiDefButF(block, NUMSLI, 0,"Bi ", 5,35,150,20, &(G.scene->r.YF_raybias),
|
||||
0.0, 10.0 ,0,0, "Shadow ray bias to avoid self shadowing");
|
||||
if(G.scene->r.YF_raydepth==0) G.scene->r.YF_raydepth=5;
|
||||
uiDefButI(block, NUM, 0, "Raydepth ", 5,60,150,20,
|
||||
&G.scene->r.YF_raydepth, 1.0, 80.0, 10, 10, "Maximum render ray depth from the camera");
|
||||
uiDefButF(block, NUMSLI, 0, "Gam ", 5,10,150,20, &G.scene->r.YF_gamma, 0.001, 5.0, 0, 0, "Gamma correction, 1 is off");
|
||||
|
@ -1291,9 +1289,11 @@ void render_panels()
|
|||
render_panel_render();
|
||||
render_panel_anim();
|
||||
render_panel_format();
|
||||
/* yafray: GI panel only available when yafray enabled for rendering */
|
||||
/* yafray: GI & Global panel, only available when yafray enabled for rendering */
|
||||
if (G.scene->r.mode & R_YAFRAY) {
|
||||
if (G.scene->r.YF_gamma==0.0) G.scene->r.YF_gamma=1.0;
|
||||
if (G.scene->r.YF_raybias==0.0) G.scene->r.YF_raybias=0.001;
|
||||
if (G.scene->r.YF_raydepth==0) G.scene->r.YF_raydepth=5;
|
||||
render_panel_yafrayGlobal();
|
||||
render_panel_yafrayGI();
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue