You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Added in bulk set Public set Private when more than one asset is selected in the Content Browser - Additionally added in caching mechanism for selected file Public asset editability #preflight 621fca28e15c51d8c50a90bf #rb Rex.Hill #ROBOMERGE-AUTHOR: scott.nelson #ROBOMERGE-SOURCE: CL 19230234 via CL 19235956 via CL 19238861 via CL 19238938 via CL 19245822 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v924-19243027) [CL 19247030 by scott nelson in ue5-main branch]
180 lines
6.3 KiB
C++
180 lines
6.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Input/Reply.h"
|
|
#include "Widgets/SWidget.h"
|
|
#include "ContentBrowserItem.h"
|
|
#include "ContentBrowserDataMenuContexts.h"
|
|
#include "SourcesData.h"
|
|
|
|
class UToolMenu;
|
|
class FUICommandList;
|
|
class SAssetView;
|
|
class SWindow;
|
|
|
|
enum class ECheckBoxState : uint8;
|
|
enum class EContentBrowserViewContext : uint8;
|
|
|
|
class FAssetContextMenu : public TSharedFromThis<FAssetContextMenu>
|
|
{
|
|
public:
|
|
/** Constructor */
|
|
FAssetContextMenu(const TWeakPtr<SAssetView>& InAssetView);
|
|
|
|
/** Binds the commands used by the asset view context menu to the content browser command list */
|
|
void BindCommands(TSharedPtr< FUICommandList >& Commands);
|
|
|
|
/** Makes the context menu widget */
|
|
TSharedRef<SWidget> MakeContextMenu(TArrayView<const FContentBrowserItem> InSelectedItems, const FSourcesData& InSourcesData, TSharedPtr< FUICommandList > InCommandList);
|
|
|
|
/** Updates the list of currently selected items to those passed in */
|
|
void SetSelectedItems(TArrayView<const FContentBrowserItem> InSelectedItems);
|
|
|
|
using FOnShowInPathsViewRequested = UContentBrowserDataMenuContext_FileMenu::FOnShowInPathsView;
|
|
void SetOnShowInPathsViewRequested(const FOnShowInPathsViewRequested& InOnShowInPathsViewRequested);
|
|
|
|
/** Delegate for when the context menu requests a rename */
|
|
DECLARE_DELEGATE_TwoParams(FOnRenameRequested, const FContentBrowserItem& /*ItemToRename*/, EContentBrowserViewContext /*ViewContext*/);
|
|
void SetOnRenameRequested(const FOnRenameRequested& InOnRenameRequested);
|
|
|
|
/** Delegate for when the context menu requests an item duplication */
|
|
DECLARE_DELEGATE_OneParam(FOnDuplicateRequested, TArrayView<const FContentBrowserItem> /*OriginalItems*/);
|
|
void SetOnDuplicateRequested(const FOnDuplicateRequested& InOnDuplicateRequested);
|
|
|
|
/** Delegate for when the context menu requests to edit an item */
|
|
DECLARE_DELEGATE_OneParam(FOnEditRequested, TArrayView<const FContentBrowserItem> /*Items*/);
|
|
void SetOnEditRequested(const FOnEditRequested& InOnEditRequested);
|
|
|
|
/** Delegate for when the context menu requests an asset view refresh */
|
|
using FOnAssetViewRefreshRequested = UContentBrowserDataMenuContext_FileMenu::FOnRefreshView;
|
|
void SetOnAssetViewRefreshRequested(const FOnAssetViewRefreshRequested& InOnAssetViewRefreshRequested);
|
|
|
|
/** Handler to check to see if a rename command is allowed */
|
|
bool CanExecuteRename() const;
|
|
|
|
/** Handler for Rename */
|
|
void ExecuteRename(EContentBrowserViewContext ViewContext);
|
|
|
|
/** Handler to check to see if a delete command is allowed */
|
|
bool CanExecuteDelete() const;
|
|
|
|
/** Handler for Delete */
|
|
void ExecuteDelete();
|
|
|
|
/** Handler to check to see if "Save Asset" can be executed */
|
|
bool CanExecuteSaveAsset() const;
|
|
|
|
/** Handler for when "Save Asset" is selected */
|
|
void ExecuteSaveAsset();
|
|
|
|
private:
|
|
/** Handler to check to see if a duplicate command is allowed */
|
|
bool CanExecuteDuplicate() const;
|
|
|
|
/** Handler for Duplicate */
|
|
void ExecuteDuplicate();
|
|
|
|
/** Registers all unregistered menus in the hierarchy for a class */
|
|
static void RegisterMenuHierarchy(UClass* InClass);
|
|
|
|
/** Adds options to menu */
|
|
void AddMenuOptions(UToolMenu* InMenu);
|
|
|
|
/** Adds asset type-specific menu options to a menu builder. Returns true if any options were added. */
|
|
bool AddAssetTypeMenuOptions(UToolMenu* Menu);
|
|
|
|
/** Adds common menu options to a menu builder. Returns true if any options were added. */
|
|
bool AddCommonMenuOptions(UToolMenu* Menu);
|
|
|
|
/** Adds explore menu options to a menu builder. */
|
|
void AddExploreMenuOptions(UToolMenu* Menu);
|
|
|
|
/** Adds asset reference menu options to a menu builder. Returns true if any options were added. */
|
|
bool AddReferenceMenuOptions(UToolMenu* Menu);
|
|
|
|
/** Adds menu options related to working with collections */
|
|
bool AddCollectionMenuOptions(UToolMenu* Menu);
|
|
|
|
/** Handler for when sync to asset tree is selected */
|
|
void ExecuteSyncToAssetTree();
|
|
|
|
/** Handler for when find in explorer is selected */
|
|
void ExecuteFindInExplorer();
|
|
|
|
/** Handler to check to see if an edit command is allowed */
|
|
bool CanExecuteEditItems() const;
|
|
|
|
/** Handler for when "Edit" is selected */
|
|
void ExecuteEditItems();
|
|
|
|
/** Handler for confirmation of folder deletion */
|
|
FReply ExecuteDeleteFolderConfirmed();
|
|
|
|
/** Get tooltip for delete */
|
|
FText GetDeleteToolTip() const;
|
|
|
|
/** Handler for when "Public Asset" is toggled */
|
|
void ExecutePublicAssetToggle();
|
|
|
|
/** Handler to check to see if a Public Asset toggle is allowed */
|
|
bool CanExecutePublicAssetToggle();
|
|
|
|
/** Handler for setting all selected assets to Public */
|
|
void ExecuteBulkSetPublicAsset();
|
|
|
|
/** Handler for setting all selected assets to Private */
|
|
void ExecuteBulkUnsetPublicAsset();
|
|
|
|
/** Handler to check if all selected assets can have their Public state changed */
|
|
bool CanExecuteBulkSetPublicAsset();
|
|
|
|
/** Handler for getting the Public Asset check state */
|
|
ECheckBoxState GetPublicAssetCheckState();
|
|
|
|
/** Handler for CopyReference */
|
|
void ExecuteCopyReference();
|
|
|
|
/** Handler for CopyFilePath */
|
|
void ExecuteCopyFilePath();
|
|
|
|
/** Handler for when "Remove from collection" is selected */
|
|
void ExecuteRemoveFromCollection();
|
|
|
|
/** Handler to check to see if a sync to asset tree command is allowed */
|
|
bool CanExecuteSyncToAssetTree() const;
|
|
|
|
/** Handler to check to see if a find in explorer command is allowed */
|
|
bool CanExecuteFindInExplorer() const;
|
|
|
|
/** Handler to check to see if a "Remove from collection" command is allowed */
|
|
bool CanExecuteRemoveFromCollection() const;
|
|
|
|
/** Initializes some variable used to in "CanExecute" checks that won't change at runtime or are too expensive to check every frame. */
|
|
void CacheCanExecuteVars();
|
|
|
|
/** Registers the base context menu for assets */
|
|
void RegisterContextMenu(const FName MenuName);
|
|
|
|
TArray<FContentBrowserItem> SelectedItems;
|
|
TArray<FContentBrowserItem> SelectedFiles;
|
|
TArray<FContentBrowserItem> SelectedFolders;
|
|
|
|
FSourcesData SourcesData;
|
|
|
|
/** The asset view this context menu is a part of */
|
|
TWeakPtr<SAssetView> AssetView;
|
|
|
|
FOnShowInPathsViewRequested OnShowInPathsViewRequested;
|
|
FOnRenameRequested OnRenameRequested;
|
|
FOnDuplicateRequested OnDuplicateRequested;
|
|
FOnEditRequested OnEditRequested;
|
|
FOnAssetViewRefreshRequested OnAssetViewRefreshRequested;
|
|
|
|
/** Cached CanExecute vars */
|
|
bool bCanExecuteFindInExplorer = false;
|
|
bool bCanExecutePublicAssetToggle = false;
|
|
bool bCanExecuteBulkSetPublicAsset = false;
|
|
};
|