1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Remove hsFiles in favor of plFilesystem stuff

This commit is contained in:
2013-01-20 20:17:39 -08:00
parent cc54fb07be
commit 2c028c4b07
51 changed files with 327 additions and 1249 deletions

View File

@ -61,7 +61,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsColorRGBA.h"
#include "plgDispatch.h"
#include "hsFastMath.h"
#include "plFile/hsFiles.h"
#include "hsGeometry3.h"
#include "pnKeyedObject/plKey.h"
#include "plLoadMask.h"

View File

@ -41,7 +41,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "HeadSpin.h"
#include "plFile/hsFiles.h"
#include "hsTemplates.h"
#include "MaxComponent/plComponentMgr.h"

View File

@ -40,14 +40,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "HeadSpin.h"
#include "plFile/hsFiles.h"
#include "hsStream.h"
#include "hsTemplates.h"
#include "hsWindows.h"
#include <max.h>
#include <string>
#include <vector>
#include "resource.h"
#pragma hdrstop
@ -63,8 +60,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif
#include "plMaxAccelerators.h"
using std::string;
extern HINSTANCE hInstance;
//// Tree Data Wrapper Class //////////////////////////////////////////////////
@ -72,19 +67,17 @@ extern HINSTANCE hInstance;
class plAgeFile
{
protected:
void IGetAgeName(const char* path)
void IGetAgeName(const plFileName& path)
{
char name[_MAX_FNAME];
_splitpath(path, nil, nil, name, nil);
fAgeName = name;
fAgeName = path.GetFileNameNoExt();
}
public:
#ifdef MAXASS_VAILABLE
jvUniqueId fAssetID;
#endif
string fPath;
string fAgeName;
plFileName fPath;
plString fAgeName;
enum Types
{
@ -93,17 +86,16 @@ public:
};
Types fType;
plAgeFile(Types type) : fType(type), fPath(nil) { }
plAgeFile(Types type, const char *path) : fType(type)
plAgeFile(Types type) : fType(type) { }
plAgeFile(Types type, const plFileName &path) : fPath(path), fType(type)
{
fPath = path;
IGetAgeName(path);
}
#ifdef MAXASS_AVAILABLE
plAgeFile(Types type, const char *path, jvUniqueId& id) : fType(type), fAssetID(id)
plAgeFile(Types type, const plFileName &path, jvUniqueId& id)
: fPath(path), fType(type), fAssetID(id)
{
fPath = path;
IGetAgeName(path);
}
#endif
@ -716,7 +708,7 @@ void plAgeDescInterface::IUpdateCurAge( void )
else
#endif
// Load the local age, also check its sequence #s
ILoadAge( currAge->fPath.c_str(), true );
ILoadAge( currAge->fPath, true );
}
static const int kDefaultCapacity = 10;
@ -851,19 +843,15 @@ void plAgeDescInterface::IGetAgeFiles(std::vector<plAgeFile*>& ageFiles)
{
IClearAgeFiles(ageFiles);
char agePath[MAX_PATH];
// Make list of "local" ages. This might contain copies of those in AssetMan, so we make the
// list first and take out the ones that are in AssetMan
plFileName localPath = IGetLocalAgePath();
if (localPath.IsValid())
{
hsFolderIterator ageFolder(localPath.AsString().c_str());
while (ageFolder.NextFileSuffix(".age"))
std::vector<plFileName> files = plFileSystem::ListDir(localPath, "*.age");
for (auto iter = files.begin(); iter != files.end(); ++iter)
{
ageFolder.GetPathAndName(agePath);
plAgeFile* age = new plAgeFile(plAgeFile::kLocalFile, agePath);
plAgeFile* age = new plAgeFile(plAgeFile::kLocalFile, *iter);
ageFiles.push_back(age);
}
}
@ -881,6 +869,7 @@ void plAgeDescInterface::IGetAgeFiles(std::vector<plAgeFile*>& ageFiles)
{
if( doneAssets.Find( (*assets)[ i ] ) == doneAssets.kMissingIndex )
{
char agePath[MAX_PATH];
if (assetMan->GetLatestVersionFile((*assets)[i], agePath, sizeof(agePath)))
{
plAgeFile* age = new plAgeFile(plAgeFile::kAssetFile, agePath, (*assets)[i]);
@ -911,16 +900,19 @@ void plAgeDescInterface::IClearAgeFiles(std::vector<plAgeFile*>& ageFiles)
ageFiles.clear();
}
void plAgeDescInterface::BuildAgeFileList( hsTArray<char *> &ageList )
hsTArray<plFileName> plAgeDescInterface::BuildAgeFileList()
{
std::vector<plAgeFile*> tempAgeFiles;
IGetAgeFiles(tempAgeFiles);
hsTArray<plFileName> ageList;
for (int i = 0; i < tempAgeFiles.size(); i++)
{
ageList.Push(hsStrcpy(tempAgeFiles[i]->fPath.c_str()));
ageList.Push(tempAgeFiles[i]->fPath);
delete tempAgeFiles[ i ];
}
return ageList;
}
//// IFillAgeTree /////////////////////////////////////////////////////////////
@ -1310,7 +1302,7 @@ uint32_t plAgeDescInterface::IGetNextFreeSequencePrefix( bool getReservedPrefix
for( i = 0; i < fAgeFiles.size(); i++ )
{
hsUNIXStream stream;
if( stream.Open( fAgeFiles[ i ]->fPath.c_str(), "rt" ) )
if( stream.Open( fAgeFiles[ i ]->fPath, "rt" ) )
{
ages[ i ].Read( &stream );
stream.Close();

View File

@ -84,7 +84,7 @@ public:
static BOOL CALLBACK ForwardDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static void BuildAgeFileList( hsTArray<char *> &ageList );
static hsTArray<plFileName> BuildAgeFileList();
protected:
static int IFindAge(const char* ageName, std::vector<plAgeFile*>& ageFiles);

View File

@ -40,9 +40,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "HeadSpin.h"
#include "plFile/hsFiles.h"
#include "plgDispatch.h"
#include "hsWindows.h"
#include "plFileSystem.h"
#include <Python.h>
#include <string>
@ -52,6 +52,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <max.h>
#pragma hdrstop
#include <direct.h>
#include "plPythonMgr.h"
#include "plMaxCFGFile.h"
@ -229,7 +231,7 @@ void IExtractVisInfo(PyObject* tuple, int* id, std::vector<std::string>* vec)
}
}
bool plPythonMgr::IQueryPythonFile(char *fileName)
bool plPythonMgr::IQueryPythonFile(const char *fileName)
{
PyObject *module = PyImport_ImportModule(fileName);
if (module)
@ -596,8 +598,6 @@ void plPythonMgr::IAddGrassComponent(plAutoUIBlock *autoUI, PyObject *objTuple,
autoUI->AddPickGrassComponentButton(id, nil, paramName.c_str(), vid, vstates);
}
#include <direct.h>
void plPythonMgr::LoadPythonFiles()
{
plFileName clientPath = plMaxConfig::GetClientPath(false, true);
@ -612,15 +612,13 @@ void plPythonMgr::LoadPythonFiles()
PythonInterface::initPython();
// Iterate through all the Python files in the folder
hsFolderIterator folder(pythonPath.AsString().c_str());
while (folder.NextFileSuffix(".py"))
std::vector<plFileName> pys = plFileSystem::ListDir(pythonPath, "*.py");
for (auto iter = pys.begin(); iter != pys.end(); ++iter)
{
// Get the filename without the ".py" (module name)
const char *fullFileName = folder.GetFileName();
char fileName[_MAX_FNAME];
_splitpath(fullFileName, NULL, NULL, fileName, NULL);
plString fileName = iter->GetFileNameNoExt();
IQueryPythonFile(fileName);
IQueryPythonFile(fileName.c_str());
}
PythonInterface::finiPython();

View File

@ -48,7 +48,7 @@ class plPythonMgr
protected:
plPythonMgr();
bool IQueryPythonFile(char *fileName);
bool IQueryPythonFile(const char *fileName);
void IAddBool(plAutoUIBlock *autoUI, PyObject *tuple, char *paramName, int id, int vid, std::vector<std::string>* vstates);
void IAddInt(plAutoUIBlock *autoUI, PyObject *tuple, char *paramName, int id, int vid, std::vector<std::string>* vstates);