// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "AdvancedPreviewScene.h" // IWYU pragma: keep #include "Tools/BaseAssetToolkit.h" class FAdvancedPreviewScene; class FSpawnTabArgs; class FEditorViewportClient; class UAssetEditor; class SMARTOBJECTSEDITORMODULE_API FSmartObjectAssetToolkit : public FBaseAssetToolkit, public FGCObject { public: explicit FSmartObjectAssetToolkit(UAssetEditor* InOwningAssetEditor); virtual TSharedPtr CreateEditorViewportClient() const override; protected: virtual void PostInitAssetEditor() override; virtual void RegisterTabSpawners(const TSharedRef& TabManager) override; virtual void OnClose() override; virtual void AddReferencedObjects(FReferenceCollector& Collector) override; virtual FString GetReferencerName() const override { return TEXT("FSmartObjectAssetToolkit"); } private: /** Callback to detect changes in number of slot to keep gizmos in sync. */ void OnPropertyChanged(UObject* ObjectBeingModified, FPropertyChangedEvent& PropertyChangedEvent) const; /** Creates a tab allowing the user to select a mesh or actor template to spawn in the preview scene. */ TSharedRef SpawnTab_PreviewSettings(const FSpawnTabArgs& Args); TSharedRef SpawnTab_SceneViewport(const FSpawnTabArgs& Args); /** Additional Tab to select mesh/actor to add a 3D preview in the scene. */ static const FName PreviewSettingsTabID; static const FName SceneViewportTabID; /** Scene in which the 3D preview of the asset lives. */ TUniquePtr AdvancedPreviewScene; /** Typed pointer to the custom ViewportClient created by the toolkit. */ mutable TSharedPtr SmartObjectViewportClient; /** Object path of an actor picked from the current level Editor to spawn a preview in the scene. */ FString PreviewActorObjectPath; /** Object path of a mesh selected from the content to spawn a preview in the scene. */ FString PreviewMeshObjectPath; /** Class of the template actor to spawn a preview in the scene. */ TWeakObjectPtr PreviewActorClass; };