Files
UnrealEngineUWP/Engine/Source/Editor/SubobjectEditor/Public/SSubobjectInstanceEditor.h
ben hoffman 285a1503df Create the subobject Editor module that utilizes the new Subobject Data Interface instead of modifying subobjects directly in slate code.
#jira UE-114839
#rb phillip.kavan
#rnx
#preflight 609152aa90631e000199463e
#preflight 60919af859592e0001f41c7d

[CL 16198818 by ben hoffman in ue5-main branch]
2021-05-04 16:26:56 -04:00

55 lines
2.3 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;
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;
};