Files
UnrealEngineUWP/Engine/Source/Editor/SubobjectEditor/Public/SSubobjectInstanceEditor.h
ben hoffman 4a312aa02e Add Apply modifications to blueprints to the context menu in the subobject instance editor.
Make SSubobjectEditor::CreateMenuBuilder non-const to allow for the binding of functions that can modify the actor instance like reseting to blueprint defaults

#jira UE-117764
#rb trivial
#rnx

#ROBOMERGE-SOURCE: CL 16662762 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v834-16658389)

[CL 16662779 by ben hoffman in ue5-release-engine-test branch]
2021-06-14 15:31:51 -04:00

70 lines
2.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "SSubobjectEditor.h"
/**
* This is the editor for subobjects within the level editor that
* works mainly with component and actor instances.
*/
class SUBOBJECTEDITOR_API SSubobjectInstanceEditor final : public SSubobjectEditor
{
private:
SLATE_BEGIN_ARGS(SSubobjectInstanceEditor)
: _ObjectContext(nullptr)
, _AllowEditing(true)
, _OnSelectionUpdated()
{}
SLATE_ATTRIBUTE(UObject*, ObjectContext)
SLATE_ATTRIBUTE(bool, AllowEditing)
SLATE_EVENT(FOnSelectionUpdated, OnSelectionUpdated)
SLATE_EVENT(FOnItemDoubleClicked, OnItemDoubleClicked)
SLATE_EVENT(FSimpleDelegate, OnObjectReplaced)
SLATE_END_ARGS()
void Construct(const FArguments& InArgs);
protected:
// SSubobjectEditor interface
virtual void OnDeleteNodes() override;
virtual void CopySelectedNodes() override;
virtual void OnDuplicateComponent() override;
virtual void PasteNodes() override;
virtual void OnAttachToDropAction(FSubobjectEditorTreeNodePtrType DroppedOn, const TArray<FSubobjectEditorTreeNodePtrType>& DroppedNodePtrs) override;
virtual void OnDetachFromDropAction(const TArray<FSubobjectEditorTreeNodePtrType>& DroppedNodePtrs) override;
virtual void OnMakeNewRootDropAction(FSubobjectEditorTreeNodePtrType DroppedNodePtr) override;
virtual void PostDragDropAction(bool bRegenerateTreeNodes) override;
/** Builds a context menu popup for dropping a child node onto the scene root node */
virtual TSharedPtr<SWidget> BuildSceneRootDropActionMenu(FSubobjectEditorTreeNodePtrType DroppedOntoNodePtr, FSubobjectEditorTreeNodePtrType DroppedNodePtr) override;
virtual FSubobjectDataHandle AddNewSubobject(const FSubobjectDataHandle& ParentHandle, UClass* NewClass, UObject* AssetOverride, FText& OutFailReason, TUniquePtr<FScopedTransaction> InOngoingTransaction) override;
virtual void PopulateContextMenuImpl(UToolMenu* InMenu, TArray<FSubobjectEditorTreeNodePtrType>& InSelectedItems, bool bIsChildActorSubtreeNodeSelected) override;
virtual FMenuBuilder CreateMenuBuilder();
public:
virtual FSlateColor GetColorTintForIcon(FSubobjectEditorTreeNodePtrType Node) const override;
// End of SSubobjectEditor
/** Delegate to invoke when objects within the Subobject tree are replaced (eg, via re-instancing from a BP compile) */
FSimpleDelegate OnObjectReplaced;
private:
/** @return the tooltip describing how many properties will be applied to the blueprint */
FText OnGetApplyChangesToBlueprintTooltip() const;
/** Propagates instance changes to the blueprint */
void OnApplyChangesToBlueprint() const;
/** Resets instance changes to the blueprint default */
void OnResetToBlueprintDefaults();
/** @return the tooltip describing how many properties will be reset to the blueprint default*/
FText OnGetResetToBlueprintDefaultsTooltip() const;
};