Adds console function to compare file modified times

Adds console function to save a scaled image
Improved logic of generating previews for shape, material and image assets to regen if original asset loose file was modified
Added logic to generate scaled preview image for material and image assets to improve load times of AB
This commit is contained in:
Areloch 2021-08-08 16:20:58 -05:00
parent 555c563b39
commit 34f0f01cea
6 changed files with 206 additions and 41 deletions

View file

@ -580,6 +580,27 @@ DefineEngineFunction( fileCreatedTime, String, ( const char* fileName ),,
return buffer;
}
DefineEngineFunction(compareFileTimes, S32, (const char* fileA, const char* fileB), ("", ""),
"@brief Compares 2 files' modified file times."
"@param fileName Name and path of first file to compare\n"
"@param fileName Name and path of second file to compare\n"
"@return S32. If value is 1, then fileA is newer. If value is -1, then fileB is newer. If value is 0, they are equal.\n"
"@ingroup FileSystem")
{
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileA);
FileTime fileATime = { 0 };
Platform::getFileTimes(sgScriptFilenameBuffer, NULL, &fileATime);
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileB);
FileTime fileBTime = { 0 };
Platform::getFileTimes(sgScriptFilenameBuffer, NULL, &fileBTime);
return Platform::compareFileTimes(fileATime, fileBTime);
}
DefineEngineFunction(fileDelete, bool, ( const char* path ),,
"@brief Delete a file from the hard drive\n\n"