You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb trivial #rnx #jira none #preflight 619d57fd47752856c96fbe27 #ROBOMERGE-AUTHOR: lonnie.li #ROBOMERGE-SOURCE: CL 18275726 in //UE5/Release-5.0/... via CL 18275788 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469) [CL 18275806 by lonnie li in ue5-release-engine-test branch]
94 lines
3.2 KiB
C++
94 lines
3.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "InteractiveTool.h"
|
|
#include "ToolTargets/ToolTarget.h"
|
|
|
|
#include "InteractiveToolBuilder.generated.h"
|
|
|
|
|
|
|
|
/**
|
|
* A UInteractiveToolBuilder creates a new instance of an InteractiveTool (basically this is a Factory).
|
|
* These are registered with the InteractiveToolManager, which calls BuildTool() if CanBuildTool() returns true.
|
|
* In addition CanBuildTool() will be queried to (for example) enable/disable UI buttons, etc.
|
|
* This is an abstract base class, you must subclass it in order to create your particular Tool instance
|
|
*/
|
|
UCLASS(Transient, Abstract)
|
|
class INTERACTIVETOOLSFRAMEWORK_API UInteractiveToolBuilder : public UObject
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
/**
|
|
* Check if, given the current scene state, a new instance of this builder's Tool can be created
|
|
* @param SceneState the current scene selection state, etc
|
|
* @return true if a new Tool instance can be created
|
|
*/
|
|
virtual bool CanBuildTool(const FToolBuilderState& SceneState) const
|
|
{
|
|
check(false);
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Create a new instance of this builder's Tool
|
|
* @param SceneState the current scene selection state, etc
|
|
* @return a new instance of the Tool, or nullptr on error/failure
|
|
*/
|
|
virtual UInteractiveTool* BuildTool(const FToolBuilderState& SceneState) const
|
|
{
|
|
check(false);
|
|
return nullptr;
|
|
}
|
|
|
|
|
|
/**
|
|
* PostBuildTool is called by the ToolManager after a new Tool instance has been built.
|
|
* This allows clients to extend a ToolBuilder with additional customization/etc, instead of having to entirely replace the existing BuildTool()
|
|
* @param Tool the new Tool instance
|
|
* @param SceneState the scene state used to create the new Tool
|
|
*/
|
|
virtual void PostBuildTool(UInteractiveTool* Tool, const FToolBuilderState& SceneState) const
|
|
{
|
|
return;
|
|
}
|
|
|
|
/**
|
|
* PostBuildTool is called by the ToolManager after a new Tool instance has been built and Setup() has been called.
|
|
* This allows clients to make modifications to Tools like changing initial parameters without subclassing the Tool
|
|
* @param Tool the new Tool instance
|
|
* @param SceneState the scene state used to create the new Tool
|
|
*/
|
|
virtual void PostSetupTool(UInteractiveTool* Tool, const FToolBuilderState& SceneState) const
|
|
{
|
|
return;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* A UInteractiveToolWithToolTargetsBuilder creates a new instance of an InteractiveTool that uses tool targets.
|
|
* See ToolTarget.h for more information on tool targets and their usage. This class defines the common
|
|
* interface(s) for defining the tool target requirements of the tool it builds.
|
|
* This is an abstract base class, you must subclass it in order to create your particular Tool instance.
|
|
*/
|
|
UCLASS(Transient, Abstract)
|
|
class INTERACTIVETOOLSFRAMEWORK_API UInteractiveToolWithToolTargetsBuilder : public UInteractiveToolBuilder
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
protected:
|
|
/**
|
|
* Gives the target requirements of the associated tool. Usually, it is the tool builder
|
|
* will use this function in CanBuildTool and BuildTool to find and create any necessary targets.
|
|
*/
|
|
virtual const FToolTargetTypeRequirements& GetTargetRequirements() const
|
|
{
|
|
static FToolTargetTypeRequirements TypeRequirements; // Default initialized to no requirements.
|
|
return TypeRequirements;
|
|
}
|
|
};
|