Eeshlo fixed the iYFexport path problem and added a file selector button
for it. Now win32 users should have less problems. I added export of the "no shadow" flag (traceable) And changed the reflection export scheme so now blender's RayMir is used as yafray's min_refle and the amount of reflection is controled by the mir color. This seems more intuitive. And now IOR is exported also for reflection only, wich is needed for fresnel.
This commit is contained in:
@@ -299,6 +299,8 @@
|
||||
#define B_PYTHONDIRFILESEL 335
|
||||
#define B_SOUNDDIRFILESEL 336
|
||||
#define B_TEMPDIRFILESEL 337
|
||||
/* yafray: for exportdir select */
|
||||
#define B_YAFRAYDIRFILESEL 338
|
||||
/* END Definitions for the fileselect buttons in user prefs */
|
||||
|
||||
/* IMAGE: 350 */
|
||||
|
||||
@@ -559,6 +559,16 @@ static void show_splash(void)
|
||||
|
||||
/* Functions for user preferences fileselect windows */
|
||||
|
||||
/* yafray: export dir select */
|
||||
void filesel_u_yfexportdir(char *name)
|
||||
{
|
||||
char dir[FILE_MAXDIR], file[FILE_MAXFILE];
|
||||
BLI_split_dirfile(name, dir, file);
|
||||
|
||||
strcpy(U.yfexportdir, dir);
|
||||
allqueue(REDRAWALL, 0);
|
||||
}
|
||||
|
||||
void filesel_u_fontdir(char *name)
|
||||
{
|
||||
char dir[FILE_MAXDIR], file[FILE_MAXFILE];
|
||||
@@ -1437,6 +1447,16 @@ void do_global_buttons(unsigned short event)
|
||||
|
||||
/* Fileselect windows for user preferences file paths */
|
||||
|
||||
/* yafray: xml export dir. select */
|
||||
case B_YAFRAYDIRFILESEL: /* space.c */
|
||||
if(curarea->spacetype==SPACE_INFO) {
|
||||
sa= closest_bigger_area();
|
||||
areawinset(sa->win);
|
||||
}
|
||||
|
||||
activate_fileselect(FILE_SPECIAL, "SELECT YFEXPORT PATH", U.yfexportdir, filesel_u_yfexportdir);
|
||||
break;
|
||||
|
||||
case B_FONTDIRFILESEL: /* is button from space.c *info* */
|
||||
if(curarea->spacetype==SPACE_INFO) {
|
||||
sa= closest_bigger_area();
|
||||
|
||||
@@ -2416,11 +2416,14 @@ void drawinfospace(ScrArea *sa, void *spacedata)
|
||||
|
||||
} else if(U.userpref == 5) { /* file paths */
|
||||
|
||||
/* yafray: (temporary) path button for yafray xml export, without fileselect */
|
||||
/* yafray: (temporary) path button for yafray xml export, now with fileselect */
|
||||
uiDefBut(block, TEX, 0, "YFexport: ",
|
||||
(xpos+edgespace), y2+buth+rspace, largeprefbut, buth,
|
||||
(xpos+edgespace), y2+buth+rspace, largeprefbut-smfileselbut, buth,
|
||||
U.yfexportdir, 1.0, 63.0, 0, 0,
|
||||
"The default directory for yafray xml export (must exist!)");
|
||||
uiDefIconBut(block, BUT, B_YAFRAYDIRFILESEL, ICON_FILESEL,
|
||||
(xpos+edgespace+largeprefbut-smfileselbut), y2+buth+rspace, smfileselbut, buth,
|
||||
0, 0, 0, 0, 0, "Select the default yafray export directory");
|
||||
|
||||
uiDefBut(block, TEX, 0, "Fonts: ",
|
||||
(xpos+edgespace),y2,(largeprefbut-smfileselbut),buth,
|
||||
|
||||
@@ -43,13 +43,16 @@ bool yafrayRender_t::exportScene()
|
||||
}
|
||||
|
||||
string xmlpath = U.yfexportdir;
|
||||
|
||||
#ifdef WIN32
|
||||
imgout = xmlpath + "\\YBtest.tga";
|
||||
xmlpath += "\\YBtest.xml";
|
||||
string DLM = "\\";
|
||||
#else
|
||||
imgout = xmlpath + "/YBtest.tga";
|
||||
xmlpath += "/YBtest.xml";
|
||||
string DLM = "/";
|
||||
#endif
|
||||
if (xmlpath.find_last_of(DLM)!=(xmlpath.length()-1)) xmlpath += DLM;
|
||||
|
||||
imgout = xmlpath + "YBtest.tga";
|
||||
xmlpath += "YBtest.xml";
|
||||
|
||||
maxraydepth = 5; // will be set to maximum depth used in blender materials
|
||||
|
||||
@@ -521,14 +524,16 @@ void yafrayRender_t::writeMaterialsAndModulators()
|
||||
ostr << "\t\t<emit value=\"" << matr->emit << "\" />\n";
|
||||
|
||||
// reflection/refraction
|
||||
if ( (matr->mode & MA_RAYMIRROR) || (matr->mode & MA_RAYTRANSP) )
|
||||
ostr << "\t\t<IOR value=\"" << matr->ang << "\" />\n";
|
||||
if (matr->mode & MA_RAYMIRROR) {
|
||||
float rf = matr->ray_mirror;
|
||||
// blender uses mir color for reflection as well
|
||||
ostr << "\t\t<reflected r=\"" << matr->mirr*rf << "\" g=\"" << matr->mirg*rf << "\" b=\"" << matr->mirb*rf << "\" />\n";
|
||||
ostr << "\t\t<reflected r=\"" << matr->mirr << "\" g=\"" << matr->mirg << "\" b=\"" << matr->mirb << "\" />\n";
|
||||
ostr << "\t\t<min_refle value=\""<< rf << "\" />\n";
|
||||
if (matr->ray_depth) maxraydepth = matr->ray_depth;
|
||||
}
|
||||
if (matr->mode & MA_RAYTRANSP) {
|
||||
ostr << "\t\t<IOR value=\"" << matr->ang << "\" />\n";
|
||||
// blender refraction color always white?
|
||||
//ostr << "\t\t<transmitted r=\"" << matr->r << "\" g=\"" << matr->g << "\" b=\"" << matr->b << "\" />\n";
|
||||
ostr << "\t\t<transmitted r=\"1\" g=\"1\" b=\"1\" />\n";
|
||||
@@ -703,6 +708,8 @@ void yafrayRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_list,
|
||||
// since we write a shader with every face, simply use the material of the first face
|
||||
// if this is an empty string, assume default mat
|
||||
char* matname = VLR_list[0]->mat->id.name;
|
||||
bool shadow=VLR_list[0]->mat->mode & MA_TRACEBLE;
|
||||
ostr <<" shadow=\""<< (shadow ? "on" : "off" )<<"\" ";
|
||||
if (strlen(matname)==0) matname = "blender_default"; else matname+=2; //skip MA id
|
||||
ostr << " shader_name=\"" << matname << "\" >\n";
|
||||
ostr << "\t<attributes>\n\t</attributes>\n";
|
||||
|
||||
Reference in New Issue
Block a user