mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Merge pull request #280 from Areloch/YetMoreMiscAssetFixes
Even more misc asset fixes
This commit is contained in:
commit
d1a79ae5eb
30 changed files with 241 additions and 106 deletions
|
|
@ -93,6 +93,8 @@ CppAsset::CppAsset() : AssetBase()
|
||||||
{
|
{
|
||||||
mCodeFile = StringTable->EmptyString();
|
mCodeFile = StringTable->EmptyString();
|
||||||
mHeaderFile = StringTable->EmptyString();
|
mHeaderFile = StringTable->EmptyString();
|
||||||
|
mCodePath = StringTable->EmptyString();
|
||||||
|
mHeaderPath = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -164,7 +166,14 @@ void CppAsset::setHeaderFile(const char* pHeaderFile)
|
||||||
|
|
||||||
void CppAsset::initializeAsset()
|
void CppAsset::initializeAsset()
|
||||||
{
|
{
|
||||||
mCodeFile = expandAssetFilePath(mCodeFile);
|
mCodePath = getOwned() ? expandAssetFilePath(mCodeFile) : mCodePath;
|
||||||
|
|
||||||
mHeaderFile = expandAssetFilePath(mHeaderFile);
|
mHeaderPath = getOwned() ? expandAssetFilePath(mHeaderFile) : mHeaderPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppAsset::onAssetRefresh(void)
|
||||||
|
{
|
||||||
|
mCodePath = getOwned() ? expandAssetFilePath(mCodeFile) : mCodePath;
|
||||||
|
|
||||||
|
mHeaderPath = getOwned() ? expandAssetFilePath(mHeaderFile) : mHeaderPath;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,9 @@ class CppAsset : public AssetBase
|
||||||
typedef AssetBase Parent;
|
typedef AssetBase Parent;
|
||||||
|
|
||||||
StringTableEntry mCodeFile;
|
StringTableEntry mCodeFile;
|
||||||
|
StringTableEntry mCodePath;
|
||||||
StringTableEntry mHeaderFile;
|
StringTableEntry mHeaderFile;
|
||||||
|
StringTableEntry mHeaderPath;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CppAsset();
|
CppAsset();
|
||||||
|
|
@ -66,11 +68,14 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initializeAsset(void);
|
virtual void initializeAsset(void);
|
||||||
virtual void onAssetRefresh(void) {};
|
virtual void onAssetRefresh(void);
|
||||||
|
|
||||||
static bool setCppFile(void *obj, const char *index, const char *data) { static_cast<CppAsset*>(obj)->setCppFile(data); return false; }
|
static bool setCppFile(void *obj, const char *index, const char *data) { static_cast<CppAsset*>(obj)->setCppFile(data); return false; }
|
||||||
static const char* getCppFile(void* obj, const char* data) { return static_cast<CppAsset*>(obj)->getCppFile(); }
|
static const char* getCppFile(void* obj, const char* data) { return static_cast<CppAsset*>(obj)->getCppFile(); }
|
||||||
|
|
||||||
|
inline StringTableEntry getCppFilePath(void) const { return mCodePath; };
|
||||||
|
inline StringTableEntry getHeaderFilePath(void) const { return mHeaderPath; };
|
||||||
|
|
||||||
static bool setHeaderFile(void *obj, const char *index, const char *data) { static_cast<CppAsset*>(obj)->setHeaderFile(data); return false; }
|
static bool setHeaderFile(void *obj, const char *index, const char *data) { static_cast<CppAsset*>(obj)->setHeaderFile(data); return false; }
|
||||||
static const char* getHeaderFile(void* obj, const char* data) { return static_cast<CppAsset*>(obj)->getHeaderFile(); }
|
static const char* getHeaderFile(void* obj, const char* data) { return static_cast<CppAsset*>(obj)->getHeaderFile(); }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,9 @@ GUIAsset::GUIAsset()
|
||||||
{
|
{
|
||||||
mScriptFile = StringTable->EmptyString();
|
mScriptFile = StringTable->EmptyString();
|
||||||
mGUIFile = StringTable->EmptyString();
|
mGUIFile = StringTable->EmptyString();
|
||||||
|
|
||||||
|
mScriptPath = StringTable->EmptyString();
|
||||||
|
mGUIPath = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -118,28 +121,28 @@ void GUIAsset::copyTo(SimObject* object)
|
||||||
|
|
||||||
void GUIAsset::initializeAsset()
|
void GUIAsset::initializeAsset()
|
||||||
{
|
{
|
||||||
mGUIFile = expandAssetFilePath(mGUIFile);
|
mGUIPath = expandAssetFilePath(mGUIFile);
|
||||||
|
|
||||||
if (Platform::isFile(mGUIFile))
|
if (Platform::isFile(mGUIPath))
|
||||||
Con::executeFile(mGUIFile, false, false);
|
Con::executeFile(mGUIPath, false, false);
|
||||||
|
|
||||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
mScriptPath = expandAssetFilePath(mScriptFile);
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIAsset::onAssetRefresh()
|
void GUIAsset::onAssetRefresh()
|
||||||
{
|
{
|
||||||
mGUIFile = expandAssetFilePath(mGUIFile);
|
mGUIPath = expandAssetFilePath(mGUIFile);
|
||||||
|
|
||||||
if (Platform::isFile(mGUIFile))
|
if (Platform::isFile(mGUIPath))
|
||||||
Con::executeFile(mGUIFile, false, false);
|
Con::executeFile(mGUIPath, false, false);
|
||||||
|
|
||||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
mScriptPath = expandAssetFilePath(mScriptFile);
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIAsset::setGUIFile(const char* pScriptFile)
|
void GUIAsset::setGUIFile(const char* pScriptFile)
|
||||||
|
|
@ -155,7 +158,7 @@ void GUIAsset::setGUIFile(const char* pScriptFile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update.
|
// Update.
|
||||||
mGUIFile = getOwned() ? expandAssetFilePath(pScriptFile) : StringTable->insert(pScriptFile);
|
mGUIFile = StringTable->insert(pScriptFile);
|
||||||
|
|
||||||
// Refresh the asset.
|
// Refresh the asset.
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
|
|
@ -174,7 +177,7 @@ void GUIAsset::setScriptFile(const char* pScriptFile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update.
|
// Update.
|
||||||
mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : StringTable->insert(pScriptFile);
|
mScriptFile = StringTable->insert(pScriptFile);
|
||||||
|
|
||||||
// Refresh the asset.
|
// Refresh the asset.
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ class GUIAsset : public AssetBase
|
||||||
StringTableEntry mScriptFile;
|
StringTableEntry mScriptFile;
|
||||||
StringTableEntry mGUIFile;
|
StringTableEntry mGUIFile;
|
||||||
|
|
||||||
|
StringTableEntry mScriptPath;
|
||||||
|
StringTableEntry mGUIPath;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GUIAsset();
|
GUIAsset();
|
||||||
virtual ~GUIAsset();
|
virtual ~GUIAsset();
|
||||||
|
|
@ -65,6 +68,9 @@ public:
|
||||||
void setScriptFile(const char* pScriptFile);
|
void setScriptFile(const char* pScriptFile);
|
||||||
inline StringTableEntry getScriptFile(void) const { return mScriptFile; };
|
inline StringTableEntry getScriptFile(void) const { return mScriptFile; };
|
||||||
|
|
||||||
|
inline StringTableEntry getGUIPath(void) const { return mGUIPath; };
|
||||||
|
inline StringTableEntry getScriptPath(void) const { return mScriptPath; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initializeAsset(void);
|
virtual void initializeAsset(void);
|
||||||
virtual void onAssetRefresh(void);
|
virtual void onAssetRefresh(void);
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,8 @@ GameObjectAsset::GameObjectAsset()
|
||||||
mGameObjectName = StringTable->EmptyString();
|
mGameObjectName = StringTable->EmptyString();
|
||||||
mScriptFile = StringTable->EmptyString();
|
mScriptFile = StringTable->EmptyString();
|
||||||
mTAMLFile = StringTable->EmptyString();
|
mTAMLFile = StringTable->EmptyString();
|
||||||
|
mScriptPath = StringTable->EmptyString();
|
||||||
|
mTAMLPath = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -129,25 +131,23 @@ void GameObjectAsset::copyTo(SimObject* object)
|
||||||
void GameObjectAsset::initializeAsset()
|
void GameObjectAsset::initializeAsset()
|
||||||
{
|
{
|
||||||
//Ensure we have an expanded filepath
|
//Ensure we have an expanded filepath
|
||||||
if (!Platform::isFullPath(mScriptFile))
|
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
|
||||||
mScriptFile = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptFile;
|
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
|
|
||||||
if (!Platform::isFullPath(mTAMLFile))
|
mTAMLPath = getOwned() ? expandAssetFilePath(mTAMLFile) : mTAMLPath;
|
||||||
mTAMLFile = getOwned() ? expandAssetFilePath(mTAMLFile) : mTAMLFile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameObjectAsset::onAssetRefresh()
|
void GameObjectAsset::onAssetRefresh()
|
||||||
{
|
{
|
||||||
//Ensure we have an expanded filepath
|
//Ensure we have an expanded filepath
|
||||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
|
|
||||||
mTAMLFile = expandAssetFilePath(mTAMLFile);
|
mTAMLPath = getOwned() ? expandAssetFilePath(mTAMLFile) : mTAMLPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameObjectAsset::setScriptFile(const char* pScriptFile)
|
void GameObjectAsset::setScriptFile(const char* pScriptFile)
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ class GameObjectAsset : public AssetBase
|
||||||
StringTableEntry mGameObjectName;
|
StringTableEntry mGameObjectName;
|
||||||
StringTableEntry mScriptFile;
|
StringTableEntry mScriptFile;
|
||||||
StringTableEntry mTAMLFile;
|
StringTableEntry mTAMLFile;
|
||||||
|
StringTableEntry mScriptPath;
|
||||||
|
StringTableEntry mTAMLPath;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameObjectAsset();
|
GameObjectAsset();
|
||||||
|
|
@ -77,6 +79,9 @@ protected:
|
||||||
static const char* getScriptFile(void* obj, const char* data) { return static_cast<GameObjectAsset*>(obj)->getScriptFile(); }
|
static const char* getScriptFile(void* obj, const char* data) { return static_cast<GameObjectAsset*>(obj)->getScriptFile(); }
|
||||||
static bool setTAMLFile(void *obj, const char *index, const char *data) { static_cast<GameObjectAsset*>(obj)->setTAMLFile(data); return false; }
|
static bool setTAMLFile(void *obj, const char *index, const char *data) { static_cast<GameObjectAsset*>(obj)->setTAMLFile(data); return false; }
|
||||||
static const char* getTAMLFile(void* obj, const char* data) { return static_cast<GameObjectAsset*>(obj)->getTAMLFile(); }
|
static const char* getTAMLFile(void* obj, const char* data) { return static_cast<GameObjectAsset*>(obj)->getTAMLFile(); }
|
||||||
|
|
||||||
|
inline StringTableEntry getScriptFilePath(void) const { return mScriptPath; };
|
||||||
|
inline StringTableEntry getTAMLFilePath(void) const { return mTAMLPath; };
|
||||||
};
|
};
|
||||||
|
|
||||||
DefineConsoleType(TypeGameObjectAssetPtr, GameObjectAsset)
|
DefineConsoleType(TypeGameObjectAssetPtr, GameObjectAsset)
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ EndImplementEnumType;
|
||||||
ImageAsset::ImageAsset() : AssetBase(), mImage(nullptr), mUseMips(true), mIsHDRImage(false), mIsValidImage(false), mImageType(Albedo)
|
ImageAsset::ImageAsset() : AssetBase(), mImage(nullptr), mUseMips(true), mIsHDRImage(false), mIsValidImage(false), mImageType(Albedo)
|
||||||
{
|
{
|
||||||
mImageFileName = StringTable->EmptyString();
|
mImageFileName = StringTable->EmptyString();
|
||||||
|
mImagePath = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -254,14 +255,16 @@ void ImageAsset::loadImage()
|
||||||
|
|
||||||
void ImageAsset::initializeAsset()
|
void ImageAsset::initializeAsset()
|
||||||
{
|
{
|
||||||
mImageFileName = expandAssetFilePath(mImageFileName);
|
mImagePath = expandAssetFilePath(mImageFileName);
|
||||||
|
|
||||||
loadImage();
|
loadImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageAsset::onAssetRefresh()
|
void ImageAsset::onAssetRefresh()
|
||||||
{
|
{
|
||||||
setImageFileName(mImageFileName);
|
mImagePath = expandAssetFilePath(mImageFileName);
|
||||||
|
|
||||||
|
loadImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageAsset::setImageFileName(const char* pScriptFile)
|
void ImageAsset::setImageFileName(const char* pScriptFile)
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StringTableEntry mImageFileName;
|
StringTableEntry mImageFileName;
|
||||||
|
StringTableEntry mImagePath;
|
||||||
|
|
||||||
GFXTexHandle mImage;
|
GFXTexHandle mImage;
|
||||||
|
|
||||||
|
|
@ -95,6 +96,8 @@ public:
|
||||||
void setImageFileName(const char* pScriptFile);
|
void setImageFileName(const char* pScriptFile);
|
||||||
inline StringTableEntry getImageFileName(void) const { return mImageFileName; };
|
inline StringTableEntry getImageFileName(void) const { return mImageFileName; };
|
||||||
|
|
||||||
|
inline StringTableEntry getImagePath(void) const { return mImagePath; };
|
||||||
|
|
||||||
bool isValid() { return mIsValidImage; }
|
bool isValid() { return mIsValidImage; }
|
||||||
|
|
||||||
GFXTexHandle getImage(GFXTextureProfile requestedProfile);
|
GFXTexHandle getImage(GFXTextureProfile requestedProfile);
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,13 @@ LevelAsset::LevelAsset() : AssetBase(), mIsSubLevel(false)
|
||||||
mForestFile = StringTable->EmptyString();
|
mForestFile = StringTable->EmptyString();
|
||||||
mNavmeshFile = StringTable->EmptyString();
|
mNavmeshFile = StringTable->EmptyString();
|
||||||
|
|
||||||
|
mLevelPath = StringTable->EmptyString();
|
||||||
|
mPreviewImagePath = StringTable->EmptyString();
|
||||||
|
mPostFXPresetPath = StringTable->EmptyString();
|
||||||
|
mDecalsPath = StringTable->EmptyString();
|
||||||
|
mForestPath = StringTable->EmptyString();
|
||||||
|
mNavmeshPath = StringTable->EmptyString();
|
||||||
|
|
||||||
mGamemodeName = StringTable->EmptyString();
|
mGamemodeName = StringTable->EmptyString();
|
||||||
mMainLevelAsset = StringTable->EmptyString();
|
mMainLevelAsset = StringTable->EmptyString();
|
||||||
|
|
||||||
|
|
@ -151,12 +158,23 @@ void LevelAsset::initializeAsset()
|
||||||
Parent::initializeAsset();
|
Parent::initializeAsset();
|
||||||
|
|
||||||
// Ensure the image-file is expanded.
|
// Ensure the image-file is expanded.
|
||||||
mPreviewImage = expandAssetFilePath(mPreviewImage);
|
mPreviewImagePath = expandAssetFilePath(mPreviewImage);
|
||||||
mLevelFile = expandAssetFilePath(mLevelFile);
|
mLevelPath = expandAssetFilePath(mLevelFile);
|
||||||
mPostFXPresetFile = expandAssetFilePath(mPostFXPresetFile);
|
mPostFXPresetPath = expandAssetFilePath(mPostFXPresetFile);
|
||||||
mDecalsFile = expandAssetFilePath(mDecalsFile);
|
mDecalsPath = expandAssetFilePath(mDecalsFile);
|
||||||
mForestFile = expandAssetFilePath(mForestFile);
|
mForestPath = expandAssetFilePath(mForestFile);
|
||||||
mNavmeshFile = expandAssetFilePath(mNavmeshFile);
|
mNavmeshPath = expandAssetFilePath(mNavmeshFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LevelAsset::onAssetRefresh(void)
|
||||||
|
{
|
||||||
|
// Ensure the image-file is expanded.
|
||||||
|
mPreviewImagePath = expandAssetFilePath(mPreviewImage);
|
||||||
|
mLevelPath = expandAssetFilePath(mLevelFile);
|
||||||
|
mPostFXPresetPath = expandAssetFilePath(mPostFXPresetFile);
|
||||||
|
mDecalsPath = expandAssetFilePath(mDecalsFile);
|
||||||
|
mForestPath = expandAssetFilePath(mForestFile);
|
||||||
|
mNavmeshPath = expandAssetFilePath(mNavmeshFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,13 @@ class LevelAsset : public AssetBase
|
||||||
StringTableEntry mNavmeshFile;
|
StringTableEntry mNavmeshFile;
|
||||||
StringTableEntry mPreviewImage;
|
StringTableEntry mPreviewImage;
|
||||||
|
|
||||||
|
StringTableEntry mLevelPath;
|
||||||
|
StringTableEntry mPostFXPresetPath;
|
||||||
|
StringTableEntry mDecalsPath;
|
||||||
|
StringTableEntry mForestPath;
|
||||||
|
StringTableEntry mNavmeshPath;
|
||||||
|
StringTableEntry mPreviewImagePath;
|
||||||
|
|
||||||
StringTableEntry mEditorFile;
|
StringTableEntry mEditorFile;
|
||||||
StringTableEntry mBakedSceneFile;
|
StringTableEntry mBakedSceneFile;
|
||||||
|
|
||||||
|
|
@ -84,6 +91,13 @@ public:
|
||||||
void setImageFile(const char* pImageFile);
|
void setImageFile(const char* pImageFile);
|
||||||
inline StringTableEntry getImageFile(void) const { return mPreviewImage; };
|
inline StringTableEntry getImageFile(void) const { return mPreviewImage; };
|
||||||
|
|
||||||
|
inline StringTableEntry getLevelPath(void) const { return mLevelPath; };
|
||||||
|
inline StringTableEntry getPostFXPresetPath(void) const { return mPostFXPresetPath; };
|
||||||
|
inline StringTableEntry getDecalsPath(void) const { return mDecalsPath; };
|
||||||
|
inline StringTableEntry getForestPath(void) const { return mForestPath; };
|
||||||
|
inline StringTableEntry getNavmeshPath(void) const { return mNavmeshPath; };
|
||||||
|
inline StringTableEntry getImagePath(void) const { return mPreviewImagePath; };
|
||||||
|
|
||||||
void setEditorFile(const char* pEditorFile);
|
void setEditorFile(const char* pEditorFile);
|
||||||
inline StringTableEntry getEditorFile(void) const { return mEditorFile; };
|
inline StringTableEntry getEditorFile(void) const { return mEditorFile; };
|
||||||
void setBakedSceneFile(const char* pBakedSceneFile);
|
void setBakedSceneFile(const char* pBakedSceneFile);
|
||||||
|
|
@ -114,7 +128,7 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
virtual void initializeAsset(void);
|
virtual void initializeAsset(void);
|
||||||
virtual void onAssetRefresh(void) {}
|
virtual void onAssetRefresh(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
DefineConsoleType(TypeLevelAssetPtr, LevelAsset)
|
DefineConsoleType(TypeLevelAssetPtr, LevelAsset)
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ MaterialAsset::MaterialAsset()
|
||||||
{
|
{
|
||||||
mShaderGraphFile = "";
|
mShaderGraphFile = "";
|
||||||
mScriptFile = StringTable->EmptyString();
|
mScriptFile = StringTable->EmptyString();
|
||||||
|
mScriptPath = StringTable->EmptyString();
|
||||||
mMatDefinitionName = StringTable->EmptyString();
|
mMatDefinitionName = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,19 +122,18 @@ void MaterialAsset::initializeAsset()
|
||||||
|
|
||||||
compileShader();
|
compileShader();
|
||||||
|
|
||||||
if (!Platform::isFullPath(mScriptFile))
|
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
|
||||||
mScriptFile = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptFile;
|
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaterialAsset::onAssetRefresh()
|
void MaterialAsset::onAssetRefresh()
|
||||||
{
|
{
|
||||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
|
|
||||||
if (mMatDefinitionName != StringTable->EmptyString())
|
if (mMatDefinitionName != StringTable->EmptyString())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ class MaterialAsset : public AssetBase
|
||||||
|
|
||||||
String mShaderGraphFile;
|
String mShaderGraphFile;
|
||||||
StringTableEntry mScriptFile;
|
StringTableEntry mScriptFile;
|
||||||
|
StringTableEntry mScriptPath;
|
||||||
StringTableEntry mMatDefinitionName;
|
StringTableEntry mMatDefinitionName;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -74,6 +75,8 @@ public:
|
||||||
void setScriptFile(const char* pScriptFile);
|
void setScriptFile(const char* pScriptFile);
|
||||||
inline StringTableEntry getScriptFile(void) const { return mScriptFile; };
|
inline StringTableEntry getScriptFile(void) const { return mScriptFile; };
|
||||||
|
|
||||||
|
inline StringTableEntry getScriptPath(void) const { return mScriptPath; };
|
||||||
|
|
||||||
/// Declare Console Object.
|
/// Declare Console Object.
|
||||||
DECLARE_CONOBJECT(MaterialAsset);
|
DECLARE_CONOBJECT(MaterialAsset);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,10 @@ PostEffectAsset::PostEffectAsset()
|
||||||
mScriptFile = StringTable->EmptyString();
|
mScriptFile = StringTable->EmptyString();
|
||||||
mHLSLShaderFile = StringTable->EmptyString();
|
mHLSLShaderFile = StringTable->EmptyString();
|
||||||
mGLSLShaderFile = StringTable->EmptyString();
|
mGLSLShaderFile = StringTable->EmptyString();
|
||||||
|
|
||||||
|
mScriptPath = StringTable->EmptyString();
|
||||||
|
mHLSLShaderPath = StringTable->EmptyString();
|
||||||
|
mGLSLShaderPath = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -128,22 +132,22 @@ void PostEffectAsset::copyTo(SimObject* object)
|
||||||
|
|
||||||
void PostEffectAsset::initializeAsset()
|
void PostEffectAsset::initializeAsset()
|
||||||
{
|
{
|
||||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
mScriptPath = expandAssetFilePath(mScriptFile);
|
||||||
mHLSLShaderFile = expandAssetFilePath(mHLSLShaderFile);
|
mHLSLShaderPath = expandAssetFilePath(mHLSLShaderFile);
|
||||||
mGLSLShaderFile = expandAssetFilePath(mGLSLShaderFile);
|
mGLSLShaderPath = expandAssetFilePath(mGLSLShaderFile);
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostEffectAsset::onAssetRefresh()
|
void PostEffectAsset::onAssetRefresh()
|
||||||
{
|
{
|
||||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
mScriptPath = expandAssetFilePath(mScriptFile);
|
||||||
mHLSLShaderFile = expandAssetFilePath(mHLSLShaderFile);
|
mHLSLShaderPath = expandAssetFilePath(mHLSLShaderFile);
|
||||||
mGLSLShaderFile = expandAssetFilePath(mGLSLShaderFile);
|
mGLSLShaderPath = expandAssetFilePath(mGLSLShaderFile);
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostEffectAsset::setScriptFile(const char* pScriptFile)
|
void PostEffectAsset::setScriptFile(const char* pScriptFile)
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,10 @@ class PostEffectAsset : public AssetBase
|
||||||
StringTableEntry mScriptFile;
|
StringTableEntry mScriptFile;
|
||||||
StringTableEntry mHLSLShaderFile;
|
StringTableEntry mHLSLShaderFile;
|
||||||
StringTableEntry mGLSLShaderFile;
|
StringTableEntry mGLSLShaderFile;
|
||||||
|
|
||||||
|
StringTableEntry mScriptPath;
|
||||||
|
StringTableEntry mHLSLShaderPath;
|
||||||
|
StringTableEntry mGLSLShaderPath;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PostEffectAsset();
|
PostEffectAsset();
|
||||||
|
|
@ -66,6 +70,10 @@ public:
|
||||||
void setGLSLShaderFile(const char* pShaderFile);
|
void setGLSLShaderFile(const char* pShaderFile);
|
||||||
inline StringTableEntry getGLSLShaderFile(void) const { return mGLSLShaderFile; };
|
inline StringTableEntry getGLSLShaderFile(void) const { return mGLSLShaderFile; };
|
||||||
|
|
||||||
|
inline StringTableEntry getScriptPath(void) const { return mScriptPath; };
|
||||||
|
inline StringTableEntry getHLSLShaderPath(void) const { return mHLSLShaderPath; };
|
||||||
|
inline StringTableEntry getGLSLShaderPath(void) const { return mGLSLShaderPath; };
|
||||||
|
|
||||||
/// Declare Console Object.
|
/// Declare Console Object.
|
||||||
DECLARE_CONOBJECT(PostEffectAsset);
|
DECLARE_CONOBJECT(PostEffectAsset);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ ConsoleSetType(TypeScriptAssetPtr)
|
||||||
ScriptAsset::ScriptAsset() : AssetBase(), mIsServerSide(true)
|
ScriptAsset::ScriptAsset() : AssetBase(), mIsServerSide(true)
|
||||||
{
|
{
|
||||||
mScriptFile = StringTable->EmptyString();
|
mScriptFile = StringTable->EmptyString();
|
||||||
|
mScriptPath = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -121,9 +122,9 @@ void ScriptAsset::copyTo(SimObject* object)
|
||||||
|
|
||||||
void ScriptAsset::initializeAsset()
|
void ScriptAsset::initializeAsset()
|
||||||
{
|
{
|
||||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
mScriptPath = expandAssetFilePath(mScriptFile);
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
{
|
{
|
||||||
//We're initialized properly, so we'll go ahead and kick along any dependencies we may have as well
|
//We're initialized properly, so we'll go ahead and kick along any dependencies we may have as well
|
||||||
AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId);
|
AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId);
|
||||||
|
|
@ -143,15 +144,15 @@ void ScriptAsset::initializeAsset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptAsset::onAssetRefresh()
|
void ScriptAsset::onAssetRefresh()
|
||||||
{
|
{
|
||||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
mScriptPath = expandAssetFilePath(mScriptFile);
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
{
|
{
|
||||||
//Refresh any dependencies we may have
|
//Refresh any dependencies we may have
|
||||||
for (U32 i = 0; i < mScriptAssets.size(); i++)
|
for (U32 i = 0; i < mScriptAssets.size(); i++)
|
||||||
|
|
@ -159,7 +160,7 @@ void ScriptAsset::onAssetRefresh()
|
||||||
mScriptAssets[i]->onAssetRefresh();
|
mScriptAssets[i]->onAssetRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,7 +177,7 @@ void ScriptAsset::setScriptFile(const char* pScriptFile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update.
|
// Update.
|
||||||
mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : StringTable->insert(pScriptFile);
|
mScriptFile = StringTable->insert(pScriptFile);
|
||||||
|
|
||||||
// Refresh the asset.
|
// Refresh the asset.
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
|
|
@ -191,9 +192,9 @@ bool ScriptAsset::execScript()
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
{
|
{
|
||||||
return Con::executeFile(mScriptFile, false, false);
|
return Con::executeFile(mScriptPath, false, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ class ScriptAsset : public AssetBase
|
||||||
typedef AssetBase Parent;
|
typedef AssetBase Parent;
|
||||||
|
|
||||||
StringTableEntry mScriptFile;
|
StringTableEntry mScriptFile;
|
||||||
|
StringTableEntry mScriptPath;
|
||||||
bool mIsServerSide;
|
bool mIsServerSide;
|
||||||
|
|
||||||
Vector<AssetPtr<ScriptAsset>> mScriptAssets;
|
Vector<AssetPtr<ScriptAsset>> mScriptAssets;
|
||||||
|
|
@ -67,6 +68,8 @@ public:
|
||||||
void setScriptFile(const char* pScriptFile);
|
void setScriptFile(const char* pScriptFile);
|
||||||
inline StringTableEntry getScriptFile(void) const { return mScriptFile; };
|
inline StringTableEntry getScriptFile(void) const { return mScriptFile; };
|
||||||
|
|
||||||
|
inline StringTableEntry getScriptPath(void) const { return mScriptPath; };
|
||||||
|
|
||||||
bool execScript();
|
bool execScript();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ ShapeAnimationAsset::ShapeAnimationAsset() :
|
||||||
mIsEmbedded(false), mIsCyclical(true), mIsBlend(false), mBlendFrame(0), mStartFrame(0), mEndFrame(-1), mPadRotation(true), mPadTransforms(false)
|
mIsEmbedded(false), mIsCyclical(true), mIsBlend(false), mBlendFrame(0), mStartFrame(0), mEndFrame(-1), mPadRotation(true), mPadTransforms(false)
|
||||||
{
|
{
|
||||||
mFileName = StringTable->EmptyString();
|
mFileName = StringTable->EmptyString();
|
||||||
|
mFilePath = StringTable->EmptyString();
|
||||||
mAnimationName = StringTable->EmptyString();
|
mAnimationName = StringTable->EmptyString();
|
||||||
|
|
||||||
mBlendAnimAssetName = StringTable->EmptyString();
|
mBlendAnimAssetName = StringTable->EmptyString();
|
||||||
|
|
@ -146,11 +147,9 @@ void ShapeAnimationAsset::initializeAsset(void)
|
||||||
if (!mIsEmbedded)
|
if (!mIsEmbedded)
|
||||||
{
|
{
|
||||||
//If we're not embedded, we need to load in our initial shape and do some prepwork
|
//If we're not embedded, we need to load in our initial shape and do some prepwork
|
||||||
|
mFilePath = expandAssetFilePath(mFileName);
|
||||||
|
|
||||||
char filenameBuf[1024];
|
mSourceShape = ResourceManager::get().load(mFilePath);
|
||||||
Con::expandScriptFilename(filenameBuf, sizeof(filenameBuf), mFileName);
|
|
||||||
|
|
||||||
mSourceShape = ResourceManager::get().load(filenameBuf);
|
|
||||||
|
|
||||||
if (!mSourceShape->addSequence("ambient", "", mAnimationName, mStartFrame, mEndFrame, mPadRotation, mPadTransforms))
|
if (!mSourceShape->addSequence("ambient", "", mAnimationName, mStartFrame, mEndFrame, mPadRotation, mPadTransforms))
|
||||||
{
|
{
|
||||||
|
|
@ -185,7 +184,7 @@ void ShapeAnimationAsset::setAnimationFile(const char* pAnimationFile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update.
|
// Update.
|
||||||
mFileName = getOwned() ? expandAssetFilePath(pAnimationFile) : StringTable->insert(pAnimationFile);
|
mFileName = StringTable->insert(pAnimationFile);
|
||||||
|
|
||||||
// Refresh the asset.
|
// Refresh the asset.
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ class ShapeAnimationAsset : public AssetBase
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StringTableEntry mFileName;
|
StringTableEntry mFileName;
|
||||||
|
StringTableEntry mFilePath;
|
||||||
|
|
||||||
bool mIsEmbedded;
|
bool mIsEmbedded;
|
||||||
bool mIsCyclical;
|
bool mIsCyclical;
|
||||||
|
|
@ -81,6 +82,8 @@ public:
|
||||||
void setAnimationFile(const char* pScriptFile);
|
void setAnimationFile(const char* pScriptFile);
|
||||||
inline StringTableEntry getAnimationFile(void) const { return mFileName; };
|
inline StringTableEntry getAnimationFile(void) const { return mFileName; };
|
||||||
|
|
||||||
|
inline StringTableEntry getAnimationPath(void) const { return mFilePath; };
|
||||||
|
|
||||||
/// Declare Console Object.
|
/// Declare Console Object.
|
||||||
DECLARE_CONOBJECT(ShapeAnimationAsset);
|
DECLARE_CONOBJECT(ShapeAnimationAsset);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ ConsoleSetType(TypeSoundAssetPtr)
|
||||||
SoundAsset::SoundAsset()
|
SoundAsset::SoundAsset()
|
||||||
{
|
{
|
||||||
mSoundFile = StringTable->EmptyString();
|
mSoundFile = StringTable->EmptyString();
|
||||||
|
mSoundPath = StringTable->EmptyString();
|
||||||
|
|
||||||
mPitchAdjust = 0;
|
mPitchAdjust = 0;
|
||||||
mVolumeAdjust = 0;
|
mVolumeAdjust = 0;
|
||||||
|
|
@ -130,11 +131,12 @@ void SoundAsset::copyTo(SimObject* object)
|
||||||
|
|
||||||
void SoundAsset::initializeAsset(void)
|
void SoundAsset::initializeAsset(void)
|
||||||
{
|
{
|
||||||
|
mSoundPath = expandAssetFilePath(mSoundFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundAsset::onAssetRefresh(void)
|
void SoundAsset::onAssetRefresh(void)
|
||||||
{
|
{
|
||||||
|
mSoundPath = expandAssetFilePath(mSoundFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundAsset::setSoundFile(const char* pSoundFile)
|
void SoundAsset::setSoundFile(const char* pSoundFile)
|
||||||
|
|
@ -150,7 +152,7 @@ void SoundAsset::setSoundFile(const char* pSoundFile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update.
|
// Update.
|
||||||
mSoundFile = getOwned() ? expandAssetFilePath(pSoundFile) : StringTable->insert(pSoundFile);
|
mSoundFile = StringTable->insert(pSoundFile);
|
||||||
|
|
||||||
// Refresh the asset.
|
// Refresh the asset.
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class SoundAsset : public AssetBase
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StringTableEntry mSoundFile;
|
StringTableEntry mSoundFile;
|
||||||
|
StringTableEntry mSoundPath;
|
||||||
F32 mPitchAdjust;
|
F32 mPitchAdjust;
|
||||||
F32 mVolumeAdjust;
|
F32 mVolumeAdjust;
|
||||||
|
|
||||||
|
|
@ -65,6 +66,8 @@ public:
|
||||||
void setSoundFile(const char* pScriptFile);
|
void setSoundFile(const char* pScriptFile);
|
||||||
inline StringTableEntry getSoundFile(void) const { return mSoundFile; };
|
inline StringTableEntry getSoundFile(void) const { return mSoundFile; };
|
||||||
|
|
||||||
|
inline StringTableEntry getSoundPath(void) const { return mSoundPath; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initializeAsset(void);
|
virtual void initializeAsset(void);
|
||||||
virtual void onAssetRefresh(void);
|
virtual void onAssetRefresh(void);
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,7 @@ ConsoleSetType(TypeTerrainAssetId)
|
||||||
|
|
||||||
TerrainAsset::TerrainAsset()
|
TerrainAsset::TerrainAsset()
|
||||||
{
|
{
|
||||||
|
mTerrainFileName = StringTable->EmptyString();
|
||||||
mTerrainFilePath = StringTable->EmptyString();
|
mTerrainFilePath = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,8 +142,8 @@ void TerrainAsset::initPersistFields()
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
|
|
||||||
//addField("shaderGraph", TypeRealString, Offset(mShaderGraphFile, TerrainAsset), "");
|
//addField("shaderGraph", TypeRealString, Offset(mShaderGraphFile, TerrainAsset), "");
|
||||||
addProtectedField("terrainFile", TypeAssetLooseFilePath, Offset(mTerrainFilePath, TerrainAsset),
|
addProtectedField("terrainFile", TypeAssetLooseFilePath, Offset(mTerrainFileName, TerrainAsset),
|
||||||
&setTerrainFilePath, &getTerrainFilePath, "Path to the file containing the terrain data.");
|
&setTerrainFileName, &getTerrainFileName, "Path to the file containing the terrain data.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerrainAsset::setDataField(StringTableEntry slotName, const char* array, const char* value)
|
void TerrainAsset::setDataField(StringTableEntry slotName, const char* array, const char* value)
|
||||||
|
|
@ -164,19 +165,19 @@ void TerrainAsset::initializeAsset()
|
||||||
// Call parent.
|
// Call parent.
|
||||||
Parent::initializeAsset();
|
Parent::initializeAsset();
|
||||||
|
|
||||||
mTerrainFilePath = expandAssetFilePath(mTerrainFilePath);
|
mTerrainFilePath = expandAssetFilePath(mTerrainFileName);
|
||||||
|
|
||||||
loadTerrain();
|
loadTerrain();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerrainAsset::onAssetRefresh()
|
void TerrainAsset::onAssetRefresh()
|
||||||
{
|
{
|
||||||
mTerrainFilePath = expandAssetFilePath(mTerrainFilePath);
|
mTerrainFilePath = expandAssetFilePath(mTerrainFileName);
|
||||||
|
|
||||||
loadTerrain();
|
loadTerrain();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerrainAsset::setTerrainFilePath(const char* pScriptFile)
|
void TerrainAsset::setTerrainFileName(const char* pScriptFile)
|
||||||
{
|
{
|
||||||
// Sanity!
|
// Sanity!
|
||||||
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
|
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
|
||||||
|
|
@ -185,7 +186,7 @@ void TerrainAsset::setTerrainFilePath(const char* pScriptFile)
|
||||||
pScriptFile = StringTable->insert(pScriptFile);
|
pScriptFile = StringTable->insert(pScriptFile);
|
||||||
|
|
||||||
// Update.
|
// Update.
|
||||||
mTerrainFilePath = pScriptFile;
|
mTerrainFileName = pScriptFile;
|
||||||
|
|
||||||
// Refresh the asset.
|
// Refresh the asset.
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
|
|
@ -259,7 +260,7 @@ bool TerrainAsset::getAssetByFilename(StringTableEntry fileName, AssetPtr<Terrai
|
||||||
newTerrainAsset->setAssetName(assetName.c_str());
|
newTerrainAsset->setAssetName(assetName.c_str());
|
||||||
String terrainPathBind = terrFilePath.getFileName() + terrFilePath.getExtension();
|
String terrainPathBind = terrFilePath.getFileName() + terrFilePath.getExtension();
|
||||||
|
|
||||||
newTerrainAsset->mTerrainFilePath = StringTable->insert(terrainPathBind.c_str());
|
newTerrainAsset->mTerrainFileName = StringTable->insert(terrainPathBind.c_str());
|
||||||
|
|
||||||
newTerrainAsset->saveAsset();
|
newTerrainAsset->saveAsset();
|
||||||
|
|
||||||
|
|
@ -350,7 +351,7 @@ StringTableEntry TerrainAsset::getAssetIdByFilename(StringTableEntry fileName)
|
||||||
newTerrainAsset->setAssetName(assetName.c_str());
|
newTerrainAsset->setAssetName(assetName.c_str());
|
||||||
String terrainPathBind = terrFilePath.getFileName() + "." + terrFilePath.getExtension();
|
String terrainPathBind = terrFilePath.getFileName() + "." + terrFilePath.getExtension();
|
||||||
|
|
||||||
newTerrainAsset->mTerrainFilePath = StringTable->insert(terrainPathBind.c_str());
|
newTerrainAsset->mTerrainFileName = StringTable->insert(terrainPathBind.c_str());
|
||||||
|
|
||||||
newTerrainAsset->saveAsset();
|
newTerrainAsset->saveAsset();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ class TerrainAsset : public AssetBase
|
||||||
{
|
{
|
||||||
typedef AssetBase Parent;
|
typedef AssetBase Parent;
|
||||||
|
|
||||||
|
StringTableEntry mTerrainFileName;
|
||||||
StringTableEntry mTerrainFilePath;
|
StringTableEntry mTerrainFilePath;
|
||||||
Resource<TerrainFile> mTerrainFile;
|
Resource<TerrainFile> mTerrainFile;
|
||||||
|
|
||||||
|
|
@ -75,7 +76,8 @@ public:
|
||||||
|
|
||||||
virtual void setDataField(StringTableEntry slotName, const char* array, const char* value);
|
virtual void setDataField(StringTableEntry slotName, const char* array, const char* value);
|
||||||
|
|
||||||
void setTerrainFilePath(const char* pTerrainFile);
|
void setTerrainFileName(const char* pTerrainFile);
|
||||||
|
inline StringTableEntry getTerrainFileName(void) const { return mTerrainFileName; };
|
||||||
inline StringTableEntry getTerrainFilePath(void) const { return mTerrainFilePath; };
|
inline StringTableEntry getTerrainFilePath(void) const { return mTerrainFilePath; };
|
||||||
|
|
||||||
inline Resource<TerrainFile> getTerrainResource(void) const { return mTerrainFile; };
|
inline Resource<TerrainFile> getTerrainResource(void) const { return mTerrainFile; };
|
||||||
|
|
@ -93,8 +95,8 @@ protected:
|
||||||
virtual void initializeAsset();
|
virtual void initializeAsset();
|
||||||
virtual void onAssetRefresh(void);
|
virtual void onAssetRefresh(void);
|
||||||
|
|
||||||
static bool setTerrainFilePath(void *obj, const char *index, const char *data) { static_cast<TerrainAsset*>(obj)->setTerrainFilePath(data); return false; }
|
static bool setTerrainFileName(void *obj, const char *index, const char *data) { static_cast<TerrainAsset*>(obj)->setTerrainFileName(data); return false; }
|
||||||
static const char* getTerrainFilePath(void* obj, const char* data) { return static_cast<TerrainAsset*>(obj)->getTerrainFilePath(); }
|
static const char* getTerrainFileName(void* obj, const char* data) { return static_cast<TerrainAsset*>(obj)->getTerrainFileName(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
DefineConsoleType(TypeTerrainAssetPtr, TerrainAsset)
|
DefineConsoleType(TypeTerrainAssetPtr, TerrainAsset)
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ ConsoleSetType(TypeTerrainMaterialAssetPtr)
|
||||||
TerrainMaterialAsset::TerrainMaterialAsset()
|
TerrainMaterialAsset::TerrainMaterialAsset()
|
||||||
{
|
{
|
||||||
mScriptFile = StringTable->EmptyString();
|
mScriptFile = StringTable->EmptyString();
|
||||||
|
mScriptPath = StringTable->EmptyString();
|
||||||
mMatDefinitionName = StringTable->EmptyString();
|
mMatDefinitionName = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,18 +121,18 @@ void TerrainMaterialAsset::initializeAsset()
|
||||||
|
|
||||||
compileShader();
|
compileShader();
|
||||||
|
|
||||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
mScriptPath = expandAssetFilePath(mScriptFile);
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerrainMaterialAsset::onAssetRefresh()
|
void TerrainMaterialAsset::onAssetRefresh()
|
||||||
{
|
{
|
||||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
mScriptPath = expandAssetFilePath(mScriptFile);
|
||||||
|
|
||||||
if (Platform::isFile(mScriptFile))
|
if (Platform::isFile(mScriptPath))
|
||||||
Con::executeFile(mScriptFile, false, false);
|
Con::executeFile(mScriptPath, false, false);
|
||||||
|
|
||||||
if (mMatDefinitionName != StringTable->EmptyString())
|
if (mMatDefinitionName != StringTable->EmptyString())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ class TerrainMaterialAsset : public AssetBase
|
||||||
typedef AssetBase Parent;
|
typedef AssetBase Parent;
|
||||||
|
|
||||||
StringTableEntry mScriptFile;
|
StringTableEntry mScriptFile;
|
||||||
|
StringTableEntry mScriptPath;
|
||||||
StringTableEntry mMatDefinitionName;
|
StringTableEntry mMatDefinitionName;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -72,6 +73,8 @@ public:
|
||||||
void setScriptFile(const char* pScriptFile);
|
void setScriptFile(const char* pScriptFile);
|
||||||
inline StringTableEntry getScriptFile(void) const { return mScriptFile; };
|
inline StringTableEntry getScriptFile(void) const { return mScriptFile; };
|
||||||
|
|
||||||
|
inline StringTableEntry getScriptPath(void) const { return mScriptPath; };
|
||||||
|
|
||||||
/// Declare Console Object.
|
/// Declare Console Object.
|
||||||
DECLARE_CONOBJECT(TerrainMaterialAsset);
|
DECLARE_CONOBJECT(TerrainMaterialAsset);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ void AssetImportObject::initPersistFields()
|
||||||
|
|
||||||
addField("tamlFilePath", TypeRealString, Offset(tamlFilePath, AssetImportObject), "What is the ultimate asset taml file path for this import item");
|
addField("tamlFilePath", TypeRealString, Offset(tamlFilePath, AssetImportObject), "What is the ultimate asset taml file path for this import item");
|
||||||
|
|
||||||
addField("imageSuffixType", TypeRealString, Offset(imageSuffixType, AssetImportObject), "Specific to ImageAsset type. What is the image asset's suffix type. Options are: Albedo, Normal, Roughness, AO, Metalness, PBRConfig");
|
addField("imageType", TypeRealString, Offset(imageSuffixType, AssetImportObject), "Specific to ImageAsset type. What is the image asset's suffix type. Options are: Albedo, Normal, Roughness, AO, Metalness, PBRConfig");
|
||||||
|
|
||||||
addField("shapeInfo", TYPEID< GuiTreeViewCtrl >(), Offset(shapeInfo, AssetImportObject), "Specific to ShapeAsset type. Processed information about the shape file. Contains numbers and lists of meshes, materials and animations");
|
addField("shapeInfo", TYPEID< GuiTreeViewCtrl >(), Offset(shapeInfo, AssetImportObject), "Specific to ShapeAsset type. Processed information about the shape file. Contains numbers and lists of meshes, materials and animations");
|
||||||
}
|
}
|
||||||
|
|
@ -1939,6 +1939,10 @@ void AssetImporter::resolveAssetItemIssues(AssetImportObject* assetItem)
|
||||||
resetAssetValidationStatus(assetItem);
|
resetAssetValidationStatus(assetItem);
|
||||||
importIssues = false;
|
importIssues = false;
|
||||||
}
|
}
|
||||||
|
else if (activeImportConfig.DuplicatAutoResolution == String("UseExisting"))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (assetItem->statusType == String("MissingFile"))
|
else if (assetItem->statusType == String("MissingFile"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ ConsoleSetType(TypeStateMachineAssetPtr)
|
||||||
StateMachineAsset::StateMachineAsset()
|
StateMachineAsset::StateMachineAsset()
|
||||||
{
|
{
|
||||||
mStateMachineFile = StringTable->EmptyString();
|
mStateMachineFile = StringTable->EmptyString();
|
||||||
|
mStateMachinePath = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -133,7 +134,7 @@ void StateMachineAsset::setStateMachineFile(const char* pStateMachineFile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update.
|
// Update.
|
||||||
mStateMachineFile = getOwned() ? expandAssetFilePath(pStateMachineFile) : StringTable->insert(pStateMachineFile);
|
mStateMachineFile = StringTable->insert(pStateMachineFile);
|
||||||
|
|
||||||
// Refresh the asset.
|
// Refresh the asset.
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
|
|
@ -141,9 +142,15 @@ void StateMachineAsset::setStateMachineFile(const char* pStateMachineFile)
|
||||||
|
|
||||||
void StateMachineAsset::initializeAsset()
|
void StateMachineAsset::initializeAsset()
|
||||||
{
|
{
|
||||||
mStateMachineFile = expandAssetFilePath(mStateMachineFile);
|
mStateMachinePath = expandAssetFilePath(mStateMachineFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StateMachineAsset::onAssetRefresh()
|
||||||
|
{
|
||||||
|
mStateMachinePath = expandAssetFilePath(mStateMachineFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DefineEngineMethod(StateMachineAsset, notifyAssetChanged, void, (),,"")
|
DefineEngineMethod(StateMachineAsset, notifyAssetChanged, void, (),,"")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ class StateMachineAsset : public AssetBase
|
||||||
typedef AssetBase Parent;
|
typedef AssetBase Parent;
|
||||||
|
|
||||||
StringTableEntry mStateMachineFile;
|
StringTableEntry mStateMachineFile;
|
||||||
|
StringTableEntry mStateMachinePath;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StateMachineAsset();
|
StateMachineAsset();
|
||||||
|
|
@ -62,9 +63,11 @@ public:
|
||||||
void setStateMachineFile(const char* pStateMachineFile);
|
void setStateMachineFile(const char* pStateMachineFile);
|
||||||
inline StringTableEntry getStateMachineFile(void) const { return mStateMachineFile; };
|
inline StringTableEntry getStateMachineFile(void) const { return mStateMachineFile; };
|
||||||
|
|
||||||
|
inline StringTableEntry getStateMachinePath(void) const { return mStateMachinePath; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initializeAsset(void);
|
virtual void initializeAsset(void);
|
||||||
virtual void onAssetRefresh(void) {}
|
virtual void onAssetRefresh(void);
|
||||||
|
|
||||||
static bool setStateMachineFile(void *obj, const char *index, const char *data) { static_cast<StateMachineAsset*>(obj)->setStateMachineFile(data); return false; }
|
static bool setStateMachineFile(void *obj, const char *index, const char *data) { static_cast<StateMachineAsset*>(obj)->setStateMachineFile(data); return false; }
|
||||||
static const char* getStateMachineFile(void* obj, const char* data) { return static_cast<StateMachineAsset*>(obj)->getStateMachineFile(); }
|
static const char* getStateMachineFile(void* obj, const char* data) { return static_cast<StateMachineAsset*>(obj)->getStateMachineFile(); }
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ function AssetBrowser::onWake(%this)
|
||||||
|
|
||||||
AssetBrowser-->previewSlider.setValue(EditorSettings.value("Assets/Browser/previewTileSize", "1.0"));
|
AssetBrowser-->previewSlider.setValue(EditorSettings.value("Assets/Browser/previewTileSize", "1.0"));
|
||||||
|
|
||||||
AssetBrowser.toggleAssetTypeFilter(0);
|
AssetBrowser-->filterAssetsButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function contentTreeTabBook::onTabSelected(%this, %tabText, %tabIndex)
|
function contentTreeTabBook::onTabSelected(%this, %tabText, %tabIndex)
|
||||||
|
|
@ -279,7 +279,11 @@ function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %ta
|
||||||
//visibility filter
|
//visibility filter
|
||||||
if(%AssetTypeFilter !$= "")
|
if(%AssetTypeFilter !$= "")
|
||||||
{
|
{
|
||||||
AssetBrowser.toggleAssetTypeFilter(0);
|
AssetBrowser-->filterAssetsButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AssetBrowser-->filterAssetsButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(%selectCallback $= "")
|
if(%selectCallback $= "")
|
||||||
|
|
@ -503,7 +507,7 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
|
||||||
//%previewButton-->AssetPreviewButton.internalName = %this.previewData.assetName@"Border";
|
//%previewButton-->AssetPreviewButton.internalName = %this.previewData.assetName@"Border";
|
||||||
//%previewButton-->Button.extent = %previewSize.x + %previewBounds SPC %previewSize.y + 24;
|
//%previewButton-->Button.extent = %previewSize.x + %previewBounds SPC %previewSize.y + 24;
|
||||||
%previewButton.tooltip = %this.previewData.tooltip;
|
%previewButton.tooltip = %this.previewData.tooltip;
|
||||||
%previewButton.Command = "AssetBrowser.updateSelection( $ThisControl.getParent().assetName, $ThisControl.getParent().moduleName );";
|
%previewButton.Command = "AssetBrowser.updateSelection( $ThisControl.assetName, $ThisControl.moduleName );";
|
||||||
%previewButton.altCommand = %doubleClickCommand;
|
%previewButton.altCommand = %doubleClickCommand;
|
||||||
//%previewButton-->AssetPreviewButton.icon = %this.previewData.previewImage;
|
//%previewButton-->AssetPreviewButton.icon = %this.previewData.previewImage;
|
||||||
|
|
||||||
|
|
@ -1463,11 +1467,24 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//got it.
|
if(AssetBrowser.assetTypeFilter !$= "")
|
||||||
%assetArray.add( %moduleName, %assetId );
|
{
|
||||||
|
if(AssetBrowser.assetTypeFilter $= %assetType)
|
||||||
if(%assetType !$= "Folder")
|
{
|
||||||
%finalAssetCount++;
|
%assetArray.add( %moduleName, %assetId );
|
||||||
|
|
||||||
|
if(%assetType !$= "Folder")
|
||||||
|
%finalAssetCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//got it.
|
||||||
|
%assetArray.add( %moduleName, %assetId );
|
||||||
|
|
||||||
|
if(%assetType !$= "Folder")
|
||||||
|
%finalAssetCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ function AssetBrowser::prepareImportImageAsset(%this, %assetItem)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
%suffixPos = strpos(strlwr(%assetItem.AssetName), strlwr(%assetItem.imageSuffixType), 0);
|
%suffixPos = strpos(strlwr(%assetItem.AssetName), strlwr(%assetItem.ImageType), 0);
|
||||||
%noSuffixName = getSubStr(%assetItem.AssetName, 0, %suffixPos);
|
%noSuffixName = getSubStr(%assetItem.AssetName, 0, %suffixPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -280,7 +280,7 @@ function parseImageSuffixes(%assetItem)
|
||||||
%suffixToken = getToken(getAssetImportConfigValue("Images/DiffuseTypeSuffixes", ""), ",;", %sfx);
|
%suffixToken = getToken(getAssetImportConfigValue("Images/DiffuseTypeSuffixes", ""), ",;", %sfx);
|
||||||
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
||||||
{
|
{
|
||||||
%assetItem.imageSuffixType = %suffixToken;
|
%assetItem.ImageType = %suffixToken;
|
||||||
return "diffuse";
|
return "diffuse";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -292,7 +292,7 @@ function parseImageSuffixes(%assetItem)
|
||||||
%suffixToken = getToken(getAssetImportConfigValue("Images/NormalTypeSuffixes", ""), ",;", %sfx);
|
%suffixToken = getToken(getAssetImportConfigValue("Images/NormalTypeSuffixes", ""), ",;", %sfx);
|
||||||
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
||||||
{
|
{
|
||||||
%assetItem.imageSuffixType = %suffixToken;
|
%assetItem.ImageType = %suffixToken;
|
||||||
return "normal";
|
return "normal";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -304,7 +304,7 @@ function parseImageSuffixes(%assetItem)
|
||||||
%suffixToken = getToken(getAssetImportConfigValue("Images/RoughnessTypeSuffixes", ""), ",;", %sfx);
|
%suffixToken = getToken(getAssetImportConfigValue("Images/RoughnessTypeSuffixes", ""), ",;", %sfx);
|
||||||
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
||||||
{
|
{
|
||||||
%assetItem.imageSuffixType = %suffixToken;
|
%assetItem.ImageType = %suffixToken;
|
||||||
return "roughness";
|
return "roughness";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -316,7 +316,7 @@ function parseImageSuffixes(%assetItem)
|
||||||
%suffixToken = getToken(getAssetImportConfigValue("Images/AOTypeSuffixes", ""), ",;", %sfx);
|
%suffixToken = getToken(getAssetImportConfigValue("Images/AOTypeSuffixes", ""), ",;", %sfx);
|
||||||
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
||||||
{
|
{
|
||||||
%assetItem.imageSuffixType = %suffixToken;
|
%assetItem.ImageType = %suffixToken;
|
||||||
return "AO";
|
return "AO";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -328,7 +328,7 @@ function parseImageSuffixes(%assetItem)
|
||||||
%suffixToken = getToken(getAssetImportConfigValue("Images/MetalnessTypeSuffixes", ""), ",;", %sfx);
|
%suffixToken = getToken(getAssetImportConfigValue("Images/MetalnessTypeSuffixes", ""), ",;", %sfx);
|
||||||
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
||||||
{
|
{
|
||||||
%assetItem.imageSuffixType = %suffixToken;
|
%assetItem.ImageType = %suffixToken;
|
||||||
return "metalness";
|
return "metalness";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -340,7 +340,7 @@ function parseImageSuffixes(%assetItem)
|
||||||
%suffixToken = getToken(getAssetImportConfigValue("Images/CompositeTypeSuffixes", ""), ",;", %sfx);
|
%suffixToken = getToken(getAssetImportConfigValue("Images/CompositeTypeSuffixes", ""), ",;", %sfx);
|
||||||
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
if(strIsMatchExpr("*"@%suffixToken, %assetItem.AssetName))
|
||||||
{
|
{
|
||||||
%assetItem.imageSuffixType = %suffixToken;
|
%assetItem.ImageType = %suffixToken;
|
||||||
return "composite";
|
return "composite";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -555,6 +555,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
|
||||||
}
|
}
|
||||||
|
|
||||||
%mat.diffuseMap = %newDiffuse;
|
%mat.diffuseMap = %newDiffuse;
|
||||||
|
%mat.diffuseMapAsset = "";
|
||||||
%mat.normalMap = %newNormal;
|
%mat.normalMap = %newNormal;
|
||||||
%mat.pbrConfigMap = %newPBRConfig;
|
%mat.pbrConfigMap = %newPBRConfig;
|
||||||
%mat.detailMap = %newDetail;
|
%mat.detailMap = %newDetail;
|
||||||
|
|
@ -575,7 +576,11 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
|
||||||
|
|
||||||
%fileName = %mat.getFileName();
|
%fileName = %mat.getFileName();
|
||||||
if( %fileName $= "" )
|
if( %fileName $= "" )
|
||||||
%fileName = "data/terrains/materials.cs";
|
{
|
||||||
|
error("TerrainMaterialDlg::saveDirtyMaterial() - terrain material doesn't have a fileName set to save to.");
|
||||||
|
return;
|
||||||
|
//%fileName = "data/terrains/materials.cs";
|
||||||
|
}
|
||||||
|
|
||||||
ETerrainMaterialPersistMan.setDirty( %mat, %fileName );
|
ETerrainMaterialPersistMan.setDirty( %mat, %fileName );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue