Changed: #1092 Fixed several issues concerning export with lightmaps.

This commit is contained in:
kaetemi 2011-09-20 16:21:37 +02:00
parent 794c014036
commit 67766dc2ed
3 changed files with 39 additions and 19 deletions

View file

@ -288,6 +288,14 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime)
string tmp = *ntExclu.Addr(i); string tmp = *ntExclu.Addr(i);
this->setExclusion.insert(tmp); this->setExclusion.insert(tmp);
} }
#else // (MAX_RELEASE < 4000)
ExclList& exclusionList = maxLight->GetExclusionList();
for (sint i = 0; i < exclusionList.Count(); ++i)
{
INode *exclNode = exclusionList[i];
string tmp = exclNode->GetName();
this->setExclusion.insert(tmp);
}
#endif // (MAX_RELEASE < 4000) #endif // (MAX_RELEASE < 4000)
// Get Soft Shadow informations // Get Soft Shadow informations
@ -1999,11 +2007,12 @@ void CExportNel::deleteLM(INode& ZeNode)
sprintf( tmp, "%d", i ); sprintf( tmp, "%d", i );
sSaveName += tmp; sSaveName += tmp;
sSaveName += ".tga"; sSaveName += ".tga";
FILE *file; if (CFile::fileExists(sSaveName))
if( file = fopen(sSaveName.c_str(),"rb") )
{ {
fclose( file ); if (!CFile::deleteFile(sSaveName))
DeleteFile( sSaveName.c_str() ); {
nlwarning("Failed to delete file %s.", sSaveName.c_str());
}
} }
} }
} }
@ -2576,11 +2585,12 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
for (i = 0; i < 256; ++i) for (i = 0; i < 256; ++i)
{ {
string sLMName = sBaseName + NLMISC::toString(i) + ".tga"; string sLMName = sBaseName + NLMISC::toString(i) + ".tga";
CIFile ifi; if (CFile::fileExists(sLMName))
if (ifi.open(sLMName))
{ {
ifi.close (); if (!CFile::deleteFile(sLMName))
DeleteFile (sLMName.c_str()); {
nlwarning("Failed to delete file %s.", sLMName.c_str());
}
} }
} }
} }

View file

@ -36,7 +36,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time)
// if not found, get from the APP_DATAS // if not found, get from the APP_DATAS
shapeName = CExportNel::getNelObjectName(node); shapeName = CExportNel::getNelObjectName(node);
if (shapeName.empty()) return NULL; if (shapeName.empty()) return NULL;
shapeName = NLMISC::CPath::lookup("shapeName", false); shapeName = NLMISC::CPath::lookup(shapeName, false);
if (shapeName.empty()) return NULL; if (shapeName.empty()) return NULL;
} }

View file

@ -24,6 +24,7 @@
#include "../nel_patch_lib/rpo.h" #include "../nel_patch_lib/rpo.h"
#include "../../ig_lighter_lib/ig_lighter_lib.h" #include "../../ig_lighter_lib/ig_lighter_lib.h"
#include "nel/misc/path.h"
#include "nel/3d/scene_group.h" #include "nel/3d/scene_group.h"
#include "nel/3d/scene.h" #include "nel/3d/scene.h"
#include "nel/3d/shape_bank.h" #include "nel/3d/shape_bank.h"
@ -418,12 +419,21 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
if (clid.PartA() == NEL_PARTICLE_SYSTEM_CLASS_ID) if (clid.PartA() == NEL_PARTICLE_SYSTEM_CLASS_ID)
{ {
// build the shape from the file name // build the shape from the file name
std::string objName = CExportNel::getNelObjectName(*pNode); // std::string objName = CExportNel::getNelObjectName(*pNode);
if (!objName.empty()) std::string psFilePath;
// try to get the complete path
if (!CExportNel::getValueByNameUsingParamBlock2(*pNode, "ps_file_name", (ParamType2) TYPE_STRING, &psFilePath, 0))
{
// if not found, get from the APP_DATAS
psFilePath = CExportNel::getNelObjectName(*pNode);
if (!psFilePath.empty())
psFilePath = CPath::lookup(psFilePath, false);
}
if (!psFilePath.empty())
{ {
NL3D::CShapeStream ss; NL3D::CShapeStream ss;
NLMISC::CIFile iF; NLMISC::CIFile iF;
if (iF.open(objName.c_str())) if (iF.open(psFilePath.c_str()))
{ {
try try
{ {