mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Prepend symbol for image files
Prepend image filenames in imageassets with "@" symbol so expand and collapse works correctly for files relative to that asset.taml file.
This commit is contained in:
parent
50f74368b3
commit
fc9f221ac0
5 changed files with 23 additions and 7 deletions
|
|
@ -2825,7 +2825,7 @@ Torque::Path AssetImporter::importImageAsset(AssetImportObject* assetItem)
|
||||||
StringTableEntry assetName = StringTable->insert(assetItem->assetName.c_str());
|
StringTableEntry assetName = StringTable->insert(assetItem->assetName.c_str());
|
||||||
|
|
||||||
String imageFileName = assetItem->filePath.getFullFileName();
|
String imageFileName = assetItem->filePath.getFullFileName();
|
||||||
String assetPath = targetPath + "/" + imageFileName;
|
String assetPath = "@" + imageFileName;
|
||||||
String tamlPath = targetPath + "/" + assetName + ".asset.taml";
|
String tamlPath = targetPath + "/" + assetName + ".asset.taml";
|
||||||
String originalPath = assetItem->filePath.getFullPath().c_str();
|
String originalPath = assetItem->filePath.getFullPath().c_str();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -226,10 +226,21 @@ StringTableEntry AssetBase::expandAssetFilePath(const char* pAssetFilePath) cons
|
||||||
assetBasePathHint = NULL;
|
assetBasePathHint = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand the path with the asset base-path hint.
|
|
||||||
char assetFilePathBuffer[1024];
|
char assetFilePathBuffer[1024];
|
||||||
|
|
||||||
|
if (*pAssetFilePath != '@')
|
||||||
|
{
|
||||||
|
// Expand the path with the asset base-path hint.
|
||||||
Con::expandPath(assetFilePathBuffer, sizeof(assetFilePathBuffer), pAssetFilePath, assetBasePathHint);
|
Con::expandPath(assetFilePathBuffer, sizeof(assetFilePathBuffer), pAssetFilePath, assetBasePathHint);
|
||||||
return StringTable->insert(assetFilePathBuffer);
|
return StringTable->insert(assetFilePathBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!getOwned())
|
||||||
|
return StringTable->insert(pAssetFilePath);
|
||||||
|
|
||||||
|
// Format expanded path taking into account any missing slash.
|
||||||
|
dSprintf(assetFilePathBuffer, sizeof(assetFilePathBuffer), "%s/%s", mpOwningAssetManager->getAssetPath(getAssetId()), pAssetFilePath + (pAssetFilePath[1] == '/' ? 2 : 1));
|
||||||
|
return StringTable->insert(assetFilePathBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -254,6 +265,11 @@ StringTableEntry AssetBase::collapseAssetFilePath(const char* pAssetFilePath) co
|
||||||
|
|
||||||
char assetFilePathBuffer[1024];
|
char assetFilePathBuffer[1024];
|
||||||
|
|
||||||
|
if (*pAssetFilePath == '@')
|
||||||
|
{
|
||||||
|
return StringTable->insert(pAssetFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
// Is the asset not owned or private?
|
// Is the asset not owned or private?
|
||||||
if (!getOwned() || getAssetPrivate())
|
if (!getOwned() || getAssetPrivate())
|
||||||
{
|
{
|
||||||
|
|
@ -272,7 +288,7 @@ StringTableEntry AssetBase::collapseAssetFilePath(const char* pAssetFilePath) co
|
||||||
StringTableEntry relativePath = Platform::makeRelativePathName(pAssetFilePath, assetBasePath);
|
StringTableEntry relativePath = Platform::makeRelativePathName(pAssetFilePath, assetBasePath);
|
||||||
|
|
||||||
// Format the collapsed path.
|
// Format the collapsed path.
|
||||||
dSprintf(assetFilePathBuffer, sizeof(assetFilePathBuffer), "%s", relativePath);
|
dSprintf(assetFilePathBuffer, sizeof(assetFilePathBuffer), "@%s", relativePath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ function ImageAsset::generatePreviewImage(%this, %previewButton, %forceRegenerat
|
||||||
{
|
{
|
||||||
assetName = %this.assetName @ "_Preview";
|
assetName = %this.assetName @ "_Preview";
|
||||||
versionId = 1;
|
versionId = 1;
|
||||||
imageFile = makeFullPath(%previewFilePath);
|
imageFile = "@" @ %this.assetName @ "_Preview.png";
|
||||||
};
|
};
|
||||||
|
|
||||||
TamlWrite(%preview_Asset, expandPath("^ToolsModule/resources/previewCache/" @ %previewButton.moduleName @ "/" @ %preview_Asset.AssetName @ ".asset.taml"));
|
TamlWrite(%preview_Asset, expandPath("^ToolsModule/resources/previewCache/" @ %previewButton.moduleName @ "/" @ %preview_Asset.AssetName @ ".asset.taml"));
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ function MaterialAsset::generatePreviewImage(%this, %previewButton, %forceRegene
|
||||||
{
|
{
|
||||||
assetName = %this.assetName @ "_Preview";
|
assetName = %this.assetName @ "_Preview";
|
||||||
versionId = 1;
|
versionId = 1;
|
||||||
imageFile = makeFullPath(%previewFilePath);
|
imageFile = "@" @ %this.assetName @ "_Preview.png";
|
||||||
};
|
};
|
||||||
|
|
||||||
TamlWrite(%preview_Asset, expandPath("^ToolsModule/resources/previewCache/" @ %previewButton.moduleName @ "/" @ %preview_Asset.AssetName @ ".asset.taml"));
|
TamlWrite(%preview_Asset, expandPath("^ToolsModule/resources/previewCache/" @ %previewButton.moduleName @ "/" @ %preview_Asset.AssetName @ ".asset.taml"));
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ function ShapeAsset::generatePreviewImage(%this, %previewButton, %forceRegenerat
|
||||||
{
|
{
|
||||||
assetName = %this.assetName @ "_Preview";
|
assetName = %this.assetName @ "_Preview";
|
||||||
versionId = 1;
|
versionId = 1;
|
||||||
imageFile = makeFullPath(%previewFilePath);
|
imageFile = "@" @ %this.assetName @ "_Preview.png";
|
||||||
};
|
};
|
||||||
|
|
||||||
TamlWrite(%preview_Asset, expandPath("^ToolsModule/resources/previewCache/" @ %previewButton.moduleName @ "/" @ %preview_Asset.AssetName @ ".asset.taml"));
|
TamlWrite(%preview_Asset, expandPath("^ToolsModule/resources/previewCache/" @ %previewButton.moduleName @ "/" @ %preview_Asset.AssetName @ ".asset.taml"));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue