Adds handling for import of files marked as ShapeAnimationAsset

Adds filetype handling of dsqs for importing
Improves logic checks to prevent incorrectly redundantly processing incoming assets for collisions, which could mark all assets as colliding instead of all but the first.
Adds better handling for assets marked as for dependency usage when importing
Improves rules for writing originalFilePath only if it's actually from an external directory, and the file actually exists to prevent polluting in redundant or garbage data
Fixes issue where MaterialEditor was not tracking the currently material assetId if the material was changed via the dropdown selector
Adds a sanity check to shapeAnimationAsset load so if the resource does not load properly it doesn't hard crash but instead logs the error and returns safely.
This commit is contained in:
JeffR 2022-03-20 03:17:31 -05:00
parent ee4253c982
commit b3342ff7e6
10 changed files with 160 additions and 17 deletions

View file

@ -195,7 +195,7 @@
<Setting
name="AutomaticallyPromptMissingFiles">0</Setting>
<Setting
name="DuplicateAutoResolution">FolderPrefix</Setting>
name="DuplicateAutoResolution">AutoPrune</Setting>
<Setting
name="PreventImportWithErrors">1</Setting>
<Setting

View file

@ -108,7 +108,8 @@ function isShapeFormat(%fileExt)
(%fileExt $= ".gltf") ||
(%fileExt $= ".glb") ||
(%fileExt $= ".obj") ||
(%fileExt $= ".blend"))
(%fileExt $= ".blend") ||
(%fileExt $= ".dsq"))
return true;
return false;

View file

@ -148,10 +148,15 @@ function AssetBrowser::importImageAsset(%this, %assetItem)
assetName = %assetName;
versionId = 1;
imageFile = fileName(%filePath);
originalFilePath = %filePath;
imageType = %assetItem.imageType;
};
//No point in indicating the original path data if it was imported in-place
if(!startsWith(makeFullPath(%filePath), getMainDotCsDir()))
{
%newAsset.originalFilePath = %filePath;
}
%assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml");
//and copy the file into the relevent directory

View file

@ -321,10 +321,16 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem)
versionId = 1;
shaderGraph = %sgfPath;
scriptFile = %assetName @ "." @ $TorqueScriptFileExtension;
originalFilePath = %filePath;
materialDefinitionName = %assetName;
};
//No point in indicating the original path data if it was imported in-place
%mainPath = getMainDotCsDir();
if(!startsWith(makeFullPath(%filePath), getMainDotCsDir()))
{
%newAsset.originalFilePath = %filePath;
}
//check dependencies
%dependencySlotId = 0;
for(%i=0; %i < %assetItem.childAssetItems.count(); %i++)

View file

@ -131,10 +131,15 @@ function AssetBrowser::importShapeAsset(%this, %assetItem)
assetName = %assetName;
versionId = 1;
fileName = fileName(%filePath);
originalFilePath = %filePath;
isNewShape = true;
};
//No point in indicating the original path data if it was imported in-place
if(!startsWith(makeFullPath(%filePath), getMainDotCsDir()))
{
%newAsset.originalFilePath = %filePath;
}
//check dependencies
%dependencySlotId = 0;
for(%i=0; %i < %assetItem.childAssetItems.count(); %i++)

View file

@ -290,6 +290,15 @@ function SubMaterialSelector::onSelect( %this )
if( MaterialEditorGui.currentObject.isMethod("postApply") )
MaterialEditorGui.currentObject.postApply();*/
}
else
{
%materialAssetId = MaterialAsset::getAssetIdByMaterialName(%material);
if(%materialAssetId !$= "" && %materialAssetId !$= $Core::NoMaterialAssetFallback)
{
MaterialEditorGui.currentMaterialAsset = %materialAssetId;
%assetDef = AssetDatabase.acquireAsset(%material);
}
}
MaterialEditorGui.prepareActiveMaterial( %material.getId() );
}
@ -1950,6 +1959,7 @@ function MaterialEditorGui::save( %this )
if(MaterialEditorGui.currentMaterialAsset !$= "")
{
echo("Attempting to save material: " @ MaterialEditorGui.currentMaterialAsset);
MaterialEditorGui.copyMaterials( materialEd_previewMaterial, notDirtyMaterial );
%assetDef = AssetDatabase.acquireAsset(MaterialEditorGui.currentMaterialAsset);

View file

@ -1029,6 +1029,8 @@ function testFilenameExtensions(%filename)
return %filename @ ".dae";
else if(isFile(%filename @ ".dds"))
return %filename @ ".dds";
else if(isFile(%filename @ ".dsq"))
return %filename @ ".dsq";
else if(isFile(%filename @ ".ogg"))
return %filename @ ".ogg";
else if(isFile(%filename @ ".wav"))
@ -2101,6 +2103,7 @@ function scanForDuplicateFiles(%toTestFile)
//We only really care about content files for this
if(!endsWith(%file, "dts") &&
!endsWith(%file, "dae") &&
!endsWith(%file, "dsq") &&
!endsWith(%file, "fbx") &&
!endsWith(%file, "ter") &&
!endsWith(%file, "png") &&