mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-18 22:23:48 +00:00
Expands/Cleans up a lot of the asset functionality, including management, file association, and creation/importing
This commit is contained in:
parent
a366f65047
commit
4422082035
73 changed files with 4468 additions and 1876 deletions
|
|
@ -92,6 +92,7 @@ ConsoleSetType(TypeLevelAssetPtr)
|
|||
|
||||
LevelAsset::LevelAsset() : AssetBase(), mIsSubLevel(false)
|
||||
{
|
||||
mLevelName = StringTable->EmptyString();
|
||||
mLevelFile = StringTable->EmptyString();
|
||||
mPreviewImage = StringTable->EmptyString();
|
||||
|
||||
|
|
@ -115,8 +116,11 @@ void LevelAsset::initPersistFields()
|
|||
// Call parent.
|
||||
Parent::initPersistFields();
|
||||
|
||||
addField("LevelFile", TypeString, Offset(mLevelFile, LevelAsset), "Path to the actual level file.");
|
||||
addField("PreviewImage", TypeString, Offset(mPreviewImage, LevelAsset), "Path to the image used for selection preview.");
|
||||
addProtectedField("LevelFile", TypeAssetLooseFilePath, Offset(mLevelFile, LevelAsset),
|
||||
&setLevelFile, &getLevelFile, "Path to the actual level file.");
|
||||
addField("LevelName", TypeString, Offset(mLevelName, LevelAsset), "Human-friendly name for the level.");
|
||||
addProtectedField("PreviewImage", TypeAssetLooseFilePath, Offset(mPreviewImage, LevelAsset),
|
||||
&setPreviewImageFile, &getPreviewImageFile, "Path to the image used for selection preview.");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -125,4 +129,54 @@ void LevelAsset::copyTo(SimObject* object)
|
|||
{
|
||||
// Call to parent.
|
||||
Parent::copyTo(object);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
void LevelAsset::initializeAsset()
|
||||
{
|
||||
// Call parent.
|
||||
Parent::initializeAsset();
|
||||
|
||||
// Ensure the image-file is expanded.
|
||||
mPreviewImage = expandAssetFilePath(mPreviewImage);
|
||||
mLevelFile = expandAssetFilePath(mLevelFile);
|
||||
}
|
||||
|
||||
//
|
||||
void LevelAsset::setLevelFile(const char* pLevelFile)
|
||||
{
|
||||
// Sanity!
|
||||
AssertFatal(pLevelFile != NULL, "Cannot use a NULL level file.");
|
||||
|
||||
// Fetch image file.
|
||||
pLevelFile = StringTable->insert(pLevelFile);
|
||||
|
||||
// Ignore no change,
|
||||
if (pLevelFile == mLevelFile)
|
||||
return;
|
||||
|
||||
// Update.
|
||||
mLevelFile = getOwned() ? expandAssetFilePath(pLevelFile) : StringTable->insert(pLevelFile);
|
||||
|
||||
// Refresh the asset.
|
||||
refreshAsset();
|
||||
}
|
||||
|
||||
void LevelAsset::setImageFile(const char* pImageFile)
|
||||
{
|
||||
// Sanity!
|
||||
AssertFatal(pImageFile != NULL, "Cannot use a NULL image file.");
|
||||
|
||||
// Fetch image file.
|
||||
pImageFile = StringTable->insert(pImageFile);
|
||||
|
||||
// Ignore no change,
|
||||
if (pImageFile == mPreviewImage)
|
||||
return;
|
||||
|
||||
// Update.
|
||||
mPreviewImage = getOwned() ? expandAssetFilePath(pImageFile) : StringTable->insert(pImageFile);
|
||||
|
||||
// Refresh the asset.
|
||||
refreshAsset();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue