Minor modification of image texture export of 'TexFace' mode materials
which could have become a possible problem in the future. Refinement button alignement in GI panel.
This commit is contained in:
@@ -1313,7 +1313,7 @@ static void render_panel_yafrayGI()
|
||||
if (G.scene->r.GIpixelspersample==0) G.scene->r.GIpixelspersample=10;
|
||||
uiDefButI(block, NUM, B_DIFF, "Prec:", 5,60,75,20, &G.scene->r.GIpixelspersample, 1, 50, 10, 10, "Maximum number of pixels without samples, the lower the better and slower");
|
||||
if (G.scene->r.GIrefinement==0) G.scene->r.GIrefinement=1.0;
|
||||
uiDefButF(block, NUM, B_DIFF, "Ref:", 80,60,75,20, &G.scene->r.GIrefinement, 0.001, 1.0, 1, 0, "Threshold to refine shadows EXPERIMENTAL. 1 = no refinement");
|
||||
uiDefButF(block, NUM, B_DIFF, "Ref:", 84,60,75,20, &G.scene->r.GIrefinement, 0.001, 1.0, 1, 0, "Threshold to refine shadows EXPERIMENTAL. 1 = no refinement");
|
||||
}
|
||||
if (G.scene->r.GIphotons)
|
||||
{
|
||||
|
||||
@@ -342,6 +342,10 @@ static string noise2string(short nbtype)
|
||||
|
||||
void yafrayFileRender_t::writeTextures()
|
||||
{
|
||||
// used to keep track of images already written
|
||||
// (to avoid duplicates if also in imagetex for material TexFace texture)
|
||||
map<Image*, bool> dupimg;
|
||||
|
||||
string ts;
|
||||
for (map<string, MTex*>::const_iterator blendtex=used_textures.begin();
|
||||
blendtex!=used_textures.end();++blendtex) {
|
||||
@@ -489,8 +493,9 @@ void yafrayFileRender_t::writeTextures()
|
||||
case TEX_IMAGE: {
|
||||
Image* ima = tex->ima;
|
||||
if (ima) {
|
||||
// remove from imagetex list to avoid possible duplicates when TexFace used
|
||||
imagetex.erase(ima);
|
||||
// remember image to avoid duplicates later if also in imagetex
|
||||
// (formerly done by removing from imagetex, but need image/material link)
|
||||
dupimg[ima] = true;
|
||||
ostr.str("");
|
||||
// use image name instead of texname here
|
||||
ostr << "<shader type=\"image\" name=\"" << ima->id.name << "\" >\n";
|
||||
@@ -536,14 +541,17 @@ void yafrayFileRender_t::writeTextures()
|
||||
for (map<Image*, Material*>::const_iterator imgtex=imagetex.begin();
|
||||
imgtex!=imagetex.end();++imgtex)
|
||||
{
|
||||
ostr.str("");
|
||||
ostr << "<shader type=\"image\" name=\"" << imgtex->first->id.name << "\" >\n";
|
||||
ostr << "\t<attributes>\n";
|
||||
string texpath(imgtex->first->name);
|
||||
adjustPath(texpath);
|
||||
ostr << "\t\t<filename value=\"" << texpath << "\" />\n";
|
||||
ostr << "\t</attributes>\n</shader>\n\n";
|
||||
xmlfile << ostr.str();
|
||||
// skip if already written above
|
||||
if (dupimg.find(imgtex->first)==dupimg.end()) {
|
||||
ostr.str("");
|
||||
ostr << "<shader type=\"image\" name=\"" << imgtex->first->id.name << "\" >\n";
|
||||
ostr << "\t<attributes>\n";
|
||||
string texpath(imgtex->first->name);
|
||||
adjustPath(texpath);
|
||||
ostr << "\t\t<filename value=\"" << texpath << "\" />\n";
|
||||
ostr << "\t</attributes>\n</shader>\n\n";
|
||||
xmlfile << ostr.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -346,6 +346,10 @@ static string noise2string(short nbtype)
|
||||
|
||||
void yafrayPluginRender_t::writeTextures()
|
||||
{
|
||||
// used to keep track of images already written
|
||||
// (to avoid duplicates if also in imagetex for material TexFace texture)
|
||||
map<Image*, bool> dupimg;
|
||||
|
||||
string ts;
|
||||
yafray::paramMap_t params;
|
||||
list<yafray::paramMap_t> lparams;
|
||||
@@ -407,8 +411,9 @@ void yafrayPluginRender_t::writeTextures()
|
||||
{
|
||||
Image* ima = tex->ima;
|
||||
if (ima) {
|
||||
// remove from imagetex list to avoid possible duplicates when TexFace used
|
||||
imagetex.erase(ima);
|
||||
// remember image to avoid duplicates later if also in imagetex
|
||||
// (formerly done by removing from imagetex, but need image/material link)
|
||||
dupimg[ima] = true;
|
||||
params["type"] = yafray::parameter_t("image");
|
||||
params["name"] = yafray::parameter_t(ima->id.name);
|
||||
string texpath = ima->name;
|
||||
@@ -529,13 +534,16 @@ void yafrayPluginRender_t::writeTextures()
|
||||
for (map<Image*, Material*>::const_iterator imgtex=imagetex.begin();
|
||||
imgtex!=imagetex.end();++imgtex)
|
||||
{
|
||||
params.clear();
|
||||
params["name"] = yafray::parameter_t(imgtex->first->id.name);
|
||||
params["type"] = yafray::parameter_t("image");
|
||||
string texpath(imgtex->first->name);
|
||||
adjustPath(texpath);
|
||||
params["filename"] = yafray::parameter_t(texpath);
|
||||
yafrayGate->addShader(params, lparams);
|
||||
// skip if already written above
|
||||
if (dupimg.find(imgtex->first)==dupimg.end()) {
|
||||
params.clear();
|
||||
params["name"] = yafray::parameter_t(imgtex->first->id.name);
|
||||
params["type"] = yafray::parameter_t("image");
|
||||
string texpath(imgtex->first->name);
|
||||
adjustPath(texpath);
|
||||
params["filename"] = yafray::parameter_t(texpath);
|
||||
yafrayGate->addShader(params, lparams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// YafRay XML export
|
||||
// YafRay export
|
||||
//
|
||||
// For anyone else looking at this, this was designed for a tabspacing of 2 (YafRay/Jandro standard :)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -124,13 +124,15 @@ bool yafrayRender_t::getAllMatTexObs()
|
||||
if (vlr->ob) {
|
||||
int nv = 0; // number of vertices
|
||||
if (vlr->v4) nv=4; else if (vlr->v3) nv=3;
|
||||
if (nv) all_objects[vlr->ob].push_back(vlr);
|
||||
if (vlr->tface) {
|
||||
Image* fc_img = (Image*)vlr->tface->tpage;
|
||||
if (fc_img) {
|
||||
Material* fmat = vlr->mat;
|
||||
// only save if TexFace enabled
|
||||
if (fmat && (fmat->mode & MA_FACETEXTURE)) imagetex[fc_img] = fmat;
|
||||
if (nv) {
|
||||
all_objects[vlr->ob].push_back(vlr);
|
||||
if (vlr->tface) {
|
||||
Image* fc_img = (Image*)vlr->tface->tpage;
|
||||
if (fc_img) {
|
||||
Material* fmat = vlr->mat;
|
||||
// only save if TexFace enabled
|
||||
if (fmat && (fmat->mode & MA_FACETEXTURE)) imagetex[fc_img] = fmat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,7 +153,7 @@ bool yafrayRender_t::getAllMatTexObs()
|
||||
|
||||
// if the name reference list is empty, return now, something was seriously wrong
|
||||
if (dup_srcob.empty()) {
|
||||
// error() doesn't work to well, when switching from Blender to console at least, so use stdout instead
|
||||
// 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user