mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Re-added prefix handling for named texture lookups for image asset fields
Changed render-out of shape preview images to use png Added filter against previewCache folder
This commit is contained in:
parent
0fa8b97f91
commit
8ed3bab44c
|
|
@ -264,7 +264,7 @@ public:
|
|||
{ \
|
||||
imageAssetId = query.mAssetList[0]; \
|
||||
} \
|
||||
else if(Torque::FS::IsFile(_in)) \
|
||||
else if(Torque::FS::IsFile(_in) || (_in[0] == '$' || _in[0] == '#')) \
|
||||
{ \
|
||||
imageAssetId = ImageAsset::getAssetIdByFilename(_in); \
|
||||
if (imageAssetId == ImageAsset::smNoImageAssetFallback) \
|
||||
|
|
|
|||
|
|
@ -626,28 +626,13 @@ const char* ShapeAsset::generateCachedPreviewImage(S32 resolution, String overri
|
|||
delete imposterCap;
|
||||
delete shape;
|
||||
|
||||
String dumpPath = String(mFilePath) + "_Preview.dds";
|
||||
String dumpPath = String(mFilePath) + ".png";
|
||||
|
||||
char* returnBuffer = Con::getReturnBuffer(128);
|
||||
dSprintf(returnBuffer, 128, "%s", dumpPath.c_str());
|
||||
|
||||
/*FileStream stream;
|
||||
if (stream.open(dumpPath, Torque::FS::File::Write))
|
||||
destBmp.writeBitmap("png", stream);
|
||||
stream.close();*/
|
||||
imposter->writeBitmap("png", dumpPath);
|
||||
|
||||
DDSFile* ddsDest = DDSFile::createDDSFileFromGBitmap(imposter);
|
||||
ImageUtil::ddsCompress(ddsDest, GFXFormatBC2);
|
||||
|
||||
// Finally save the imposters to disk.
|
||||
FileStream fs;
|
||||
if (fs.open(returnBuffer, Torque::FS::File::Write))
|
||||
{
|
||||
ddsDest->write(fs);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
delete ddsDest;
|
||||
delete imposter;
|
||||
delete imposterNrml;
|
||||
|
||||
|
|
|
|||
|
|
@ -2778,7 +2778,7 @@ function getAssetPreviewImage(%asset)
|
|||
|
||||
if(%previewPath $= "")
|
||||
%previewPath = "ToolsModule:unknownImage_image";
|
||||
|
||||
|
||||
return %previewPath;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ function ImageAsset::generatePreviewImage(%this, %previewButton, %forceRegenerat
|
|||
}
|
||||
|
||||
%previewFilePath = %previewPath @ %this.assetName @ ".png";
|
||||
|
||||
if(!isFile(%previewFilePath) || (compareFileTimes(%this.getImagePath(), %previewFilePath) == 1))
|
||||
{
|
||||
%generatePreview = true;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ function MaterialAsset::buildBrowserElement(%this, %previewData)
|
|||
%previewImage = getAssetPreviewImage(%this.getAssetId());
|
||||
|
||||
%previewData.previewImage = isFile(%previewImage) ? %previewImage : "ToolsModule:genericAssetIcon_image";
|
||||
|
||||
%previewData.previewLoaded = false; //this marks it for loading progressively later
|
||||
|
||||
%previewData.assetName = %this.assetName;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function ShapeAsset::onDelete(%this)
|
|||
{
|
||||
//Special handle the cache preview image
|
||||
%module = $CurrentAssetBrowser.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%this.getShapePath())));
|
||||
%previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/" @ %this.assetName @ ".png";
|
||||
%previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/" @ %this.assetName @ ".dds";
|
||||
|
||||
if(isFile(%previewPath))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ function directoryHandler::loadFolders(%this, %path, %parentId)
|
|||
if(%parentName $= "Data" && (%folderName $= "shaderCache" || %folderName $= "cache"))
|
||||
continue;
|
||||
|
||||
if(%folderName $= "previewCache")
|
||||
continue;
|
||||
|
||||
if(%folderName $= ".git")
|
||||
continue;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue