Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo de Greef <eeshlo@yahoo.com>2004-11-14 07:30:28 +0300
committerAlfredo de Greef <eeshlo@yahoo.com>2004-11-14 07:30:28 +0300
commita61677f37f41c46f19dcead10de74440262cfbf8 (patch)
tree0a673f9eb4db4d4c20f2ff6393c7cc211ecc13ac
parenta7d624b2c1bd73b18905aecf19ba263c6c06b4db (diff)
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.
-rw-r--r--source/blender/src/buttons_scene.c2
-rwxr-xr-xsource/blender/yafray/intern/export_File.cpp28
-rw-r--r--source/blender/yafray/intern/export_Plugin.cpp26
-rw-r--r--source/blender/yafray/intern/yafray_Render.cpp20
4 files changed, 47 insertions, 29 deletions
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 693486208bf..e804484a01d 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -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)
{
diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp
index 4bae9520a90..7b34404a205 100755
--- a/source/blender/yafray/intern/export_File.cpp
+++ b/source/blender/yafray/intern/export_File.cpp
@@ -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();
+ }
}
}
diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp
index 0db51bb0120..8470adf86c7 100644
--- a/source/blender/yafray/intern/export_Plugin.cpp
+++ b/source/blender/yafray/intern/export_Plugin.cpp
@@ -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);
+ }
}
}
diff --git a/source/blender/yafray/intern/yafray_Render.cpp b/source/blender/yafray/intern/yafray_Render.cpp
index c0bf86b1840..ba5121858e6 100644
--- a/source/blender/yafray/intern/yafray_Render.cpp
+++ b/source/blender/yafray/intern/yafray_Render.cpp
@@ -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;
}