mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Merge pull request #288 from Areloch/MiscImageAssetFixes
Misc. Image Asset improvements
This commit is contained in:
commit
81777348c8
4 changed files with 15 additions and 7 deletions
|
|
@ -353,11 +353,11 @@ ImageAsset::ImageTypes ImageAsset::getImageTypeFromName(const char* name)
|
||||||
return (ImageTypes)ret;
|
return (ImageTypes)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod(ImageAsset, getImageFilename, const char*, (), ,
|
DefineEngineMethod(ImageAsset, getImagePath, const char*, (), ,
|
||||||
"Creates an instance of the given GameObject given the asset definition.\n"
|
"Creates an instance of the given GameObject given the asset definition.\n"
|
||||||
"@return The GameObject entity created from the asset.")
|
"@return The GameObject entity created from the asset.")
|
||||||
{
|
{
|
||||||
return object->getImageFileName();
|
return object->getImagePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod(ImageAsset, getImageInfo, const char*, (), ,
|
DefineEngineMethod(ImageAsset, getImageInfo, const char*, (), ,
|
||||||
|
|
|
||||||
|
|
@ -1317,7 +1317,7 @@ void AssetImporter::processImageAsset(AssetImportObject* assetItem)
|
||||||
{
|
{
|
||||||
if (!assetItem->filePath.isEmpty())
|
if (!assetItem->filePath.isEmpty())
|
||||||
{
|
{
|
||||||
materialAsset = addImportingAsset("MaterialAsset", "", nullptr, noSuffixName);
|
materialAsset = addImportingAsset("MaterialAsset", assetItem->filePath, nullptr, noSuffixName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2466,6 +2466,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
|
||||||
dSprintf(lineBuffer, 1024, " mapTo=\"%s\";", assetName);
|
dSprintf(lineBuffer, 1024, " mapTo=\"%s\";", assetName);
|
||||||
file->writeLine((U8*)lineBuffer);
|
file->writeLine((U8*)lineBuffer);
|
||||||
|
|
||||||
|
bool hasRoughness = false;
|
||||||
for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
|
for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
|
||||||
{
|
{
|
||||||
AssetImportObject* childItem = assetItem->childAssetItems[i];
|
AssetImportObject* childItem = assetItem->childAssetItems[i];
|
||||||
|
|
@ -2502,6 +2503,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
|
||||||
else if (imageType == ImageAsset::ImageTypes::Roughness)
|
else if (imageType == ImageAsset::ImageTypes::Roughness)
|
||||||
{
|
{
|
||||||
mapFieldName = "RoughnessMap";
|
mapFieldName = "RoughnessMap";
|
||||||
|
hasRoughness = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
assetFieldName = mapFieldName + "Asset";
|
assetFieldName = mapFieldName + "Asset";
|
||||||
|
|
@ -2515,6 +2517,12 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
|
||||||
file->writeLine((U8*)lineBuffer);
|
file->writeLine((U8*)lineBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasRoughness)
|
||||||
|
{
|
||||||
|
file->writeLine((U8*)" invertSmoothness = true;");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
file->writeLine((U8*)"};");
|
file->writeLine((U8*)"};");
|
||||||
file->writeLine((U8*)"//--- OBJECT WRITE END ---");
|
file->writeLine((U8*)"//--- OBJECT WRITE END ---");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
|
||||||
%previewData.assetPath = %assetDef.scriptFile;
|
%previewData.assetPath = %assetDef.scriptFile;
|
||||||
//%previewData.doubleClickCommand = "EditorOpenFileInTorsion( "@%previewData.assetPath@", 0 );";
|
//%previewData.doubleClickCommand = "EditorOpenFileInTorsion( "@%previewData.assetPath@", 0 );";
|
||||||
|
|
||||||
%imageFilePath = %assetDef.getImageFilename();
|
%imageFilePath = %assetDef.getImagePath();
|
||||||
if(isFile(%imageFilePath))
|
if(isFile(%imageFilePath))
|
||||||
%previewData.previewImage = %imageFilePath;
|
%previewData.previewImage = %imageFilePath;
|
||||||
else
|
else
|
||||||
|
|
@ -201,7 +201,7 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
|
||||||
//Renames the asset
|
//Renames the asset
|
||||||
function AssetBrowser::renameImageAsset(%this, %assetDef, %newAssetName)
|
function AssetBrowser::renameImageAsset(%this, %assetDef, %newAssetName)
|
||||||
{
|
{
|
||||||
%newFilename = renameAssetLooseFile(%assetDef.imageFile, %newAssetName);
|
%newFilename = renameAssetLooseFile(%assetDef.getImagePath(), %newAssetName);
|
||||||
|
|
||||||
if(!%newFilename $= "")
|
if(!%newFilename $= "")
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ function ConvexEditorMaterialBtn::gotMaterialName(%this, %name)
|
||||||
if(%diffuseAsset !$= "")
|
if(%diffuseAsset !$= "")
|
||||||
{
|
{
|
||||||
%diffuseAssetDef = AssetDatabase.acquireAsset(%diffuseAsset);
|
%diffuseAssetDef = AssetDatabase.acquireAsset(%diffuseAsset);
|
||||||
%diffusemap = %diffuseAssetDef.imageFile;
|
%diffusemap = %diffuseAssetDef.getImagePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,7 +228,7 @@ function ConvexEditorDefaultMaterialBtn::gotMaterialName(%this, %name)
|
||||||
if(%diffuseAsset !$= "")
|
if(%diffuseAsset !$= "")
|
||||||
{
|
{
|
||||||
%diffuseAssetDef = AssetDatabase.acquireAsset(%diffuseAsset);
|
%diffuseAssetDef = AssetDatabase.acquireAsset(%diffuseAsset);
|
||||||
%diffusemap = %diffuseAssetDef.imageFile;
|
%diffusemap = %diffuseAssetDef.getImagePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue