2019-12-26 14:45:42 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2019-04-23 10:26:37 -04:00
# include "InteractiveGizmoManager.h"
2019-09-10 12:01:07 -04:00
# include "InteractiveToolsContext.h"
2019-04-23 10:26:37 -04:00
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
# include "BaseGizmos/AxisPositionGizmo.h"
2021-06-09 16:28:33 -04:00
# include "BaseGizmos/GizmoViewContext.h"
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
# include "BaseGizmos/PlanePositionGizmo.h"
# include "BaseGizmos/AxisAngleGizmo.h"
2021-09-30 08:26:22 -04:00
# include "BaseGizmos/CombinedTransformGizmo.h"
2021-01-14 19:07:52 -04:00
# include "BaseGizmos/RepositionableTransformGizmo.h"
2020-08-25 15:29:15 -04:00
# include "BaseGizmos/ScalableSphereGizmo.h"
2021-06-09 16:28:33 -04:00
# include "ContextObjectStore.h"
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
2019-09-14 00:17:10 -04:00
# define LOCTEXT_NAMESPACE "UInteractiveGizmoManager"
2019-04-23 10:26:37 -04:00
UInteractiveGizmoManager : : UInteractiveGizmoManager ( )
{
QueriesAPI = nullptr ;
TransactionsAPI = nullptr ;
InputRouter = nullptr ;
}
void UInteractiveGizmoManager : : Initialize ( IToolsContextQueriesAPI * QueriesAPIIn , IToolsContextTransactionsAPI * TransactionsAPIIn , UInputRouter * InputRouterIn )
{
this - > QueriesAPI = QueriesAPIIn ;
this - > TransactionsAPI = TransactionsAPIIn ;
this - > InputRouter = InputRouterIn ;
}
void UInteractiveGizmoManager : : Shutdown ( )
{
this - > QueriesAPI = nullptr ;
TArray < FActiveGizmo > AllGizmos = ActiveGizmos ;
for ( FActiveGizmo & ActiveGizmo : AllGizmos )
{
DestroyGizmo ( ActiveGizmo . Gizmo ) ;
}
ActiveGizmos . Reset ( ) ;
this - > TransactionsAPI = nullptr ;
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
if ( bDefaultGizmosRegistered )
{
DeregisterGizmoType ( DefaultAxisPositionBuilderIdentifier ) ;
DeregisterGizmoType ( DefaultPlanePositionBuilderIdentifier ) ;
DeregisterGizmoType ( DefaultAxisAngleBuilderIdentifier ) ;
DeregisterGizmoType ( DefaultThreeAxisTransformBuilderIdentifier ) ;
2020-08-25 15:29:15 -04:00
DeregisterGizmoType ( DefaultScalableSphereBuilderIdentifier ) ;
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
}
2019-04-23 10:26:37 -04:00
}
void UInteractiveGizmoManager : : RegisterGizmoType ( const FString & Identifier , UInteractiveGizmoBuilder * Builder )
{
2021-05-28 02:04:32 -04:00
if ( ensure ( GizmoBuilders . Contains ( Identifier ) = = false ) )
{
GizmoBuilders . Add ( Identifier , Builder ) ;
}
2019-04-23 10:26:37 -04:00
}
bool UInteractiveGizmoManager : : DeregisterGizmoType ( const FString & BuilderIdentifier )
{
if ( GizmoBuilders . Contains ( BuilderIdentifier ) = = false )
{
2019-09-16 14:06:18 -04:00
DisplayMessage (
2019-09-14 00:17:10 -04:00
FText : : Format ( LOCTEXT ( " DeregisterFailedMessage " , " UInteractiveGizmoManager::DeregisterGizmoType: could not find requested type {0} " ) , FText : : FromString ( BuilderIdentifier ) ) ,
EToolMessageLevel : : Internal ) ;
2019-04-23 10:26:37 -04:00
return false ;
}
GizmoBuilders . Remove ( BuilderIdentifier ) ;
return true ;
}
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
UInteractiveGizmo * UInteractiveGizmoManager : : CreateGizmo ( const FString & BuilderIdentifier , const FString & InstanceIdentifier , void * Owner )
2019-04-23 10:26:37 -04:00
{
if ( GizmoBuilders . Contains ( BuilderIdentifier ) = = false )
{
2019-09-16 14:06:18 -04:00
DisplayMessage (
2019-09-14 00:17:10 -04:00
FText : : Format ( LOCTEXT ( " CreateGizmoCannotFindFailedMessage " , " UInteractiveGizmoManager::CreateGizmo: could not find requested type {0} " ) , FText : : FromString ( BuilderIdentifier ) ) ,
EToolMessageLevel : : Internal ) ;
2019-04-23 10:26:37 -04:00
return nullptr ;
}
UInteractiveGizmoBuilder * FoundBuilder = GizmoBuilders [ BuilderIdentifier ] ;
// check if we have used this instance identifier
2019-09-10 21:58:36 -04:00
if ( InstanceIdentifier . IsEmpty ( ) = = false )
2019-04-23 10:26:37 -04:00
{
2019-09-10 21:58:36 -04:00
for ( FActiveGizmo & ActiveGizmo : ActiveGizmos )
2019-04-23 10:26:37 -04:00
{
2019-09-10 21:58:36 -04:00
if ( ActiveGizmo . InstanceIdentifier = = InstanceIdentifier )
{
2019-09-16 14:06:18 -04:00
DisplayMessage (
2019-09-14 00:17:10 -04:00
FText : : Format ( LOCTEXT ( " CreateGizmoExistsMessage " , " UInteractiveGizmoManager::CreateGizmo: instance identifier {0} already in use! " ) , FText : : FromString ( InstanceIdentifier ) ) ,
EToolMessageLevel : : Internal ) ;
2019-09-10 21:58:36 -04:00
return nullptr ;
}
2019-04-23 10:26:37 -04:00
}
}
FToolBuilderState CurrentSceneState ;
QueriesAPI - > GetCurrentSelectionState ( CurrentSceneState ) ;
UInteractiveGizmo * NewGizmo = FoundBuilder - > BuildGizmo ( CurrentSceneState ) ;
if ( NewGizmo = = nullptr )
{
2019-09-16 14:06:18 -04:00
DisplayMessage ( LOCTEXT ( " CreateGizmoReturnNullMessage " , " UInteractiveGizmoManager::CreateGizmo: BuildGizmo() returned null " ) , EToolMessageLevel : : Internal ) ;
2019-04-23 14:26:09 -04:00
return nullptr ;
2019-04-23 10:26:37 -04:00
}
NewGizmo - > Setup ( ) ;
// register new active input behaviors
InputRouter - > RegisterSource ( NewGizmo ) ;
PostInvalidation ( ) ;
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
FActiveGizmo ActiveGizmo = { NewGizmo , BuilderIdentifier , InstanceIdentifier , Owner } ;
2019-04-23 10:26:37 -04:00
ActiveGizmos . Add ( ActiveGizmo ) ;
return NewGizmo ;
}
bool UInteractiveGizmoManager : : DestroyGizmo ( UInteractiveGizmo * Gizmo )
{
2020-08-25 15:29:15 -04:00
auto Pred = [ Gizmo ] ( const FActiveGizmo & ActiveGizmo ) { return ActiveGizmo . Gizmo = = Gizmo ; } ;
2021-05-28 02:04:32 -04:00
if ( ! ensure ( ActiveGizmos . FindByPredicate ( Pred ) ) )
{
return false ;
}
2019-04-23 10:26:37 -04:00
InputRouter - > ForceTerminateSource ( Gizmo ) ;
Gizmo - > Shutdown ( ) ;
InputRouter - > DeregisterSource ( Gizmo ) ;
2020-08-25 15:29:15 -04:00
ActiveGizmos . RemoveAll ( Pred ) ;
2019-04-23 10:26:37 -04:00
PostInvalidation ( ) ;
return true ;
}
TArray < UInteractiveGizmo * > UInteractiveGizmoManager : : FindAllGizmosOfType ( const FString & BuilderIdentifier )
{
TArray < UInteractiveGizmo * > Found ;
for ( int i = 0 ; i < ActiveGizmos . Num ( ) ; + + i )
{
if ( ActiveGizmos [ i ] . BuilderIdentifier = = BuilderIdentifier )
{
Found . Add ( ActiveGizmos [ i ] . Gizmo ) ;
}
}
return Found ;
}
void UInteractiveGizmoManager : : DestroyAllGizmosOfType ( const FString & BuilderIdentifier )
{
TArray < UInteractiveGizmo * > ToRemove = FindAllGizmosOfType ( BuilderIdentifier ) ;
for ( int i = 0 ; i < ToRemove . Num ( ) ; + + i )
{
DestroyGizmo ( ToRemove [ i ] ) ;
}
}
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
void UInteractiveGizmoManager : : DestroyAllGizmosByOwner ( void * Owner )
{
TArray < UInteractiveGizmo * > Found ;
for ( const FActiveGizmo & ActiveGizmo : ActiveGizmos )
{
if ( ActiveGizmo . Owner = = Owner )
{
Found . Add ( ActiveGizmo . Gizmo ) ;
}
}
for ( UInteractiveGizmo * Gizmo : Found )
{
DestroyGizmo ( Gizmo ) ;
}
}
2019-04-23 10:26:37 -04:00
UInteractiveGizmo * UInteractiveGizmoManager : : FindGizmoByInstanceIdentifier ( const FString & Identifier )
{
for ( int i = 0 ; i < ActiveGizmos . Num ( ) ; + + i )
{
if ( ActiveGizmos [ i ] . InstanceIdentifier = = Identifier )
{
return ActiveGizmos [ i ] . Gizmo ;
}
}
return nullptr ;
}
void UInteractiveGizmoManager : : Tick ( float DeltaTime )
{
for ( FActiveGizmo & ActiveGizmo : ActiveGizmos )
{
ActiveGizmo . Gizmo - > Tick ( DeltaTime ) ;
}
}
void UInteractiveGizmoManager : : Render ( IToolsContextRenderAPI * RenderAPI )
{
for ( FActiveGizmo & ActiveGizmo : ActiveGizmos )
{
ActiveGizmo . Gizmo - > Render ( RenderAPI ) ;
}
}
2020-10-09 22:42:26 -04:00
void UInteractiveGizmoManager : : DrawHUD ( FCanvas * Canvas , IToolsContextRenderAPI * RenderAPI )
{
for ( FActiveGizmo & ActiveGizmo : ActiveGizmos )
{
ActiveGizmo . Gizmo - > DrawHUD ( Canvas , RenderAPI ) ;
}
}
2019-09-16 14:06:18 -04:00
void UInteractiveGizmoManager : : DisplayMessage ( const FText & Message , EToolMessageLevel Level )
2019-04-23 10:26:37 -04:00
{
2019-09-16 14:06:18 -04:00
TransactionsAPI - > DisplayMessage ( Message , Level ) ;
2019-04-23 10:26:37 -04:00
}
void UInteractiveGizmoManager : : PostInvalidation ( )
{
TransactionsAPI - > PostInvalidation ( ) ;
}
void UInteractiveGizmoManager : : BeginUndoTransaction ( const FText & Description )
{
TransactionsAPI - > BeginUndoTransaction ( Description ) ;
}
void UInteractiveGizmoManager : : EndUndoTransaction ( )
{
TransactionsAPI - > EndUndoTransaction ( ) ;
}
2019-09-23 21:52:12 -04:00
void UInteractiveGizmoManager : : EmitObjectChange ( UObject * TargetObject , TUniquePtr < FToolCommandChange > Change , const FText & Description )
2019-04-23 10:26:37 -04:00
{
TransactionsAPI - > AppendChange ( TargetObject , MoveTemp ( Change ) , Description ) ;
}
2021-05-20 16:39:39 -04:00
UContextObjectStore * UInteractiveGizmoManager : : GetContextObjectStore ( ) const
{
return Cast < UInteractiveToolsContext > ( GetOuter ( ) ) - > ContextObjectStore ;
}
2019-04-23 10:26:37 -04:00
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
FString UInteractiveGizmoManager : : DefaultAxisPositionBuilderIdentifier = TEXT ( " StandardXFormAxisTranslationGizmo " ) ;
FString UInteractiveGizmoManager : : DefaultPlanePositionBuilderIdentifier = TEXT ( " StandardXFormPlaneTranslationGizmo " ) ;
FString UInteractiveGizmoManager : : DefaultAxisAngleBuilderIdentifier = TEXT ( " StandardXFormAxisRotationGizmo " ) ;
FString UInteractiveGizmoManager : : DefaultThreeAxisTransformBuilderIdentifier = TEXT ( " DefaultThreeAxisTransformBuilderIdentifier " ) ;
2019-09-14 00:59:31 -04:00
const FString UInteractiveGizmoManager : : CustomThreeAxisTransformBuilderIdentifier = TEXT ( " CustomThreeAxisTransformBuilderIdentifier " ) ;
2021-01-14 19:07:52 -04:00
const FString UInteractiveGizmoManager : : CustomRepositionableThreeAxisTransformBuilderIdentifier = TEXT ( " CustomRepositionableThreeAxisTransformBuilderIdentifier " ) ;
2020-08-25 15:29:15 -04:00
FString UInteractiveGizmoManager : : DefaultScalableSphereBuilderIdentifier = TEXT ( " DefaultScalableSphereBuilderIdentifier " ) ;
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
void UInteractiveGizmoManager : : RegisterDefaultGizmos ( )
{
check ( bDefaultGizmosRegistered = = false ) ;
UAxisPositionGizmoBuilder * AxisTranslationBuilder = NewObject < UAxisPositionGizmoBuilder > ( ) ;
RegisterGizmoType ( DefaultAxisPositionBuilderIdentifier , AxisTranslationBuilder ) ;
UPlanePositionGizmoBuilder * PlaneTranslationBuilder = NewObject < UPlanePositionGizmoBuilder > ( ) ;
RegisterGizmoType ( DefaultPlanePositionBuilderIdentifier , PlaneTranslationBuilder ) ;
UAxisAngleGizmoBuilder * AxisRotationBuilder = NewObject < UAxisAngleGizmoBuilder > ( ) ;
RegisterGizmoType ( DefaultAxisAngleBuilderIdentifier , AxisRotationBuilder ) ;
2021-09-29 23:19:52 -04:00
UCombinedTransformGizmoBuilder * TransformBuilder = NewObject < UCombinedTransformGizmoBuilder > ( ) ;
2021-05-20 16:39:39 -04:00
TransformBuilder - > AxisPositionBuilderIdentifier = DefaultAxisPositionBuilderIdentifier ;
TransformBuilder - > PlanePositionBuilderIdentifier = DefaultPlanePositionBuilderIdentifier ;
TransformBuilder - > AxisAngleBuilderIdentifier = DefaultAxisAngleBuilderIdentifier ;
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
RegisterGizmoType ( DefaultThreeAxisTransformBuilderIdentifier , TransformBuilder ) ;
2021-06-09 16:28:33 -04:00
UGizmoViewContext * GizmoViewContext = GetContextObjectStore ( ) - > FindContext < UGizmoViewContext > ( ) ;
if ( ! GizmoViewContext )
{
GizmoViewContext = NewObject < UGizmoViewContext > ( ) ;
GetContextObjectStore ( ) - > AddContextObject ( GizmoViewContext ) ;
}
2021-09-29 23:19:52 -04:00
GizmoActorBuilder = MakeShared < FCombinedTransformGizmoActorFactory > ( GizmoViewContext ) ;
2021-01-14 19:07:52 -04:00
2021-09-29 23:19:52 -04:00
UCombinedTransformGizmoBuilder * CustomThreeAxisBuilder = NewObject < UCombinedTransformGizmoBuilder > ( ) ;
2021-05-20 16:39:39 -04:00
CustomThreeAxisBuilder - > AxisPositionBuilderIdentifier = DefaultAxisPositionBuilderIdentifier ;
CustomThreeAxisBuilder - > PlanePositionBuilderIdentifier = DefaultPlanePositionBuilderIdentifier ;
CustomThreeAxisBuilder - > AxisAngleBuilderIdentifier = DefaultAxisAngleBuilderIdentifier ;
2021-01-14 19:07:52 -04:00
CustomThreeAxisBuilder - > GizmoActorBuilder = GizmoActorBuilder ;
2019-09-14 00:59:31 -04:00
RegisterGizmoType ( CustomThreeAxisTransformBuilderIdentifier , CustomThreeAxisBuilder ) ;
2021-01-14 19:07:52 -04:00
URepositionableTransformGizmoBuilder * CustomRepositionableThreeAxisBuilder = NewObject < URepositionableTransformGizmoBuilder > ( ) ;
2021-05-20 16:39:39 -04:00
CustomRepositionableThreeAxisBuilder - > AxisPositionBuilderIdentifier = DefaultAxisPositionBuilderIdentifier ;
CustomRepositionableThreeAxisBuilder - > PlanePositionBuilderIdentifier = DefaultPlanePositionBuilderIdentifier ;
CustomRepositionableThreeAxisBuilder - > AxisAngleBuilderIdentifier = DefaultAxisAngleBuilderIdentifier ;
2021-01-14 19:07:52 -04:00
CustomRepositionableThreeAxisBuilder - > GizmoActorBuilder = GizmoActorBuilder ;
RegisterGizmoType ( CustomRepositionableThreeAxisTransformBuilderIdentifier , CustomRepositionableThreeAxisBuilder ) ;
2020-08-25 15:29:15 -04:00
UScalableSphereGizmoBuilder * ScalableSphereBuilder = NewObject < UScalableSphereGizmoBuilder > ( ) ;
RegisterGizmoType ( DefaultScalableSphereBuilderIdentifier , ScalableSphereBuilder ) ;
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
bDefaultGizmosRegistered = true ;
}
2021-09-29 23:19:52 -04:00
UCombinedTransformGizmo * UInteractiveGizmoManager : : Create3AxisTransformGizmo ( void * Owner , const FString & InstanceIdentifier )
ToolsFramework: Standard implementations of Gizmos for axis position/angle and plane position. Used to implement a standard 3-axis translate/rotate transformer.
InteractiveGizmoManager now tracks Owner of Gizmos, for delete-by-owner support. Added Create3AxisTransformGizmo() to create standard Gizmo.
GizmoInterfaces.h: UInterfaces for gizmo components
AxisPositionGizmo, AxisAngleGizmo, PlanePositionGizmo: standard implementations of UInteractiveGizmo
GizmoBaseComponent, GizmoArrowComponent, GizmoRectangleComponent, GizmoCircleComponent: custom UPrimitiveComponent implementations for standard Gizmos
TransformGizmo: 3-axis transform gizmo built out of above elements
AxisSources.h, ParameterSourcesFloat/Vec2.h, StateTargets.h, HitTargets.h, TransformSources.h: UObjects used by Gizmos to expose implementation for customization.
ParameterToTransformAdapters.h: Gizmo ParameterSource implementations that convert axis/plane position and axis-angle to 3D translations/rotations
TransformProxy: wrapper around set of objects that provides a single FTransform, used by TransformGizmo to apply to multiple objects/etc
GizmoMath.h, GizmoRenderingUtil.h: utility functions for Gizmo implementation
#fyi Lauren.Ridge
#rb Michael.Daum
#rnx
[CL 8618015 by Ryan Schmidt in Dev-Editor branch]
2019-09-10 14:14:29 -04:00
{
check ( bDefaultGizmosRegistered ) ;
UInteractiveGizmo * NewGizmo = CreateGizmo ( DefaultThreeAxisTransformBuilderIdentifier , InstanceIdentifier , Owner ) ;
check ( NewGizmo ) ;
2021-09-29 23:19:52 -04:00
return Cast < UCombinedTransformGizmo > ( NewGizmo ) ;
2019-09-14 00:17:10 -04:00
}
2021-09-29 23:19:52 -04:00
UCombinedTransformGizmo * UInteractiveGizmoManager : : CreateCustomTransformGizmo ( ETransformGizmoSubElements Elements , void * Owner , const FString & InstanceIdentifier )
2019-09-14 00:59:31 -04:00
{
check ( bDefaultGizmosRegistered ) ;
2021-01-14 19:07:52 -04:00
GizmoActorBuilder - > EnableElements = Elements ;
2019-09-14 00:59:31 -04:00
UInteractiveGizmo * NewGizmo = CreateGizmo ( CustomThreeAxisTransformBuilderIdentifier , InstanceIdentifier , Owner ) ;
check ( NewGizmo ) ;
2021-09-29 23:19:52 -04:00
return Cast < UCombinedTransformGizmo > ( NewGizmo ) ;
2019-09-14 00:59:31 -04:00
}
2021-09-29 23:19:52 -04:00
UCombinedTransformGizmo * UInteractiveGizmoManager : : CreateCustomRepositionableTransformGizmo ( ETransformGizmoSubElements Elements , void * Owner , const FString & InstanceIdentifier )
2021-01-14 19:07:52 -04:00
{
check ( bDefaultGizmosRegistered ) ;
GizmoActorBuilder - > EnableElements = Elements ;
UInteractiveGizmo * NewGizmo = CreateGizmo ( CustomRepositionableThreeAxisTransformBuilderIdentifier , InstanceIdentifier , Owner ) ;
check ( NewGizmo ) ;
2021-09-29 23:19:52 -04:00
return Cast < UCombinedTransformGizmo > ( NewGizmo ) ;
2021-01-14 19:07:52 -04:00
}
2019-09-14 00:17:10 -04:00
2020-10-09 22:42:26 -04:00
# undef LOCTEXT_NAMESPACE