mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Deprecate plFileUtils and parts of pnUtPath
This commit is contained in:
@ -71,7 +71,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plSurface/hsGMaterial.h"
|
||||
#include "pnSceneObject/plSceneObject.h"
|
||||
#include "UserPropMgr.h"
|
||||
#include "plFile/plFileUtils.h"
|
||||
|
||||
#include "hsConverterUtils.h"
|
||||
#include "hsControlConverter.h"
|
||||
@ -1981,18 +1980,17 @@ static plLayerInterface* IProcessLayerMovie(plPassMtlBase* mtl, plLayerTex* layT
|
||||
if( !bi || !bi->Name() || !*bi->Name() )
|
||||
return layerIFace;
|
||||
|
||||
const char* fileName = bi->Name();
|
||||
plFileName fileName = bi->Name();
|
||||
|
||||
plAnimStealthNode* stealth = IGetEntireAnimation(mtl);
|
||||
|
||||
const char* ext = plFileUtils::GetFileExt(fileName);
|
||||
bool isBink = ext && (stricmp(ext, "bik") == 0);
|
||||
bool isAvi = ext &&(stricmp(ext, "avi") == 0);
|
||||
plString ext = fileName.GetFileExt();
|
||||
bool isBink = (ext.CompareI("bik") == 0);
|
||||
bool isAvi = (ext.CompareI("avi") == 0);
|
||||
|
||||
if (isBink || isAvi)
|
||||
{
|
||||
char movieName[256];
|
||||
sprintf(movieName, "avi/%s", plFileUtils::GetFileName(fileName));
|
||||
plFileName movieName = plFileName::Join("avi", fileName.GetFileName());
|
||||
|
||||
plLayerMovie* movieLayer = nil;
|
||||
plString moviePostfix;
|
||||
|
@ -134,7 +134,7 @@ plMipmap *plBitmapCreator::ICreateBitmap(plBitmapData *bd)
|
||||
|
||||
// Load the bitmap
|
||||
BitmapInfo bi;
|
||||
bi.SetName(bd->fileName);
|
||||
bi.SetName(bd->fileName.AsString().c_str());
|
||||
|
||||
#if 0 // This isn't really an issue since the textures are packed -Colin
|
||||
const int kMaxFileNameLength = 30;
|
||||
@ -267,20 +267,20 @@ plMipmap *plBitmapCreator::ICreateBitmap(plBitmapData *bd)
|
||||
//
|
||||
// Verify that bitmap is the correct type/size
|
||||
//
|
||||
void plBitmapCreator::ICheckOutBitmap(BitmapInfo* bInfo, Bitmap* bm, const char *fileName)
|
||||
void plBitmapCreator::ICheckOutBitmap(BitmapInfo* bInfo, Bitmap* bm, const plFileName& fileName)
|
||||
{
|
||||
hsGuardBegin("hsConverterUtils::ICheckOutBitmap");
|
||||
|
||||
// Check out bitmap
|
||||
if (bm->Flags() & MAP_FLIPPED)
|
||||
MessageBox(GetActiveWindow(), "Bitmap is flipped horizontally", fileName, MB_OK);
|
||||
MessageBox(GetActiveWindow(), "Bitmap is flipped horizontally", fileName.AsString().c_str(), MB_OK);
|
||||
if (bm->Flags() & MAP_INVERTED)
|
||||
MessageBox(GetActiveWindow(), "Bitmap is inverted vertically", fileName, MB_OK);
|
||||
MessageBox(GetActiveWindow(), "Bitmap is inverted vertically", fileName.AsString().c_str(), MB_OK);
|
||||
|
||||
if (bInfo->Flags() & MAP_FLIPPED)
|
||||
MessageBox(GetActiveWindow(), "BI:Bitmap is flipped horizontally", fileName, MB_OK);
|
||||
MessageBox(GetActiveWindow(), "BI:Bitmap is flipped horizontally", fileName.AsString().c_str(), MB_OK);
|
||||
if (bInfo->Flags() & MAP_INVERTED)
|
||||
MessageBox(GetActiveWindow(), "BI:Bitmap is inverted vertically", fileName, MB_OK);
|
||||
MessageBox(GetActiveWindow(), "BI:Bitmap is inverted vertically", fileName.AsString().c_str(), MB_OK);
|
||||
|
||||
hsGuardEnd;
|
||||
}
|
||||
@ -480,10 +480,10 @@ plBitmap *plBitmapCreator::CreateTexture(plBitmapData *bd, const plLocation &loc
|
||||
|
||||
for (int i = 0; i < plLocalization::GetNumLocales(); i++)
|
||||
{
|
||||
char localName[MAX_PATH];
|
||||
if (plLocalization::ExportGetLocalized(bd->fileName, i, localName))
|
||||
plFileName localName = plLocalization::ExportGetLocalized(bd->fileName, i);
|
||||
if (localName.IsValid())
|
||||
{
|
||||
const char* oldName = bd->fileName;
|
||||
plFileName oldName = bd->fileName;
|
||||
bd->fileName = localName;
|
||||
ICreateTexture(bd, loc, clipID);
|
||||
bd->fileName = oldName;
|
||||
@ -517,40 +517,39 @@ plBitmap *plBitmapCreator::ICreateTexture( plBitmapData *bd, const plLocation &l
|
||||
return nil;
|
||||
}
|
||||
|
||||
if( bd->fileName == nil || bd->fileName[ 0 ] == 0 )
|
||||
if (!bd->fileName.IsValid())
|
||||
{
|
||||
fErrorMsg->Set( true, "Bitmap Error", "Material texture has null bitmap name." ).Show();
|
||||
fErrorMsg->Set();
|
||||
fErrorMsg->Set();
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Get and mangle key name
|
||||
plString name;
|
||||
char temp[ 256 ];
|
||||
_splitpath(bd->fileName, NULL, NULL, temp, NULL);
|
||||
plString temp = bd->fileName.GetFileNameNoExt();
|
||||
|
||||
// Somehow, sometimes, we get the same file in with different cases. So we need to force the
|
||||
// case identical all the time, else the patching process for dat files will think they're
|
||||
// "different" when they're really not
|
||||
strlwr( temp );
|
||||
temp = temp.ToLower();
|
||||
|
||||
/// Mangle name for detail textures, so we don't end up overwriting settings elsewhere
|
||||
if( bd->createFlags & plMipmap::kCreateDetailMask )
|
||||
{
|
||||
// Mangle of the form: name@dropStart&dropStop&max&min
|
||||
if( clipID != -1 )
|
||||
name = plString::Format( "%s*%x#%d@%s&%3.2f&%3.2f&%3.2f&%3.2f", temp, bd->texFlags, clipID,
|
||||
name = plString::Format( "%s*%x#%d@%s&%3.2f&%3.2f&%3.2f&%3.2f", temp.c_str(), bd->texFlags, clipID,
|
||||
bd->createFlags & plMipmap::kCreateDetailAlpha ? "al" : ( bd->createFlags & plMipmap::kCreateDetailAdd ? "ad" : "mu" ),
|
||||
bd->detailDropoffStart, bd->detailDropoffStop, bd->detailMax, bd->detailMin );
|
||||
else
|
||||
name = plString::Format( "%s*%x@%s&%3.2f&%3.2f&%3.2f&%3.2f", temp, bd->texFlags,
|
||||
name = plString::Format( "%s*%x@%s&%3.2f&%3.2f&%3.2f&%3.2f", temp.c_str(), bd->texFlags,
|
||||
bd->createFlags & plMipmap::kCreateDetailAlpha ? "al" : ( bd->createFlags == plMipmap::kCreateDetailAdd ? "ad" : "mu" ),
|
||||
bd->detailDropoffStart, bd->detailDropoffStop, bd->detailMax, bd->detailMin );
|
||||
}
|
||||
else if( clipID != -1 )
|
||||
name = plString::Format( "%s*%x#%d", temp, bd->texFlags, clipID );
|
||||
name = plString::Format( "%s*%x#%d", temp.c_str(), bd->texFlags, clipID );
|
||||
else
|
||||
name = plString::Format( "%s*%x", temp, bd->texFlags );
|
||||
name = plString::Format( "%s*%x", temp.c_str(), bd->texFlags );
|
||||
if( bd->invertAlpha )
|
||||
name += "_inva";
|
||||
name += ".hsm";
|
||||
@ -566,7 +565,7 @@ plBitmap *plBitmapCreator::ICreateTexture( plBitmapData *bd, const plLocation &l
|
||||
if( texture )
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileAttrib;
|
||||
GetFileAttributesEx(bd->fileName, GetFileExInfoStandard, &fileAttrib);
|
||||
GetFileAttributesExW(bd->fileName.AsString().ToWchar(), GetFileExInfoStandard, &fileAttrib);
|
||||
FILETIME &fileTime = fileAttrib.ftLastWriteTime;
|
||||
|
||||
// If this texture has been modified since the last export, delete the old version but reuse the key
|
||||
@ -652,7 +651,7 @@ plBitmap *plBitmapCreator::ICreateTexture( plBitmapData *bd, const plLocation &l
|
||||
|
||||
// Texture reuse optimization
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileAttrib;
|
||||
GetFileAttributesEx(bd->fileName, GetFileExInfoStandard, &fileAttrib);
|
||||
GetFileAttributesExW(bd->fileName.AsString().ToWchar(), GetFileExInfoStandard, &fileAttrib);
|
||||
FILETIME &fileTime = fileAttrib.ftLastWriteTime;
|
||||
texture->SetModifiedTime(fileTime.dwLowDateTime, fileTime.dwHighDateTime);
|
||||
|
||||
|
@ -40,6 +40,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "plFileSystem.h"
|
||||
|
||||
class BitmapInfo;
|
||||
class Bitmap;
|
||||
class plBitmap;
|
||||
@ -59,7 +61,7 @@ public:
|
||||
kClampV = 0x02
|
||||
};
|
||||
|
||||
const char *fileName;
|
||||
plFileName fileName;
|
||||
uint32_t texFlags;
|
||||
uint32_t createFlags;
|
||||
float detailDropoffStart;
|
||||
@ -76,7 +78,6 @@ public:
|
||||
|
||||
plBitmapData()
|
||||
{
|
||||
fileName = nil;
|
||||
texFlags = 0;
|
||||
createFlags = 0;
|
||||
detailDropoffStart = detailDropoffStop = 0.f;
|
||||
@ -119,7 +120,7 @@ class plBitmapCreator
|
||||
plBitmap *ICreateTexture( plBitmapData *bd, const plLocation &loc, int clipID = -1 );
|
||||
plMipmap *ICreateBitmap( plBitmapData *bd );
|
||||
|
||||
void ICheckOutBitmap( BitmapInfo *bInfo, Bitmap *bm, const char *fileName );
|
||||
void ICheckOutBitmap( BitmapInfo *bInfo, Bitmap *bm, const plFileName &fileName );
|
||||
int IResampBitmap( Bitmap *bm, plMipmap &hBitmap );
|
||||
int ICopyBitmap( Bitmap *bm, plMipmap &hBitmap );
|
||||
int IInvertAlpha( plMipmap &hBitmap );
|
||||
|
@ -1062,7 +1062,7 @@ plLayer *plLayerConverter::IAssignTexture( plBitmapData *bd, plMaxNode *maxNode,
|
||||
{
|
||||
if( upperLayer )
|
||||
{
|
||||
if( fErrorMsg->Set( !( fWarned & kWarnedUpperTextureMissing ), "Plasma Export Error", sWarnUpperTextureMissing, maxNode->GetName(), bd->fileName ).CheckAskOrCancel() )
|
||||
if( fErrorMsg->Set( !( fWarned & kWarnedUpperTextureMissing ), "Plasma Export Error", sWarnUpperTextureMissing, maxNode->GetName(), bd->fileName.AsString().c_str() ).CheckAskOrCancel() )
|
||||
fWarned |= kWarnedUpperTextureMissing;
|
||||
fErrorMsg->Set( false );
|
||||
|
||||
@ -1071,7 +1071,7 @@ plLayer *plLayerConverter::IAssignTexture( plBitmapData *bd, plMaxNode *maxNode,
|
||||
}
|
||||
else
|
||||
{
|
||||
if( fErrorMsg->Set( !( fWarned & kWarnedNoBaseTexture ), "Plasma Export Error", sWarnBaseTextureMissing, maxNode->GetName(), bd->fileName ).CheckAskOrCancel() )
|
||||
if( fErrorMsg->Set( !( fWarned & kWarnedNoBaseTexture ), "Plasma Export Error", sWarnBaseTextureMissing, maxNode->GetName(), bd->fileName.AsString().c_str() ).CheckAskOrCancel() )
|
||||
fWarned |= kWarnedNoBaseTexture;
|
||||
fErrorMsg->Set( false );
|
||||
|
||||
|
Reference in New Issue
Block a user