You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Content browser class blacklist refactor to include subclasses
#rb jamie.dale #ROBOMERGE-SOURCE: CL 10717848 via CL 10717920 #ROBOMERGE-BOT: (v610-10636431) [CL 10717961 by rex hill in Main branch]
This commit is contained in:
@@ -155,6 +155,7 @@ UAssetToolsImpl::UAssetToolsImpl(const FObjectInitializer& ObjectInitializer)
|
||||
, AssetRenameManager(MakeShareable(new FAssetRenameManager))
|
||||
, AssetFixUpRedirectors(MakeShareable(new FAssetFixUpRedirectors))
|
||||
, NextUserCategoryBit(EAssetTypeCategories::FirstUser)
|
||||
, AssetClassBlacklist(MakeShared<FBlacklistNames>())
|
||||
, FolderBlacklist(MakeShared<FBlacklistPaths>())
|
||||
{
|
||||
TArray<FString> SupportedTypesArray;
|
||||
@@ -162,9 +163,11 @@ UAssetToolsImpl::UAssetToolsImpl(const FObjectInitializer& ObjectInitializer)
|
||||
|
||||
for (const FString& Type : SupportedTypesArray)
|
||||
{
|
||||
SupportedAssetTypes.Add(*Type);
|
||||
AssetClassBlacklist->AddWhitelistItem("AssetToolsConfigFile", *Type);
|
||||
}
|
||||
|
||||
AssetClassBlacklist->OnFilterChanged().AddUObject(this, &UAssetToolsImpl::AssetClassBlacklistChanged);
|
||||
|
||||
// Register the built-in advanced categories
|
||||
AllocatedCategoryBits.Add(TEXT("_BuiltIn_0"), FAdvancedAssetCategory(EAssetTypeCategories::Animation, LOCTEXT("AnimationAssetCategory", "Animation")));
|
||||
AllocatedCategoryBits.Add(TEXT("_BuiltIn_1"), FAdvancedAssetCategory(EAssetTypeCategories::Blueprint, LOCTEXT("BlueprintAssetCategory", "Blueprints")));
|
||||
@@ -264,22 +267,8 @@ UAssetToolsImpl::UAssetToolsImpl(const FObjectInitializer& ObjectInitializer)
|
||||
|
||||
void UAssetToolsImpl::RegisterAssetTypeActions(const TSharedRef<IAssetTypeActions>& NewActions)
|
||||
{
|
||||
if (SupportedAssetTypes.Num() > 0)
|
||||
{
|
||||
const UClass* SupportedClass = NewActions->GetSupportedClass();
|
||||
if (SupportedClass != nullptr)
|
||||
{
|
||||
const FName ClassName = SupportedClass->GetFName();
|
||||
if (!SupportedAssetTypes.Contains(ClassName))
|
||||
{
|
||||
NewActions->SetSupported(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NewActions->SetSupported(false);
|
||||
}
|
||||
}
|
||||
const UClass* SupportedClass = NewActions->GetSupportedClass();
|
||||
NewActions->SetSupported(SupportedClass && AssetClassBlacklist->PassesFilter(SupportedClass->GetFName()));
|
||||
|
||||
AssetTypeActionsList.Add(NewActions);
|
||||
}
|
||||
@@ -3146,6 +3135,20 @@ TArray<UFactory*> UAssetToolsImpl::GetNewAssetFactories() const
|
||||
return MoveTemp(Factories);
|
||||
}
|
||||
|
||||
TSharedRef<FBlacklistNames>& UAssetToolsImpl::GetAssetClassBlacklist()
|
||||
{
|
||||
return AssetClassBlacklist;
|
||||
}
|
||||
|
||||
void UAssetToolsImpl::AssetClassBlacklistChanged()
|
||||
{
|
||||
for (TSharedRef<IAssetTypeActions>& ActionsIt : AssetTypeActionsList)
|
||||
{
|
||||
const UClass* SupportedClass = ActionsIt->GetSupportedClass();
|
||||
ActionsIt->SetSupported(SupportedClass && AssetClassBlacklist->PassesFilter(SupportedClass->GetFName()));
|
||||
}
|
||||
}
|
||||
|
||||
TSharedRef<FBlacklistPaths>& UAssetToolsImpl::GetFolderBlacklist()
|
||||
{
|
||||
return FolderBlacklist;
|
||||
|
||||
@@ -117,6 +117,7 @@ public:
|
||||
virtual void ConvertVirtualTextures(const TArray<UTexture2D*>& Textures, bool bConvertBackToNonVirtual, const TArray<UMaterial*>* RelatedMaterials = nullptr) const override;
|
||||
virtual bool IsAssetClassSupported(const UClass* AssetClass) const override;
|
||||
virtual TArray<UFactory*> GetNewAssetFactories() const override;
|
||||
virtual TSharedRef<FBlacklistNames>& GetAssetClassBlacklist() override;
|
||||
virtual TSharedRef<FBlacklistPaths>& GetFolderBlacklist() override;
|
||||
|
||||
public:
|
||||
@@ -171,6 +172,9 @@ private:
|
||||
|
||||
UObject* PerformDuplicateAsset(const FString& AssetName, const FString& PackagePath, UObject* OriginalObject, bool bWithDialog);
|
||||
|
||||
/** Internal method that performs actions when asset class blacklist filter changes */
|
||||
void AssetClassBlacklistChanged();
|
||||
|
||||
private:
|
||||
/** The list of all registered AssetTypeActions */
|
||||
TArray<TSharedRef<IAssetTypeActions>> AssetTypeActionsList;
|
||||
@@ -181,11 +185,12 @@ private:
|
||||
/** The categories that have been allocated already */
|
||||
TMap<FName, FAdvancedAssetCategory> AllocatedCategoryBits;
|
||||
|
||||
TSet<FName> SupportedAssetTypes;
|
||||
|
||||
/** The next user category bit to allocate (set to 0 when there are no more bits left) */
|
||||
uint32 NextUserCategoryBit;
|
||||
|
||||
/** Blacklist of assets by class name */
|
||||
TSharedRef<FBlacklistNames> AssetClassBlacklist;
|
||||
|
||||
/** Blacklist of folder paths */
|
||||
TSharedRef<FBlacklistPaths> FolderBlacklist;
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@ class IClassTypeActions;
|
||||
class UFactory;
|
||||
class UAssetImportTask;
|
||||
class UAdvancedCopyCustomization;
|
||||
class FBlacklistNames;
|
||||
class FBlacklistPaths;
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
@@ -412,6 +413,9 @@ public:
|
||||
/** Find all supported asset factories. */
|
||||
virtual TArray<UFactory*> GetNewAssetFactories() const = 0;
|
||||
|
||||
/** Get asset class blacklist for content browser and other systems */
|
||||
virtual TSharedRef<FBlacklistNames>& GetAssetClassBlacklist() = 0;
|
||||
|
||||
/** Get folder blacklist for content browser and other systems */
|
||||
virtual TSharedRef<FBlacklistPaths>& GetFolderBlacklist() = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user