2021-11-23 09:42:40 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "MultiSelectionTool.h"
|
2021-11-23 16:50:40 -05:00
|
|
|
#include "InteractiveToolBuilder.h"
|
2021-11-23 09:42:40 -05:00
|
|
|
#include "MultiSelectionMeshEditingTool.generated.h"
|
|
|
|
|
|
|
|
|
|
class UMultiSelectionMeshEditingTool;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* UMultiSelectionMeshEditingToolBuilder is a base tool builder for multi
|
|
|
|
|
* selection tools that define a common set of ToolTarget interfaces required
|
|
|
|
|
* for editing meshes.
|
|
|
|
|
*/
|
|
|
|
|
UCLASS(Transient, Abstract)
|
2021-11-23 11:49:25 -05:00
|
|
|
class MODELINGCOMPONENTS_API UMultiSelectionMeshEditingToolBuilder : public UInteractiveToolWithToolTargetsBuilder
|
2021-11-23 09:42:40 -05:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/** @return true if mesh sources can be found in the active selection */
|
|
|
|
|
virtual bool CanBuildTool(const FToolBuilderState& SceneState) const override;
|
|
|
|
|
|
|
|
|
|
/** @return new Tool instance initialized with selected mesh source(s) */
|
|
|
|
|
virtual UInteractiveTool* BuildTool(const FToolBuilderState& SceneState) const override;
|
|
|
|
|
|
|
|
|
|
/** @return new Tool instance. Override this in subclasses to build a different Tool class type */
|
2021-11-23 19:17:30 -05:00
|
|
|
virtual UMultiSelectionMeshEditingTool* CreateNewTool(const FToolBuilderState& SceneState) const PURE_VIRTUAL(UMultiSelectionMeshEditingToolBuilder::CreateNewTool, return nullptr; );
|
2021-11-23 09:42:40 -05:00
|
|
|
|
|
|
|
|
/** Called by BuildTool to configure the Tool with the input mesh source(s) based on the SceneState */
|
|
|
|
|
virtual void InitializeNewTool(UMultiSelectionMeshEditingTool* Tool, const FToolBuilderState& SceneState) const;
|
|
|
|
|
|
|
|
|
|
protected:
|
2021-11-23 11:49:25 -05:00
|
|
|
virtual const FToolTargetTypeRequirements& GetTargetRequirements() const override;
|
2021-11-23 09:42:40 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Multi Selection Mesh Editing tool base class.
|
|
|
|
|
*/
|
|
|
|
|
UCLASS()
|
|
|
|
|
class MODELINGCOMPONENTS_API UMultiSelectionMeshEditingTool : public UMultiSelectionTool
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
public:
|
2022-01-28 18:40:54 -05:00
|
|
|
virtual void Shutdown(EToolShutdownType ShutdownType) override;
|
|
|
|
|
virtual void OnShutdown(EToolShutdownType ShutdownType);
|
|
|
|
|
|
2022-01-28 12:44:22 -05:00
|
|
|
virtual void SetWorld(UWorld* World);
|
|
|
|
|
virtual UWorld* GetTargetWorld();
|
2021-11-23 09:42:40 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Helper to find which targets share source data.
|
|
|
|
|
* Requires UAssetBackedTarget as a tool target requirement.
|
|
|
|
|
*
|
|
|
|
|
* @return Array of indices, 1:1 with Targets, indicating the first index where a component target sharing the same source data appeared.
|
|
|
|
|
*/
|
|
|
|
|
bool GetMapToSharedSourceData(TArray<int32>& MapToFirstOccurrences);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
UPROPERTY()
|
2022-01-28 10:18:10 -05:00
|
|
|
TWeakObjectPtr<UWorld> TargetWorld = nullptr;
|
2021-11-23 09:42:40 -05:00
|
|
|
};
|