You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Fix for dragging a texture on a cube when a material already exists, and some protection against redirects in similar cases.
#rb matt.peters #rb jason.stasik #preflight 6351a5d9f92c325024c634e5 [CL 22669030 by Dan Thompson in ue5-main branch]
This commit is contained in:
@@ -571,8 +571,7 @@ UObject* FLevelEditorViewportClient::GetOrCreateMaterialFromTexture(UTexture* Un
|
||||
|
||||
const FString MaterialFullName = bCreateMaterialInstance ? (TEXT("MI_") + TextureShortName) : (TextureShortName + TEXT("_Mat"));
|
||||
FString NewPackageName = FPaths::Combine(NewPackageFolder, MaterialFullName);
|
||||
NewPackageName = UPackageTools::SanitizePackageName(NewPackageName);
|
||||
UPackage* Package = CreatePackage(*NewPackageName);
|
||||
NewPackageName = UPackageTools::SanitizePackageName(NewPackageName);
|
||||
|
||||
// See if the material asset already exists with the expected name, if it does, just return
|
||||
// an instance of it.
|
||||
@@ -580,7 +579,8 @@ UObject* FLevelEditorViewportClient::GetOrCreateMaterialFromTexture(UTexture* Un
|
||||
if (AssetRegistry.GetAssetsByPackageName(*NewPackageName, OutAssetData) && (OutAssetData.Num() > 0))
|
||||
{
|
||||
UObject* FoundAsset = OutAssetData[0].GetAsset();
|
||||
if (FoundAsset->IsA(UMaterialInterface::StaticClass()))
|
||||
if (FoundAsset != nullptr && // Due to redirects we might have an asset by this name that actually doesn't exist under that name anymore.
|
||||
FoundAsset->IsA(UMaterialInterface::StaticClass()))
|
||||
{
|
||||
return FoundAsset;
|
||||
}
|
||||
@@ -588,6 +588,8 @@ UObject* FLevelEditorViewportClient::GetOrCreateMaterialFromTexture(UTexture* Un
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UPackage* Package = CreatePackage(*NewPackageName);
|
||||
|
||||
// Variations for Base Maps.
|
||||
TArray<FString> BaseSuffixes;
|
||||
BaseSuffixes.Add("_D");
|
||||
|
||||
Reference in New Issue
Block a user