Merge pull request #1701 from Azaezel/alpha41/imageAssetAugs
Some checks are pending
Linux Build / Ubuntu Latest GCC (push) Waiting to run
MacOSX Build / MacOSX Latest Clang (push) Waiting to run
Windows Build / Windows Latest MSVC (push) Waiting to run

image asset popup augs
This commit is contained in:
Brian Roberts 2026-03-24 19:05:11 -05:00 committed by GitHub
commit e56b23e63d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -127,6 +127,28 @@ function ImageAsset::generatePreviewImage(%this, %previewButton, %forceRegenerat
return false;
}
function ImageAsset::makeMaterialFrom(%this)
{
%matName = %this.assetName @ "_Mat";
%assetLoc = AssetDatabase.getAssetPath(%this.getAssetId()) @"/"@ %this.assetName @"_Mat.asset.taml";
%newMat = new Material(%matName) {
diffuseMapAsset[0] = %this.getAssetId();
mapTo = %this.assetName;
};
%matAsset = new MaterialAsset() {
assetName = %matName;
materialDefinitionName = %matName;
};
%matAsset.add(%newMat);
TamlWrite(%matAsset, expandPath(%assetLoc));
AssetDatabase.addDeclaredAsset(AssetDatabase.getAssetModule(%this.getAssetId()), %assetLoc);
return %matAsset;
}
function ImageAsset::onShowActionMenu(%this)
{
GenericAsset::onShowActionMenu(%this);
@ -134,6 +156,8 @@ function ImageAsset::onShowActionMenu(%this)
%assetId = %this.getAssetId();
EditAssetPopup.setItemPosition("Create Composite Texture" TAB "" TAB "CompositeTextureEditor.buildComposite(\"" @ %assetId @ "\");", 4);
EditAssetPopup.setItemPosition("Create Terrain Textures" TAB "" TAB "makeTerrainMapsFrom(\"" @ %assetId @ "\");", 5);
EditAssetPopup.setItemPosition("Create Material" TAB "" TAB %this @ ".makeMaterialFrom();", 6);
EditAssetPopup.objectData = %assetId;
EditAssetPopup.objectType = AssetDatabase.getAssetType(%assetId);