Files
UnrealEngineUWP/Engine/Source/Editor/ContentBrowserData/Public/ContentBrowserDataUtils.h
julien stjean 44bb9a0756 First pass at adding the asset data tags and values into teds.
All thedata can be populated via this cvar TEDS.AssetDataStorage.Metadata.

Stuff that doesn't work yet:
Missing attribute metadata for some asset types. (DataAsset that are base on a blueprint type and some types that are not created  by a factory or that doesn't have an asset definition for their asset type).
Update of assets will keep around the old tags and values that are no-longer present for now.
Perf is not there yet.

#jira UE-222853
#rb ronald.koppers

[CL 36017165 by julien stjean in ue5-main branch]
2024-09-04 13:55:22 -04:00

58 lines
2.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Containers/StringFwd.h"
#include "Containers/UnrealString.h"
#include "ContentBrowserDataFilter.h"
#include "CoreMinimal.h"
#include "HAL/Platform.h"
#include "Internationalization/Text.h"
#include "UObject/NameTypes.h"
class UObject;
struct FAssetData;
namespace ContentBrowserDataUtils
{
/** Returns number of folders in forward slashed path (Eg, 1 for "/Path", 2 for "/Path/Name") */
CONTENTBROWSERDATA_API int32 CalculateFolderDepthOfPath(const FStringView InPath);
/** Returns true if folder has a depth of 1 */
CONTENTBROWSERDATA_API bool IsTopLevelFolder(const FStringView InFolderPath);
/** Returns true if folder has a depth of 1 */
CONTENTBROWSERDATA_API bool IsTopLevelFolder(const FName InFolderPath);
/** Return the test depth after which it is not needed to test the attribute filter if the parent folder was tested */
CONTENTBROWSERDATA_API int32 GetMaxFolderDepthRequiredForAttributeFilter();
/**
* Tests internal path against attribute filter
*
* @param InPath Invariant path to test
* @param InAlreadyCheckedDepth Number of folders deep that have already been tested to avoid re-testing during recursion. Pass 0 if portion of path not already tested.
* @param InItemAttributeFilter Filter to test against
*
* @return True if passes filter
*/
CONTENTBROWSERDATA_API bool PathPassesAttributeFilter(const FStringView InPath, const int32 InAlreadyCheckedDepth, const EContentBrowserItemAttributeFilter InAttributeFilter);
/**
* Get display name override if there is one for InFolderPath
*
* @param InFolderPath Internal path to get display name override for
* @param InFolderItemName Short name of InFolderPath (rightmost folder name)
* @param bIsClassesFolder True if this folder is a classes folder
* @param bIsCookedPath True if this folder only contains cooked content (recursively), or false if it contains any uncooked content
*
* @return Override display name or empty string
*/
CONTENTBROWSERDATA_API FText GetFolderItemDisplayNameOverride(const FName InFolderPath, const FString& InFolderItemName, const bool bIsClassesFolder, const bool bIsCookedPath = false);
CONTENTBROWSERDATA_API bool IsPrimaryAsset(const FAssetData& InAssetData);
CONTENTBROWSERDATA_API bool IsPrimaryAsset(UObject* InObject);
}