// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Containers/Array.h" #include "Containers/Set.h" #include "CoreMinimal.h" #include "Delegates/Delegate.h" #include "Framework/Text/SlateHyperlinkRun.h" #include "IStructureDetailsView.h" #include "Internationalization/Text.h" #include "Layout/Visibility.h" #include "PropertyEditorDelegates.h" #include "SlateFwd.h" #include "Styling/SlateTypes.h" #include "Templates/SharedPointer.h" #include "UObject/NameTypes.h" #include "UObject/WeakFieldPtr.h" #include "UObject/WeakObjectPtr.h" #include "UObject/WeakObjectPtrTemplates.h" #include "Widgets/DeclarativeSyntaxSupport.h" #include "Widgets/SCompoundWidget.h" #include "Widgets/SWidget.h" #define UE_API KISMET_API class FBlueprintEditor; class FProperty; class FStructOnScope; class IDetailsView; class SBorder; class SDockTab; class SMyBlueprint; class SWidget; class SScrollBar; class UObject; struct FGeometry; struct FPropertyChangedEvent; typedef TSet FInspectorSelectionSet; ////////////////////////////////////////////////////////////////////////// // SKismetInspector /** Widget that shows properties and tools related to the selected node(s) */ class SKismetInspector : public SCompoundWidget, public FGCObject { public: SLATE_BEGIN_ARGS( SKismetInspector ) : _ShowPublicViewControl(false) , _HideNameArea(true) , _SetNotifyHook(true) , _ShowTitleArea(false) , _ShowLocalVariables(false) , _ScrollbarAlignment(HAlign_Right) , _ShowSectionSelector(false) {} SLATE_ARGUMENT(TWeakPtr, Kismet2) SLATE_ARGUMENT(TWeakPtr, MyBlueprintWidget) SLATE_ATTRIBUTE( bool, ShowPublicViewControl ) SLATE_ARGUMENT( bool, HideNameArea ) SLATE_ARGUMENT( FIsPropertyEditingEnabled, IsPropertyEditingEnabledDelegate ) SLATE_ARGUMENT( FOnFinishedChangingProperties::FDelegate, OnFinishedChangingProperties ) SLATE_ARGUMENT( FName, ViewIdentifier) SLATE_ARGUMENT( bool, SetNotifyHook) SLATE_ARGUMENT( bool, ShowTitleArea) SLATE_ARGUMENT( bool, ShowLocalVariables) SLATE_ARGUMENT( TSharedPtr, ExternalScrollbar) SLATE_ARGUMENT( EHorizontalAlignment, ScrollbarAlignment) SLATE_ARGUMENT( bool, ShowSectionSelector) SLATE_END_ARGS() UE_API void Construct(const FArguments& InArgs); /** Options for ShowDetails */ struct FShowDetailsOptions { FText ForcedTitle; bool bForceRefresh; bool bShowComponents; bool bHideFilterArea; FShowDetailsOptions() :ForcedTitle() ,bForceRefresh(false) ,bShowComponents(true) ,bHideFilterArea(false) {} FShowDetailsOptions(const FText& InForcedTitle, bool bInForceRefresh = false) :ForcedTitle(InForcedTitle) ,bForceRefresh(bInForceRefresh) ,bShowComponents(true) ,bHideFilterArea(false) {} }; // SWidget interface UE_API virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override; // End of SWidget interface /** Update the inspector window to show information on the supplied object */ UE_API void ShowDetailsForSingleObject(UObject* Object, const FShowDetailsOptions& Options = FShowDetailsOptions()); /** Update the inspector window to show information on the supplied objects */ UE_API void ShowDetailsForObjects(const TArray& PropertyObjects, const FShowDetailsOptions& Options = FShowDetailsOptions()); /** Update the inspector window to show single struct. This invalidates ShowDetailsForObjects */ UE_API void ShowSingleStruct(TSharedPtr InStructToDisplay); /** Used to control visibility of a property in the property window */ UE_API bool IsPropertyVisible( const struct FPropertyAndParent& PropertyAndParent ) const; /** Turns on or off details customization for components */ UE_API void EnableComponentDetailsCustomization(bool bEnable); TSharedPtr GetPropertyView() const { return PropertyView; } UE_API void SetOwnerTab(TSharedRef Tab); UE_API TSharedPtr GetOwnerTab() const; /** @return true if the object is in the selection set. */ UE_API bool IsSelected(UObject* Object) const; /** returns the list of selected objects */ UE_API const TArray< TWeakObjectPtr >& GetSelectedObjects() const; UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override; UE_API virtual FString GetReferencerName() const override; protected: /** Update the inspector window to show information on the supplied objects */ UE_API void UpdateFromObjects(const TArray& PropertyObjects, struct FKismetSelectionInfo& SelectionInfo, const FShowDetailsOptions& Options); /** Add this property and all its child properties to SelectedObjectProperties */ UE_API void AddPropertiesRecursive(FProperty* Property); /** Pointer back to the kismet 2 tool that owns us */ TWeakPtr BlueprintEditorPtr; /** The tab that owns this details view. */ TWeakPtr OwnerTab; /** String used as the title above the property window */ FText PropertyViewTitle; /** Should we currently show the property view */ bool bShowInspectorPropertyView; /** Should we currently show components */ bool bShowComponents; /** State of CheckBox representing whether to show only the public variables*/ ECheckBoxState PublicViewState; /** Property viewing widget */ TSharedPtr PropertyView; /** Selected objects for this detail view */ TArray< TWeakObjectPtr > SelectedObjects; /** The widget used to edit the names of properties */ TSharedPtr EditNameWidget; /** Border widget that wraps a dynamic context-sensitive widget for editing objects that the property window is displaying */ TSharedPtr ContextualEditingBorderWidget; /** If true show the public view control */ TAttribute bShowPublicView; /** If true show the kismet inspector title widget */ bool bShowTitleArea; /** Component details customization enabled. */ bool bComponenetDetailsCustomizationEnabled; /** Set of object properties that should be visible */ TSet< TWeakFieldPtr > SelectedObjectProperties; /** User defined delegate for IsPropertyEditingEnabled: */ FIsPropertyEditingEnabled IsPropertyEditingEnabledDelegate; /** User defined delegate for OnFinishedChangingProperties */ FOnFinishedChangingProperties::FDelegate UserOnFinishedChangingProperties; /** When TRUE, the Kismet inspector needs to refresh the details view on Tick */ bool bRefreshOnTick; /** Holds the property objects that need to be displayed by the inspector starting on the next tick */ TArray> RefreshPropertyObjects; /** Details options that are used by the inspector on the next refresh. */ FShowDetailsOptions RefreshOptions; /** Struct to preview */ TSharedPtr StructToDisplay; /* Sturct Detail View */ TSharedPtr StructureDetailsView; /** Update the inspector window to show information on the single struct */ UE_API void UpdateFromSingleStruct(const TSharedPtr& InStructToDisplay); /** Is struct view property read only */ UE_API bool IsStructViewPropertyReadOnly(const struct FPropertyAndParent& PropertyAndParent) const; protected: /** Show properties of the selected object */ UE_API void SetPropertyWindowContents(TArray Objects); /** Returns whether the property view be visible */ UE_API EVisibility GetPropertyViewVisibility() const; /** Returns whether the properties in the view should be editable */ UE_API bool IsPropertyEditingEnabled() const; /** Returns whether the warning about an inherited component not being editable should be visible */ UE_API EVisibility GetInheritedBlueprintComponentWarningVisibility() const; /** Opens the parent blueprint when the hyperlink in the warning is clicked */ UE_API void OnInheritedBlueprintComponentWarningHyperlinkClicked(const FSlateHyperlinkRun::FMetadata& Metadata); /** * Generates a widget that is used to edit the specified object array contextually. This widget * will be displayed along with a property view in the level editor */ UE_API TSharedRef MakeContextualEditingWidget(struct FKismetSelectionInfo& SelectionInfo, const FShowDetailsOptions& Options); /** * Generates the text for the title in the contextual editing widget */ UE_API FText GetContextualEditingWidgetTitle() const; UE_API ECheckBoxState GetPublicViewCheckboxState() const; UE_API void SetPublicViewCheckboxState(ECheckBoxState InIsChecked); UE_API bool IsAnyParentOrContainerSelected(const FPropertyAndParent& PropertyAndParent) const; /** Callback invoked after a value change on the selected object(s) */ UE_API void OnFinishedChangingProperties(const FPropertyChangedEvent& InPropertyChangedEvent); /** Auto-import any namespaces associated with a property's value into the current editor context */ UE_API void ImportNamespacesForPropertyValue(const FProperty* InProperty) const; }; #undef UE_API