Fixes issue of not being able to create GameModes or blank MaterialAssets from the Asset Browser

This commit is contained in:
JeffR 2025-06-17 19:08:45 -05:00
parent 46bcd183f7
commit d35a305149
5 changed files with 124 additions and 21 deletions

View file

@ -255,8 +255,10 @@ function CreateNewAsset()
Canvas.popDialog(AssetBrowser_newAsset);
%assetTypeGroup = AssetBrowser::getAssetTypeGroup(%assetType);
//Load it
if(!AssetDatabase.isDeclaredAsset(%moduleName @ ":" @ %assetName))
if(%assetTypeGroup $= "Asset" && !AssetDatabase.isDeclaredAsset(%moduleName @ ":" @ %assetName))
{
%moduleDef = ModuleDatabase.findModule(%moduleName,1);
AssetDatabase.addDeclaredAsset(%moduleDef, %assetFilePath);
@ -270,18 +272,7 @@ function CreateNewAsset()
%callbackCommand = "" @ AssetBrowser_newAsset.callbackFunc @ "(\"" @ %moduleName @ ":" @ %assetName @ "\");";
eval(%callbackCommand);
}
//Update the selection to immediately jump to the new asset
/*AssetBrowser-->filterTree.clearSelection();
%ModuleItem = AssetBrowser-->filterTree.findItemByName(%moduleName);
%assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%ModuleItem, %assetType);
AssetBrowser-->filterTree.selectItem(%assetTypeId);
%selectedItem = AssetBrowser-->filterTree.getSelectedItem();
AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem);
AssetBrowser-->filterTree.buildVisibleTree(); */
AssetBrowser.refresh();
}