2020-06-23 18:40:00 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "ContentBrowserDataSource.h"
|
2022-08-24 22:45:13 -04:00
|
|
|
|
|
|
|
|
#include "Containers/StringView.h"
|
2021-02-03 14:57:28 -04:00
|
|
|
#include "ContentBrowserDataSubsystem.h"
|
|
|
|
|
#include "ContentBrowserItemData.h"
|
2022-08-24 22:45:13 -04:00
|
|
|
#include "ContentBrowserItemPath.h"
|
2024-02-22 14:13:17 -05:00
|
|
|
#include "ContentBrowserVirtualFolderDataPayload.h"
|
2022-08-24 22:45:13 -04:00
|
|
|
#include "CoreTypes.h"
|
|
|
|
|
#include "Features/IModularFeatures.h"
|
|
|
|
|
#include "Internationalization/Internationalization.h"
|
|
|
|
|
#include "Internationalization/Text.h"
|
2021-02-03 14:57:28 -04:00
|
|
|
#include "Misc/PackageName.h"
|
2022-08-24 22:45:13 -04:00
|
|
|
#include "Misc/StringBuilder.h"
|
|
|
|
|
#include "Settings/ContentBrowserSettings.h"
|
|
|
|
|
#include "Templates/Function.h"
|
|
|
|
|
#include "Templates/UnrealTemplate.h"
|
|
|
|
|
#include "UObject/UnrealNames.h"
|
2021-02-03 14:57:28 -04:00
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
#define LOCTEXT_NAMESPACE "ContentBrowserDataSource"
|
2020-06-23 18:40:00 -04:00
|
|
|
|
|
|
|
|
FName UContentBrowserDataSource::GetModularFeatureTypeName()
|
|
|
|
|
{
|
|
|
|
|
static const FName ModularFeatureTypeName = "ContentBrowserDataSource";
|
|
|
|
|
return ModularFeatureTypeName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::RegisterDataSource()
|
|
|
|
|
{
|
|
|
|
|
IModularFeatures::Get().RegisterModularFeature(GetModularFeatureTypeName(), this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::UnregisterDataSource()
|
|
|
|
|
{
|
|
|
|
|
IModularFeatures::Get().UnregisterModularFeature(GetModularFeatureTypeName(), this);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
void UContentBrowserDataSource::Initialize(const bool InAutoRegister)
|
2020-06-23 18:40:00 -04:00
|
|
|
{
|
|
|
|
|
bIsInitialized = true;
|
|
|
|
|
|
|
|
|
|
if (InAutoRegister)
|
|
|
|
|
{
|
|
|
|
|
RegisterDataSource();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::Shutdown()
|
|
|
|
|
{
|
|
|
|
|
UnregisterDataSource();
|
|
|
|
|
|
|
|
|
|
bIsInitialized = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::BeginDestroy()
|
|
|
|
|
{
|
|
|
|
|
Shutdown();
|
|
|
|
|
|
|
|
|
|
Super::BeginDestroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::SetDataSink(IContentBrowserItemDataSink* InDataSink)
|
|
|
|
|
{
|
2021-04-29 19:32:06 -04:00
|
|
|
if (InDataSink && (InDataSink != DataSink))
|
|
|
|
|
{
|
|
|
|
|
SetVirtualPathTreeNeedsRebuild();
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
DataSink = InDataSink;
|
2021-04-29 19:32:06 -04:00
|
|
|
|
|
|
|
|
RefreshVirtualPathTreeIfNeeded();
|
2020-06-23 18:40:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::IsInitialized() const
|
|
|
|
|
{
|
|
|
|
|
return bIsInitialized;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::Tick(const float InDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
void UContentBrowserDataSource::BuildRootPathVirtualTree()
|
2020-06-23 18:40:00 -04:00
|
|
|
{
|
2021-04-29 19:32:06 -04:00
|
|
|
RootPathVirtualTree.Reset();
|
|
|
|
|
VirtualPathTreeRulesCachedState.bShowAllFolder = GetDefault<UContentBrowserSettings>()->bShowAllFolder;
|
|
|
|
|
VirtualPathTreeRulesCachedState.bOrganizeFolders = GetDefault<UContentBrowserSettings>()->bOrganizeFolders;
|
|
|
|
|
bVirtualPathTreeNeedsRebuild = false;
|
2020-06-23 18:40:00 -04:00
|
|
|
}
|
|
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
void UContentBrowserDataSource::SetVirtualPathTreeNeedsRebuild()
|
2020-06-23 18:40:00 -04:00
|
|
|
{
|
2021-04-29 19:32:06 -04:00
|
|
|
bVirtualPathTreeNeedsRebuild = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::RefreshVirtualPathTreeIfNeeded()
|
|
|
|
|
{
|
|
|
|
|
if (bVirtualPathTreeNeedsRebuild ||
|
|
|
|
|
GetDefault<UContentBrowserSettings>()->bShowAllFolder != VirtualPathTreeRulesCachedState.bShowAllFolder ||
|
|
|
|
|
GetDefault<UContentBrowserSettings>()->bOrganizeFolders != VirtualPathTreeRulesCachedState.bOrganizeFolders)
|
|
|
|
|
{
|
|
|
|
|
BuildRootPathVirtualTree();
|
|
|
|
|
}
|
2020-06-23 18:40:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::IsVirtualPathUnderMountRoot(const FName InPath) const
|
|
|
|
|
{
|
2021-04-29 19:32:06 -04:00
|
|
|
FName ConvertedPath;
|
|
|
|
|
return TryConvertVirtualPath(InPath, ConvertedPath) != EContentBrowserPathType::None;
|
|
|
|
|
}
|
2020-06-23 18:40:00 -04:00
|
|
|
|
2021-05-11 01:10:20 -04:00
|
|
|
EContentBrowserPathType UContentBrowserDataSource::TryConvertVirtualPath(const FStringView InPath, FStringBuilderBase& OutPath) const
|
|
|
|
|
{
|
|
|
|
|
return RootPathVirtualTree.TryConvertVirtualPathToInternal(InPath, OutPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EContentBrowserPathType UContentBrowserDataSource::TryConvertVirtualPath(const FStringView InPath, FString& OutPath) const
|
|
|
|
|
{
|
|
|
|
|
return RootPathVirtualTree.TryConvertVirtualPathToInternal(InPath, OutPath);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
EContentBrowserPathType UContentBrowserDataSource::TryConvertVirtualPath(const FName InPath, FName& OutPath) const
|
|
|
|
|
{
|
|
|
|
|
return RootPathVirtualTree.TryConvertVirtualPathToInternal(InPath, OutPath);
|
2020-06-23 18:40:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::TryConvertVirtualPathToInternal(const FName InPath, FName& OutInternalPath)
|
|
|
|
|
{
|
2021-04-29 19:32:06 -04:00
|
|
|
if (TryConvertVirtualPath(InPath, OutInternalPath) == EContentBrowserPathType::Internal)
|
2020-06-23 18:40:00 -04:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
OutInternalPath = NAME_None;
|
|
|
|
|
return false;
|
2020-06-23 18:40:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::TryConvertInternalPathToVirtual(const FName InInternalPath, FName& OutPath)
|
|
|
|
|
{
|
|
|
|
|
static const FName RootPath = "/";
|
2021-02-03 14:57:28 -04:00
|
|
|
|
|
|
|
|
// Special case "/" cannot be converted or remapped
|
2021-04-29 19:32:06 -04:00
|
|
|
if (InInternalPath.IsNone() || InInternalPath == RootPath || !DataSink)
|
2021-02-03 14:57:28 -04:00
|
|
|
{
|
|
|
|
|
OutPath = InInternalPath;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
FNameBuilder OutPathBuffer;
|
|
|
|
|
DataSink->ConvertInternalPathToVirtual(FNameBuilder(InInternalPath), OutPathBuffer);
|
|
|
|
|
OutPath = FName(OutPathBuffer);
|
2020-06-23 18:40:00 -04:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-09 18:06:59 -04:00
|
|
|
void UContentBrowserDataSource::RemoveUnusedCachedFilterData(const FContentBrowserDataFilterCacheIDOwner& IDOwner, TArrayView<const FName> InVirtualPathsInUse, const FContentBrowserDataFilter& DataFilter)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::ClearCachedFilterData(const FContentBrowserDataFilterCacheIDOwner& IDOwner)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
void UContentBrowserDataSource::RootPathAdded(const FStringView InInternalPath)
|
|
|
|
|
{
|
|
|
|
|
// Trim trailing slash
|
|
|
|
|
FStringView Path(InInternalPath);
|
|
|
|
|
if (Path.Len() > 1 && Path[Path.Len() - 1] == TEXT('/'))
|
|
|
|
|
{
|
|
|
|
|
Path.LeftChopInline(1);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-18 16:20:34 -04:00
|
|
|
// Handle root containing multiple folders such as /Game/FirstPerson
|
|
|
|
|
int32 SecondSlashIndex = INDEX_NONE;
|
|
|
|
|
if (Path.Len() > 1 && Path.RightChop(1).FindChar(TEXT('/'), SecondSlashIndex))
|
|
|
|
|
{
|
|
|
|
|
const FStringView FirstPath = Path.Left(SecondSlashIndex + 1);
|
|
|
|
|
|
|
|
|
|
FName FirstParentVirtualPath;
|
|
|
|
|
TryConvertInternalPathToVirtual(FName(FirstPath), FirstParentVirtualPath);
|
|
|
|
|
|
|
|
|
|
bool bIsFullyVirtual = false;
|
|
|
|
|
if (RootPathVirtualTree.PathExists(FirstParentVirtualPath, bIsFullyVirtual))
|
|
|
|
|
{
|
|
|
|
|
if (bIsFullyVirtual == false)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
FName VirtualPath;
|
|
|
|
|
FName PathFName(Path);
|
|
|
|
|
TryConvertInternalPathToVirtual(PathFName, VirtualPath);
|
|
|
|
|
RootPathVirtualTree.CachePath(VirtualPath, PathFName, [](FName AddedPath){});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::RootPathRemoved(const FStringView InInternalPath)
|
|
|
|
|
{
|
|
|
|
|
// Trim trailing slash
|
|
|
|
|
FStringView Path(InInternalPath);
|
|
|
|
|
if (Path.Len() > 1 && Path[Path.Len() - 1] == TEXT('/'))
|
|
|
|
|
{
|
|
|
|
|
Path.LeftChopInline(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FName VirtualPath;
|
|
|
|
|
TryConvertInternalPathToVirtual(FName(Path), VirtualPath);
|
|
|
|
|
RootPathVirtualTree.RemovePath(VirtualPath, [](FName RemovedPath){});
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
void UContentBrowserDataSource::CompileFilter(const FName InPath, const FContentBrowserDataFilter& InFilter, FContentBrowserDataCompiledFilter& OutCompiledFilter)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::EnumerateItemsMatchingFilter(const FContentBrowserDataCompiledFilter& InFilter, TFunctionRef<bool(FContentBrowserItemData&&)> InCallback)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-29 17:32:33 -04:00
|
|
|
void UContentBrowserDataSource::EnumerateItemsMatchingFilter(const FContentBrowserDataCompiledFilter& InFilter, const TGetOrEnumerateSink<FContentBrowserItemData>& InSink)
|
|
|
|
|
{
|
|
|
|
|
// Call older API function if this wasn't overridden
|
|
|
|
|
EnumerateItemsMatchingFilter(InFilter, [&InSink](FContentBrowserItemData&& Item) { return InSink.ProduceItem(MoveTemp(Item)); });
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
void UContentBrowserDataSource::EnumerateItemsAtPath(const FName InPath, const EContentBrowserItemTypeFilter InItemTypeFilter, TFunctionRef<bool(FContentBrowserItemData&&)> InCallback)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-29 17:32:33 -04:00
|
|
|
void UContentBrowserDataSource::EnumerateItemsAtPath(const FName InPath, const EContentBrowserItemTypeFilter InItemTypeFilter, const TGetOrEnumerateSink<FContentBrowserItemData>& InSink)
|
|
|
|
|
{
|
|
|
|
|
EnumerateItemsAtPath(InPath, InItemTypeFilter, [&InSink](FContentBrowserItemData&& Item) { return InSink.ProduceItem(MoveTemp(Item)); });
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-06 21:35:45 -04:00
|
|
|
bool UContentBrowserDataSource::EnumerateItemsAtPaths(const TArrayView<FContentBrowserItemPath> InPaths, const EContentBrowserItemTypeFilter InItemTypeFilter, TFunctionRef<bool(FContentBrowserItemData&&)> InCallback)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::EnumerateItemsForObjects(const TArrayView<UObject*> InObjects, TFunctionRef<bool(FContentBrowserItemData&&)> InCallback)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-10 00:02:37 -04:00
|
|
|
TArray<FContentBrowserItemPath> UContentBrowserDataSource::GetAliasesForPath(const FSoftObjectPath& InInternalPath) const
|
2022-07-17 22:42:48 -04:00
|
|
|
{
|
|
|
|
|
return TArray<FContentBrowserItemPath>();
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-10 00:02:37 -04:00
|
|
|
TArray<FContentBrowserItemPath> UContentBrowserDataSource::GetAliasesForPath(FName InInternalPath) const
|
|
|
|
|
{
|
2022-09-15 17:51:36 -04:00
|
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS
|
2022-09-10 00:02:37 -04:00
|
|
|
return GetAliasesForPath(FSoftObjectPath(InInternalPath));
|
2022-09-15 17:51:36 -04:00
|
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
2022-09-10 00:02:37 -04:00
|
|
|
}
|
|
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
bool UContentBrowserDataSource::IsDiscoveringItems(FText* OutStatus)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::PrioritizeSearchPath(const FName InPath)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-14 16:17:37 -04:00
|
|
|
bool UContentBrowserDataSource::IsFolderVisible(const FName Path, const EContentBrowserIsFolderVisibleFlags Flags, TOptional<FContentBrowserFolderContentsFilter> ContentsFilter)
|
2020-06-23 18:40:00 -04:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CanCreateFolder(const FName InPath, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CreateFolder(const FName InPath, FContentBrowserItemDataTemporaryContext& OutPendingItem)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::DoesItemPassFilter(const FContentBrowserItemData& InItem, const FContentBrowserDataCompiledFilter& InFilter)
|
2023-02-03 22:39:50 -05:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::ConvertItemForFilter(FContentBrowserItemData& Item, const FContentBrowserDataCompiledFilter& InFilter)
|
2020-06-23 18:40:00 -04:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::GetItemAttribute(const FContentBrowserItemData& InItem, const bool InIncludeMetaData, const FName InAttributeKey, FContentBrowserItemDataAttributeValue& OutAttributeValue)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::GetItemAttributes(const FContentBrowserItemData& InItem, const bool InIncludeMetaData, FContentBrowserItemDataAttributeValues& OutAttributeValues)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::GetItemPhysicalPath(const FContentBrowserItemData& InItem, FString& OutDiskPath)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::IsItemDirty(const FContentBrowserItemData& InItem)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CanEditItem(const FContentBrowserItemData& InItem, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::EditItem(const FContentBrowserItemData& InItem)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::BulkEditItems(TArrayView<const FContentBrowserItemData> InItems)
|
|
|
|
|
{
|
|
|
|
|
bool bSuccess = false;
|
|
|
|
|
for (const FContentBrowserItemData& Item : InItems)
|
|
|
|
|
{
|
|
|
|
|
bSuccess |= EditItem(Item);
|
|
|
|
|
}
|
|
|
|
|
return bSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-28 00:33:58 -04:00
|
|
|
bool UContentBrowserDataSource::CanViewItem(const FContentBrowserItemData& InItem, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::ViewItem(const FContentBrowserItemData& InItem)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::BulkViewItems(TArrayView<const FContentBrowserItemData> InItems)
|
|
|
|
|
{
|
|
|
|
|
bool bSuccess = false;
|
|
|
|
|
for (const FContentBrowserItemData& Item : InItems)
|
|
|
|
|
{
|
|
|
|
|
bSuccess |= ViewItem(Item);
|
|
|
|
|
}
|
|
|
|
|
return bSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
bool UContentBrowserDataSource::CanPreviewItem(const FContentBrowserItemData& InItem, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::PreviewItem(const FContentBrowserItemData& InItem)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::BulkPreviewItems(TArrayView<const FContentBrowserItemData> InItems)
|
|
|
|
|
{
|
|
|
|
|
bool bSuccess = false;
|
|
|
|
|
for (const FContentBrowserItemData& Item : InItems)
|
|
|
|
|
{
|
|
|
|
|
bSuccess |= PreviewItem(Item);
|
|
|
|
|
}
|
|
|
|
|
return bSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CanDuplicateItem(const FContentBrowserItemData& InItem, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::DuplicateItem(const FContentBrowserItemData& InItem, FContentBrowserItemDataTemporaryContext& OutPendingItem)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::BulkDuplicateItems(TArrayView<const FContentBrowserItemData> InItems, TArray<FContentBrowserItemData>& OutNewItems)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CanSaveItem(const FContentBrowserItemData& InItem, const EContentBrowserItemSaveFlags InSaveFlags, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::SaveItem(const FContentBrowserItemData& InItem, const EContentBrowserItemSaveFlags InSaveFlags)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::BulkSaveItems(TArrayView<const FContentBrowserItemData> InItems, const EContentBrowserItemSaveFlags InSaveFlags)
|
|
|
|
|
{
|
|
|
|
|
bool bSuccess = false;
|
|
|
|
|
for (const FContentBrowserItemData& Item : InItems)
|
|
|
|
|
{
|
|
|
|
|
bSuccess |= SaveItem(Item, InSaveFlags);
|
|
|
|
|
}
|
|
|
|
|
return bSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CanDeleteItem(const FContentBrowserItemData& InItem, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::DeleteItem(const FContentBrowserItemData& InItem)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::BulkDeleteItems(TArrayView<const FContentBrowserItemData> InItems)
|
|
|
|
|
{
|
|
|
|
|
bool bSuccess = false;
|
|
|
|
|
for (const FContentBrowserItemData& Item : InItems)
|
|
|
|
|
{
|
|
|
|
|
bSuccess |= DeleteItem(Item);
|
|
|
|
|
}
|
|
|
|
|
return bSuccess;
|
2022-08-23 12:52:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CanPrivatizeItem(const FContentBrowserItemData& InItem, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::PrivatizeItem(const FContentBrowserItemData& InItem)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::BulkPrivatizeItems(TArrayView<const FContentBrowserItemData> InItems)
|
|
|
|
|
{
|
|
|
|
|
bool bSuccess = false;
|
|
|
|
|
for (const FContentBrowserItemData& Item : InItems)
|
|
|
|
|
{
|
|
|
|
|
bSuccess |= PrivatizeItem(Item);
|
|
|
|
|
}
|
|
|
|
|
return bSuccess;
|
2020-06-23 18:40:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CanRenameItem(const FContentBrowserItemData& InItem, const FString* InNewName, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::RenameItem(const FContentBrowserItemData& InItem, const FString& InNewName, FContentBrowserItemData& OutNewItem)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CanCopyItem(const FContentBrowserItemData& InItem, const FName InDestPath, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CopyItem(const FContentBrowserItemData& InItem, const FName InDestPath)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::BulkCopyItems(TArrayView<const FContentBrowserItemData> InItems, const FName InDestPath)
|
|
|
|
|
{
|
|
|
|
|
bool bSuccess = false;
|
|
|
|
|
for (const FContentBrowserItemData& Item : InItems)
|
|
|
|
|
{
|
|
|
|
|
bSuccess |= CopyItem(Item, InDestPath);
|
|
|
|
|
}
|
|
|
|
|
return bSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::CanMoveItem(const FContentBrowserItemData& InItem, const FName InDestPath, FText* OutErrorMsg)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::MoveItem(const FContentBrowserItemData& InItem, const FName InDestPath)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::BulkMoveItems(TArrayView<const FContentBrowserItemData> InItems, const FName InDestPath)
|
|
|
|
|
{
|
|
|
|
|
bool bSuccess = false;
|
|
|
|
|
for (const FContentBrowserItemData& Item : InItems)
|
|
|
|
|
{
|
|
|
|
|
bSuccess |= MoveItem(Item, InDestPath);
|
|
|
|
|
}
|
|
|
|
|
return bSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::AppendItemReference(const FContentBrowserItemData& InItem, FString& InOutStr)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 08:31:50 -04:00
|
|
|
bool UContentBrowserDataSource::AppendItemObjectPath(const FContentBrowserItemData& InItem, FString& InOutStr)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::AppendItemPackageName(const FContentBrowserItemData& InItem, FString& InOutStr)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
bool UContentBrowserDataSource::UpdateThumbnail(const FContentBrowserItemData& InItem, FAssetThumbnail& InThumbnail)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedPtr<FDragDropOperation> UContentBrowserDataSource::CreateCustomDragOperation(TArrayView<const FContentBrowserItemData> InItems)
|
|
|
|
|
{
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::HandleDragEnterItem(const FContentBrowserItemData& InItem, const FDragDropEvent& InDragDropEvent)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::HandleDragOverItem(const FContentBrowserItemData& InItem, const FDragDropEvent& InDragDropEvent)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::HandleDragLeaveItem(const FContentBrowserItemData& InItem, const FDragDropEvent& InDragDropEvent)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::HandleDragDropOnItem(const FContentBrowserItemData& InItem, const FDragDropEvent& InDragDropEvent)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-16 20:57:34 -04:00
|
|
|
bool UContentBrowserDataSource::TryGetCollectionId(const FContentBrowserItemData& InItem, FSoftObjectPath& OutCollectionId)
|
2020-06-23 18:40:00 -04:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::Legacy_TryGetPackagePath(const FContentBrowserItemData& InItem, FName& OutPackagePath)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::Legacy_TryGetAssetData(const FContentBrowserItemData& InItem, FAssetData& OutAssetData)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::Legacy_TryConvertPackagePathToVirtualPath(const FName InPackagePath, FName& OutPath)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UContentBrowserDataSource::Legacy_TryConvertAssetDataToVirtualPath(const FAssetData& InAssetData, const bool InUseFolderPaths, FName& OutPath)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::QueueItemDataUpdate(FContentBrowserItemDataUpdate&& InUpdate)
|
|
|
|
|
{
|
|
|
|
|
if (DataSink)
|
|
|
|
|
{
|
|
|
|
|
DataSink->QueueItemDataUpdate(MoveTemp(InUpdate));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UContentBrowserDataSource::NotifyItemDataRefreshed()
|
|
|
|
|
{
|
|
|
|
|
if (DataSink)
|
|
|
|
|
{
|
2024-04-03 14:29:13 -04:00
|
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS
|
2020-06-23 18:40:00 -04:00
|
|
|
DataSink->NotifyItemDataRefreshed();
|
2024-04-03 14:29:13 -04:00
|
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
2020-06-23 18:40:00 -04:00
|
|
|
}
|
|
|
|
|
}
|
2021-02-03 14:57:28 -04:00
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
FContentBrowserItemData UContentBrowserDataSource::CreateVirtualFolderItem(const FName InFolderPath)
|
2021-02-03 14:57:28 -04:00
|
|
|
{
|
2021-04-29 19:32:06 -04:00
|
|
|
const FString FolderItemName = FPackageName::GetShortName(InFolderPath);
|
2021-02-03 14:57:28 -04:00
|
|
|
|
2024-06-27 14:17:10 -04:00
|
|
|
static const FName AllRootPath = "/All";
|
|
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
FText FolderDisplayNameOverride;
|
2024-06-27 14:17:10 -04:00
|
|
|
if (InFolderPath == AllRootPath)
|
|
|
|
|
{
|
|
|
|
|
FolderDisplayNameOverride = LOCTEXT("AllFolderDisplayName", "All");
|
|
|
|
|
}
|
|
|
|
|
else if (FolderItemName == TEXT("GameData"))
|
2021-02-03 14:57:28 -04:00
|
|
|
{
|
2021-04-29 19:32:06 -04:00
|
|
|
FolderDisplayNameOverride = LOCTEXT("GameDataFolderDisplayName", "Game Data");
|
|
|
|
|
}
|
|
|
|
|
else if (FolderItemName == TEXT("EngineData"))
|
|
|
|
|
{
|
|
|
|
|
FolderDisplayNameOverride = LOCTEXT("EngineDataFolderDisplayName", "Engine");
|
2021-02-03 14:57:28 -04:00
|
|
|
}
|
|
|
|
|
|
2024-02-22 14:13:17 -05:00
|
|
|
return FContentBrowserItemData(this,
|
|
|
|
|
EContentBrowserItemFlags::Type_Folder,
|
|
|
|
|
InFolderPath,
|
|
|
|
|
*FolderItemName,
|
|
|
|
|
MoveTemp(FolderDisplayNameOverride),
|
2024-04-29 17:32:33 -04:00
|
|
|
nullptr,
|
|
|
|
|
FName() // Virtual folders have no internal path
|
|
|
|
|
);
|
2021-02-03 14:57:28 -04:00
|
|
|
}
|
|
|
|
|
|
2021-04-29 19:32:06 -04:00
|
|
|
#undef LOCTEXT_NAMESPACE
|