2014-12-07 19:09:38 -05:00
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
# include "ComponentVisualizersPrivatePCH.h"
# include "SplineComponentVisualizer.h"
2014-06-27 14:18:10 -04:00
# include "ScopedTransaction.h"
2014-03-14 14:13:41 -04:00
2014-05-16 09:37:22 -04:00
IMPLEMENT_HIT_PROXY ( HSplineVisProxy , HComponentVisProxy ) ;
IMPLEMENT_HIT_PROXY ( HSplineKeyProxy , HSplineVisProxy ) ;
2014-07-23 09:40:19 -04:00
IMPLEMENT_HIT_PROXY ( HSplineSegmentProxy , HSplineVisProxy ) ;
2014-11-19 10:29:43 -05:00
IMPLEMENT_HIT_PROXY ( HSplineTangentHandleProxy , HSplineVisProxy ) ;
2014-05-16 09:37:22 -04:00
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
# define LOCTEXT_NAMESPACE "SplineComponentVisualizer"
/** Define commands for the spline component visualizer */
class FSplineComponentVisualizerCommands : public TCommands < FSplineComponentVisualizerCommands >
{
public :
FSplineComponentVisualizerCommands ( ) : TCommands < FSplineComponentVisualizerCommands >
(
" SplineComponentVisualizer " , // Context name for fast lookup
LOCTEXT ( " SplineComponentVisualizer " , " Spline Component Visualizer " ) , // Localized context name for displaying
NAME_None , // Parent
FEditorStyle : : GetStyleSetName ( )
)
{
}
2014-06-13 06:14:46 -04:00
virtual void RegisterCommands ( ) override
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
{
2015-03-17 11:36:28 -04:00
UI_COMMAND ( DeleteKey , " Delete Spline Point " , " Delete the currently selected spline point. " , EUserInterfaceActionType : : Button , FInputChord ( EKeys : : Delete ) ) ;
UI_COMMAND ( DuplicateKey , " Duplicate Spline Point " , " Duplicate the currently selected spline point. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( AddKey , " Add Spline Point Here " , " Add a new spline point at the cursor location. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( ResetToUnclampedTangent , " Unclamped Tangent " , " Reset the tangent for this spline point to its default unclamped value. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( ResetToClampedTangent , " Clamped Tangent " , " Reset the tangent for this spline point to its default clamped value. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( SetKeyToCurve , " Curve " , " Set spline point to Curve type " , EUserInterfaceActionType : : RadioButton , FInputChord ( ) ) ;
UI_COMMAND ( SetKeyToLinear , " Linear " , " Set spline point to Linear type " , EUserInterfaceActionType : : RadioButton , FInputChord ( ) ) ;
UI_COMMAND ( SetKeyToConstant , " Constant " , " Set spline point to Constant type " , EUserInterfaceActionType : : RadioButton , FInputChord ( ) ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
UI_COMMAND ( VisualizeRollAndScale , " Visualize Roll and Scale " , " Whether the visualization should show roll and scale on this spline. " , EUserInterfaceActionType : : ToggleButton , FInputChord ( ) ) ;
UI_COMMAND ( ResetToDefault , " Reset to Default " , " Reset this spline to its archetype default. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
public :
/** Delete key */
TSharedPtr < FUICommandInfo > DeleteKey ;
/** Duplicate key */
TSharedPtr < FUICommandInfo > DuplicateKey ;
2014-07-23 09:40:19 -04:00
/** Add key */
TSharedPtr < FUICommandInfo > AddKey ;
2014-06-27 14:18:10 -04:00
/** Reset to unclamped tangent */
TSharedPtr < FUICommandInfo > ResetToUnclampedTangent ;
/** Reset to clamped tangent */
TSharedPtr < FUICommandInfo > ResetToClampedTangent ;
/** Set spline key to Curve type */
TSharedPtr < FUICommandInfo > SetKeyToCurve ;
/** Set spline key to Linear type */
TSharedPtr < FUICommandInfo > SetKeyToLinear ;
/** Set spline key to Constant type */
TSharedPtr < FUICommandInfo > SetKeyToConstant ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
/** Whether the visualization should show roll and scale */
TSharedPtr < FUICommandInfo > VisualizeRollAndScale ;
/** Reset this spline to its default */
TSharedPtr < FUICommandInfo > ResetToDefault ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
} ;
FSplineComponentVisualizer : : FSplineComponentVisualizer ( )
: FComponentVisualizer ( )
2014-12-15 03:05:31 -05:00
, LastKeyIndexSelected ( INDEX_NONE )
2014-07-23 09:40:19 -04:00
, SelectedSegmentIndex ( INDEX_NONE )
2014-12-15 03:05:31 -05:00
, SelectedTangentHandle ( INDEX_NONE )
, SelectedTangentHandleType ( ESelectedTangentHandle : : None )
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
, bAllowDuplication ( true )
{
FSplineComponentVisualizerCommands : : Register ( ) ;
SplineComponentVisualizerActions = MakeShareable ( new FUICommandList ) ;
}
void FSplineComponentVisualizer : : OnRegister ( )
{
const auto & Commands = FSplineComponentVisualizerCommands : : Get ( ) ;
SplineComponentVisualizerActions - > MapAction (
Commands . DeleteKey ,
FExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : OnDeleteKey ) ,
2014-10-01 11:14:01 -04:00
FCanExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : CanDeleteKey ) ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
SplineComponentVisualizerActions - > MapAction (
Commands . DuplicateKey ,
FExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : OnDuplicateKey ) ,
2014-07-23 09:40:19 -04:00
FCanExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : IsKeySelectionValid ) ) ;
SplineComponentVisualizerActions - > MapAction (
Commands . AddKey ,
FExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : OnAddKey ) ,
FCanExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : CanAddKey ) ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
SplineComponentVisualizerActions - > MapAction (
2014-06-27 14:18:10 -04:00
Commands . ResetToUnclampedTangent ,
FExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : OnResetToAutomaticTangent , CIM_CurveAuto ) ,
FCanExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : CanResetToAutomaticTangent , CIM_CurveAuto ) ) ;
SplineComponentVisualizerActions - > MapAction (
Commands . ResetToClampedTangent ,
FExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : OnResetToAutomaticTangent , CIM_CurveAutoClamped ) ,
FCanExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : CanResetToAutomaticTangent , CIM_CurveAutoClamped ) ) ;
SplineComponentVisualizerActions - > MapAction (
Commands . SetKeyToCurve ,
FExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : OnSetKeyType , CIM_CurveAuto ) ,
FCanExecuteAction ( ) ,
FIsActionChecked : : CreateSP ( this , & FSplineComponentVisualizer : : IsKeyTypeSet , CIM_CurveAuto ) ) ;
SplineComponentVisualizerActions - > MapAction (
Commands . SetKeyToLinear ,
FExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : OnSetKeyType , CIM_Linear ) ,
FCanExecuteAction ( ) ,
FIsActionChecked : : CreateSP ( this , & FSplineComponentVisualizer : : IsKeyTypeSet , CIM_Linear ) ) ;
SplineComponentVisualizerActions - > MapAction (
Commands . SetKeyToConstant ,
FExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : OnSetKeyType , CIM_Constant ) ,
FCanExecuteAction ( ) ,
FIsActionChecked : : CreateSP ( this , & FSplineComponentVisualizer : : IsKeyTypeSet , CIM_Constant ) ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
SplineComponentVisualizerActions - > MapAction (
Commands . VisualizeRollAndScale ,
FExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : OnSetVisualizeRollAndScale ) ,
FCanExecuteAction ( ) ,
FIsActionChecked : : CreateSP ( this , & FSplineComponentVisualizer : : IsVisualizingRollAndScale ) ) ;
SplineComponentVisualizerActions - > MapAction (
Commands . ResetToDefault ,
FExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : OnResetToDefault ) ,
FCanExecuteAction : : CreateSP ( this , & FSplineComponentVisualizer : : CanResetToDefault ) ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
FSplineComponentVisualizer : : ~ FSplineComponentVisualizer ( )
{
FSplineComponentVisualizerCommands : : Unregister ( ) ;
}
2014-05-16 09:37:22 -04:00
2014-03-14 14:13:41 -04:00
void FSplineComponentVisualizer : : DrawVisualization ( const UActorComponent * Component , const FSceneView * View , FPrimitiveDrawInterface * PDI )
{
if ( const USplineComponent * SplineComp = Cast < const USplineComponent > ( Component ) )
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const USplineComponent * EditedSplineComp = GetEditedSplineComponent ( ) ;
2014-06-27 14:18:10 -04:00
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const USplineComponent * Archetype = CastChecked < USplineComponent > ( SplineComp - > GetArchetype ( ) ) ;
const bool bIsSplineEditable = SplineComp - > bSplineHasBeenEdited | | SplineComp - > SplineInfo . Points = = Archetype - > SplineInfo . Points ;
2014-07-23 09:40:19 -04:00
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const FColor ReadOnlyColor = FColor ( 255 , 0 , 255 , 255 ) ;
2015-04-24 07:20:48 -04:00
const FColor NormalColor = bIsSplineEditable ? FColor ( SplineComp - > EditorUnselectedSplineSegmentColor ) : ReadOnlyColor ;
const FColor SelectedColor = bIsSplineEditable ? FColor ( SplineComp - > EditorSelectedSplineSegmentColor ) : ReadOnlyColor ;
2014-06-11 00:20:55 -04:00
const float GrabHandleSize = 12.0f ;
2014-11-19 10:29:43 -05:00
const float TangentHandleSize = 10.0f ;
2014-05-16 09:37:22 -04:00
const FInterpCurveVector & SplineInfo = SplineComp - > SplineInfo ;
2014-11-19 10:29:43 -05:00
// Draw the tangent handles before anything else so they will not overdraw the rest of the spline
2014-12-15 03:05:31 -05:00
if ( SplineComp = = EditedSplineComp )
2014-11-19 10:29:43 -05:00
{
2014-12-15 03:05:31 -05:00
for ( int32 SelectedKey : SelectedKeys )
{
if ( SplineInfo . Points [ SelectedKey ] . IsCurveKey ( ) )
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const FVector Location = SplineComp - > GetLocationAtSplinePoint ( SelectedKey , ESplineCoordinateSpace : : World ) ;
const FVector Tangent = SplineComp - > GetTangentAtSplinePoint ( SelectedKey , ESplineCoordinateSpace : : World ) ;
2014-11-19 10:29:43 -05:00
2014-12-15 03:05:31 -05:00
PDI - > SetHitProxy ( NULL ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
DrawDashedLine ( PDI , Location , Location + Tangent , SelectedColor , 5 , SDPG_Foreground ) ;
DrawDashedLine ( PDI , Location , Location - Tangent , SelectedColor , 5 , SDPG_Foreground ) ;
if ( bIsSplineEditable )
{
PDI - > SetHitProxy ( new HSplineTangentHandleProxy ( Component , SelectedKey , false ) ) ;
}
PDI - > DrawPoint ( Location + Tangent , SelectedColor , TangentHandleSize , SDPG_Foreground ) ;
if ( bIsSplineEditable )
{
PDI - > SetHitProxy ( new HSplineTangentHandleProxy ( Component , SelectedKey , true ) ) ;
}
PDI - > DrawPoint ( Location - Tangent , SelectedColor , TangentHandleSize , SDPG_Foreground ) ;
2014-12-15 03:05:31 -05:00
PDI - > SetHitProxy ( NULL ) ;
}
}
2014-11-19 10:29:43 -05:00
}
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const bool bShouldVisualizeScale = SplineComp - > bShouldVisualizeScale ;
const float DefaultScale = SplineComp - > ScaleVisualizationWidth ;
2014-05-16 09:37:22 -04:00
FVector OldKeyPos ( 0 ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FVector OldKeyRightVector ( 0 ) ;
FVector OldKeyScale ( 0 ) ;
const int32 NumPoints = SplineInfo . Points . Num ( ) ;
const int32 NumSegments = SplineComp - > IsClosedLoop ( ) ? NumPoints : NumPoints - 1 ;
for ( int32 KeyIdx = 0 ; KeyIdx < NumSegments + 1 ; KeyIdx + + )
2014-05-16 09:37:22 -04:00
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const FVector NewKeyPos = SplineComp - > GetLocationAtSplinePoint ( KeyIdx , ESplineCoordinateSpace : : World ) ;
const FVector NewKeyRightVector = SplineComp - > GetRightVectorAtSplinePoint ( KeyIdx , ESplineCoordinateSpace : : World ) ;
const FVector NewKeyUpVector = SplineComp - > GetUpVectorAtSplinePoint ( KeyIdx , ESplineCoordinateSpace : : World ) ;
const FVector NewKeyScale = SplineComp - > GetScaleAtSplinePoint ( KeyIdx ) * DefaultScale ;
2014-05-16 09:37:22 -04:00
2014-12-15 03:05:31 -05:00
const FColor KeyColor = ( SplineComp = = EditedSplineComp & & SelectedKeys . Contains ( KeyIdx ) ) ? SelectedColor : NormalColor ;
2014-05-16 09:37:22 -04:00
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
// Draw the keypoint and up/right vectors
if ( KeyIdx < NumPoints )
2014-10-01 11:14:01 -04:00
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
if ( bShouldVisualizeScale )
{
PDI - > SetHitProxy ( NULL ) ;
PDI - > DrawLine ( NewKeyPos , NewKeyPos - NewKeyRightVector * NewKeyScale . Y , KeyColor , SDPG_Foreground ) ;
PDI - > DrawLine ( NewKeyPos , NewKeyPos + NewKeyRightVector * NewKeyScale . Y , KeyColor , SDPG_Foreground ) ;
PDI - > DrawLine ( NewKeyPos , NewKeyPos + NewKeyUpVector * NewKeyScale . Z , KeyColor , SDPG_Foreground ) ;
const int32 ArcPoints = 20 ;
FVector OldArcPos = NewKeyPos + NewKeyRightVector * NewKeyScale . Y ;
for ( int32 ArcIndex = 1 ; ArcIndex < = ArcPoints ; ArcIndex + + )
{
float Sin ;
float Cos ;
FMath : : SinCos ( & Sin , & Cos , ArcIndex * PI / ArcPoints ) ;
const FVector NewArcPos = NewKeyPos + Cos * NewKeyRightVector * NewKeyScale . Y + Sin * NewKeyUpVector * NewKeyScale . Z ;
PDI - > DrawLine ( OldArcPos , NewArcPos , KeyColor , SDPG_Foreground ) ;
OldArcPos = NewArcPos ;
}
}
if ( bIsSplineEditable )
{
PDI - > SetHitProxy ( new HSplineKeyProxy ( Component , KeyIdx ) ) ;
}
2014-10-01 11:14:01 -04:00
PDI - > DrawPoint ( NewKeyPos , KeyColor , GrabHandleSize , SDPG_Foreground ) ;
PDI - > SetHitProxy ( NULL ) ;
}
2014-05-16 09:37:22 -04:00
2014-06-11 00:20:55 -04:00
// If not the first keypoint, draw a line to the previous keypoint.
2014-12-15 03:05:31 -05:00
if ( KeyIdx > 0 )
2014-05-16 09:37:22 -04:00
{
2014-12-15 03:05:31 -05:00
const FColor LineColor = ( SplineComp = = EditedSplineComp & & SelectedKeys . Contains ( KeyIdx - 1 ) ) ? SelectedColor : NormalColor ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
if ( bIsSplineEditable )
{
PDI - > SetHitProxy ( new HSplineSegmentProxy ( Component , KeyIdx - 1 ) ) ;
}
2014-07-23 09:40:19 -04:00
2014-05-16 09:37:22 -04:00
// For constant interpolation - don't draw ticks - just draw dotted line.
if ( SplineInfo . Points [ KeyIdx - 1 ] . InterpMode = = CIM_Constant )
{
2014-07-23 09:40:19 -04:00
DrawDashedLine ( PDI , OldKeyPos , NewKeyPos , LineColor , 20 , SDPG_World ) ;
2014-05-16 09:37:22 -04:00
}
else
{
// Find position on first keyframe.
FVector OldPos = OldKeyPos ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FVector OldRightVector = OldKeyRightVector ;
FVector OldScale = OldKeyScale ;
2014-05-16 09:37:22 -04:00
// Then draw a line for each substep.
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const int32 NumSteps = 20 ;
for ( int32 StepIdx = 1 ; StepIdx < = NumSteps ; StepIdx + + )
2014-05-16 09:37:22 -04:00
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const float Key = ( KeyIdx - 1 ) + ( StepIdx / static_cast < float > ( NumSteps ) ) ;
const FVector NewPos = SplineComp - > GetLocationAtSplineInputKey ( Key , ESplineCoordinateSpace : : World ) ;
const FVector NewRightVector = SplineComp - > GetRightVectorAtSplineInputKey ( Key , ESplineCoordinateSpace : : World ) ;
const FVector NewScale = SplineComp - > GetScaleAtSplineInputKey ( Key ) * DefaultScale ;
2014-05-16 09:37:22 -04:00
2014-07-23 09:40:19 -04:00
PDI - > DrawLine ( OldPos , NewPos , LineColor , SDPG_Foreground ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
if ( bShouldVisualizeScale )
{
PDI - > DrawLine ( OldPos - OldRightVector * OldScale . Y , NewPos - NewRightVector * NewScale . Y , LineColor , SDPG_Foreground ) ;
PDI - > DrawLine ( OldPos + OldRightVector * OldScale . Y , NewPos + NewRightVector * NewScale . Y , LineColor , SDPG_Foreground ) ;
}
2014-05-16 09:37:22 -04:00
OldPos = NewPos ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
OldRightVector = NewRightVector ;
OldScale = NewScale ;
2014-05-16 09:37:22 -04:00
}
}
2014-07-23 09:40:19 -04:00
PDI - > SetHitProxy ( NULL ) ;
2014-05-16 09:37:22 -04:00
}
OldKeyPos = NewKeyPos ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
OldKeyRightVector = NewKeyRightVector ;
OldKeyScale = NewKeyScale ;
2014-05-16 09:37:22 -04:00
}
2014-03-14 14:13:41 -04:00
}
}
2014-05-16 09:37:22 -04:00
2014-12-15 03:05:31 -05:00
void FSplineComponentVisualizer : : ChangeSelectionState ( int32 Index , bool bIsCtrlHeld )
{
if ( Index = = INDEX_NONE )
{
SelectedKeys . Empty ( ) ;
LastKeyIndexSelected = INDEX_NONE ;
}
else if ( ! bIsCtrlHeld )
{
SelectedKeys . Empty ( ) ;
SelectedKeys . Add ( Index ) ;
LastKeyIndexSelected = Index ;
}
else
{
// Add or remove from selection if Ctrl is held
if ( SelectedKeys . Contains ( Index ) )
{
// If already in selection, toggle it off
SelectedKeys . Remove ( Index ) ;
if ( LastKeyIndexSelected = = Index )
{
if ( SelectedKeys . Num ( ) = = 0 )
{
// Last key selected: clear last key index selected
LastKeyIndexSelected = INDEX_NONE ;
}
else
{
// Arbitarily set last key index selected to first member of the set (so that it is valid)
LastKeyIndexSelected = * SelectedKeys . CreateConstIterator ( ) ;
}
}
}
else
{
// Add to selection
SelectedKeys . Add ( Index ) ;
LastKeyIndexSelected = Index ;
}
}
}
2014-07-23 09:40:19 -04:00
bool FSplineComponentVisualizer : : VisProxyHandleClick ( FLevelEditorViewportClient * InViewportClient , HComponentVisProxy * VisProxy , const FViewportClick & Click )
2014-05-16 09:37:22 -04:00
{
if ( VisProxy & & VisProxy - > Component . IsValid ( ) )
{
const USplineComponent * SplineComp = CastChecked < const USplineComponent > ( VisProxy - > Component . Get ( ) ) ;
SplineCompPropName = GetComponentPropertyName ( SplineComp ) ;
if ( SplineCompPropName ! = NAME_None )
{
SplineOwningActor = SplineComp - > GetOwner ( ) ;
if ( VisProxy - > IsA ( HSplineKeyProxy : : StaticGetType ( ) ) )
{
2014-12-15 03:05:31 -05:00
// Control point clicked
2014-05-16 09:37:22 -04:00
HSplineKeyProxy * KeyProxy = ( HSplineKeyProxy * ) VisProxy ;
2014-12-15 03:05:31 -05:00
// Modify the selection state, unless right-clicking on an already selected key
if ( Click . GetKey ( ) ! = EKeys : : RightMouseButton | | ! SelectedKeys . Contains ( KeyProxy - > KeyIndex ) )
{
ChangeSelectionState ( KeyProxy - > KeyIndex , InViewportClient - > IsCtrlPressed ( ) ) ;
}
2014-07-23 09:40:19 -04:00
SelectedSegmentIndex = INDEX_NONE ;
2014-12-15 03:05:31 -05:00
SelectedTangentHandle = INDEX_NONE ;
SelectedTangentHandleType = ESelectedTangentHandle : : None ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
CachedRotation = SplineComp - > GetQuaternionAtSplinePoint ( LastKeyIndexSelected , ESplineCoordinateSpace : : World ) ;
return true ;
2014-07-23 09:40:19 -04:00
}
else if ( VisProxy - > IsA ( HSplineSegmentProxy : : StaticGetType ( ) ) )
{
2014-12-15 03:05:31 -05:00
// Spline segment clicked
2014-07-23 09:40:19 -04:00
// Divide segment into subsegments and test each subsegment against ray representing click position and camera direction.
// Closest encounter with the spline determines the spline position.
const int32 NumSubdivisions = 16 ;
HSplineSegmentProxy * SegmentProxy = ( HSplineSegmentProxy * ) VisProxy ;
2014-12-15 03:05:31 -05:00
ChangeSelectionState ( SegmentProxy - > SegmentIndex , InViewportClient - > IsCtrlPressed ( ) ) ;
2014-07-23 09:40:19 -04:00
SelectedSegmentIndex = SegmentProxy - > SegmentIndex ;
2014-12-15 03:05:31 -05:00
SelectedTangentHandle = INDEX_NONE ;
SelectedTangentHandleType = ESelectedTangentHandle : : None ;
2014-07-23 09:40:19 -04:00
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
CachedRotation = SplineComp - > GetQuaternionAtSplinePoint ( LastKeyIndexSelected , ESplineCoordinateSpace : : World ) ;
2014-07-23 09:40:19 -04:00
float SubsegmentStartKey = static_cast < float > ( SelectedSegmentIndex ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FVector SubsegmentStart = SplineComp - > GetLocationAtSplineInputKey ( SubsegmentStartKey , ESplineCoordinateSpace : : World ) ;
2014-07-23 09:40:19 -04:00
float ClosestDistance = TNumericLimits < float > : : Max ( ) ;
FVector BestLocation = SubsegmentStart ;
for ( int32 Step = 1 ; Step < NumSubdivisions ; Step + + )
{
const float SubsegmentEndKey = SelectedSegmentIndex + Step / static_cast < float > ( NumSubdivisions ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const FVector SubsegmentEnd = SplineComp - > GetLocationAtSplineInputKey ( SubsegmentEndKey , ESplineCoordinateSpace : : World ) ;
2014-07-23 09:40:19 -04:00
FVector SplineClosest ;
FVector RayClosest ;
FMath : : SegmentDistToSegmentSafe ( SubsegmentStart , SubsegmentEnd , Click . GetOrigin ( ) , Click . GetOrigin ( ) + Click . GetDirection ( ) * 50000.0f , SplineClosest , RayClosest ) ;
const float Distance = FVector : : DistSquared ( SplineClosest , RayClosest ) ;
if ( Distance < ClosestDistance )
{
ClosestDistance = Distance ;
BestLocation = SplineClosest ;
}
SubsegmentStartKey = SubsegmentEndKey ;
SubsegmentStart = SubsegmentEnd ;
}
SelectedSplinePosition = BestLocation ;
2014-12-15 03:05:31 -05:00
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
return true ;
2014-05-16 09:37:22 -04:00
}
2014-11-19 10:29:43 -05:00
else if ( VisProxy - > IsA ( HSplineTangentHandleProxy : : StaticGetType ( ) ) )
{
2014-12-15 03:05:31 -05:00
// Tangent handle clicked
2014-11-19 10:29:43 -05:00
HSplineTangentHandleProxy * KeyProxy = ( HSplineTangentHandleProxy * ) VisProxy ;
2014-12-15 03:05:31 -05:00
// Note: don't change key selection when a tangent handle is clicked
2014-11-19 10:29:43 -05:00
SelectedSegmentIndex = INDEX_NONE ;
2014-12-15 03:05:31 -05:00
SelectedTangentHandle = KeyProxy - > KeyIndex ;
SelectedTangentHandleType = KeyProxy - > bArriveTangent ? ESelectedTangentHandle : : Arrive : ESelectedTangentHandle : : Leave ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
CachedRotation = SplineComp - > GetQuaternionAtSplinePoint ( SelectedTangentHandle , ESplineCoordinateSpace : : World ) ;
return true ;
2014-11-19 10:29:43 -05:00
}
2014-05-16 09:37:22 -04:00
}
else
{
SplineOwningActor = NULL ;
}
}
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
return false ;
2014-05-16 09:37:22 -04:00
}
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
USplineComponent * FSplineComponentVisualizer : : GetEditedSplineComponent ( ) const
2014-05-16 09:37:22 -04:00
{
return Cast < USplineComponent > ( GetComponentFromPropertyName ( SplineOwningActor . Get ( ) , SplineCompPropName ) ) ;
}
2014-07-23 09:40:19 -04:00
bool FSplineComponentVisualizer : : GetWidgetLocation ( const FEditorViewportClient * ViewportClient , FVector & OutLocation ) const
2014-05-16 09:37:22 -04:00
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
if ( SplineComp ! = nullptr )
2014-05-16 09:37:22 -04:00
{
2014-12-15 03:05:31 -05:00
if ( SelectedTangentHandle ! = INDEX_NONE )
2014-05-16 09:37:22 -04:00
{
2014-12-15 03:05:31 -05:00
// If tangent handle index is set, use that
check ( SelectedTangentHandle < SplineComp - > SplineInfo . Points . Num ( ) ) ;
const auto & Point = SplineComp - > SplineInfo . Points [ SelectedTangentHandle ] ;
2014-11-19 10:29:43 -05:00
2014-12-15 03:05:31 -05:00
check ( SelectedTangentHandleType ! = ESelectedTangentHandle : : None ) ;
if ( SelectedTangentHandleType = = ESelectedTangentHandle : : Leave )
2014-11-19 10:29:43 -05:00
{
OutLocation = SplineComp - > ComponentToWorld . TransformPosition ( Point . OutVal + Point . LeaveTangent ) ;
2014-12-15 03:05:31 -05:00
}
else if ( SelectedTangentHandleType = = ESelectedTangentHandle : : Arrive )
{
2014-11-19 10:29:43 -05:00
OutLocation = SplineComp - > ComponentToWorld . TransformPosition ( Point . OutVal - Point . ArriveTangent ) ;
}
2014-05-16 09:37:22 -04:00
return true ;
}
2014-12-15 03:05:31 -05:00
else if ( LastKeyIndexSelected ! = INDEX_NONE )
{
// Otherwise use the last key index set
check ( LastKeyIndexSelected < SplineComp - > SplineInfo . Points . Num ( ) ) ;
check ( SelectedKeys . Contains ( LastKeyIndexSelected ) ) ;
const auto & Point = SplineComp - > SplineInfo . Points [ LastKeyIndexSelected ] ;
OutLocation = SplineComp - > ComponentToWorld . TransformPosition ( Point . OutVal ) ;
return true ;
}
2014-05-16 09:37:22 -04:00
}
return false ;
}
2014-07-23 09:40:19 -04:00
bool FSplineComponentVisualizer : : GetCustomInputCoordinateSystem ( const FEditorViewportClient * ViewportClient , FMatrix & OutMatrix ) const
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
if ( ViewportClient - > GetWidgetCoordSystemSpace ( ) = = COORD_Local | | ViewportClient - > GetWidgetMode ( ) = = FWidget : : WM_Rotate )
2014-07-23 09:40:19 -04:00
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
if ( SplineComp ! = nullptr )
2014-07-23 09:40:19 -04:00
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
OutMatrix = FRotationMatrix : : Make ( CachedRotation ) ;
return true ;
2014-07-23 09:40:19 -04:00
}
}
return false ;
}
2014-06-18 10:16:16 -04:00
bool FSplineComponentVisualizer : : HandleInputDelta ( FEditorViewportClient * ViewportClient , FViewport * Viewport , FVector & DeltaTranslate , FRotator & DeltaRotate , FVector & DeltaScale )
2014-05-16 09:37:22 -04:00
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
if ( SplineComp ! = nullptr )
2014-05-16 09:37:22 -04:00
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FInterpCurveVector & SplineInfo = SplineComp - > SplineInfo ;
FInterpCurveQuat & SplineRotInfo = SplineComp - > SplineRotInfo ;
FInterpCurveVector & SplineScaleInfo = SplineComp - > SplineScaleInfo ;
2014-11-06 15:09:39 -05:00
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const int32 NumPoints = SplineInfo . Points . Num ( ) ;
2014-12-15 03:05:31 -05:00
if ( SelectedTangentHandle ! = INDEX_NONE )
2014-05-16 09:37:22 -04:00
{
2014-12-15 03:05:31 -05:00
// When tangent handles are manipulated...
2014-05-16 09:37:22 -04:00
2014-12-15 03:05:31 -05:00
check ( SelectedTangentHandle < NumPoints ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
2014-12-15 03:05:31 -05:00
if ( ! DeltaTranslate . IsZero ( ) )
2014-11-19 10:29:43 -05:00
{
2014-12-15 03:05:31 -05:00
check ( SelectedTangentHandleType ! = ESelectedTangentHandle : : None ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
SplineComp - > Modify ( ) ;
2014-12-15 03:05:31 -05:00
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FInterpCurvePoint < FVector > & EditedPoint = SplineInfo . Points [ SelectedTangentHandle ] ;
const FVector Delta = ( SelectedTangentHandleType = = ESelectedTangentHandle : : Leave ) ? DeltaTranslate : - DeltaTranslate ;
const FVector Tangent = EditedPoint . LeaveTangent + SplineComp - > ComponentToWorld . InverseTransformVector ( Delta ) ;
EditedPoint . LeaveTangent = Tangent ;
EditedPoint . ArriveTangent = Tangent ;
EditedPoint . InterpMode = CIM_CurveUser ;
2014-11-19 10:29:43 -05:00
}
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
2014-12-15 03:05:31 -05:00
else
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
{
2014-12-15 03:05:31 -05:00
// When spline keys are manipulated...
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
2014-12-15 03:05:31 -05:00
check ( LastKeyIndexSelected ! = INDEX_NONE ) ;
check ( LastKeyIndexSelected < NumPoints ) ;
check ( SelectedKeys . Num ( ) > 0 ) ;
2014-11-19 10:29:43 -05:00
2014-12-15 03:05:31 -05:00
SplineComp - > Modify ( ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
2014-12-15 03:05:31 -05:00
if ( ViewportClient - > IsAltPressed ( ) & & bAllowDuplication )
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
{
2014-12-15 03:05:31 -05:00
OnDuplicateKey ( ) ;
// Don't duplicate again until we release LMB
bAllowDuplication = false ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
2014-12-15 03:05:31 -05:00
for ( int32 SelectedKeyIndex : SelectedKeys )
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FInterpCurvePoint < FVector > & EditedPoint = SplineInfo . Points [ SelectedKeyIndex ] ;
FInterpCurvePoint < FQuat > & EditedRotPoint = SplineRotInfo . Points [ SelectedKeyIndex ] ;
FInterpCurvePoint < FVector > & EditedScalePoint = SplineScaleInfo . Points [ SelectedKeyIndex ] ;
2014-12-15 03:05:31 -05:00
if ( ! DeltaTranslate . IsZero ( ) )
{
// Find key position in world space
const FVector CurrentWorldPos = SplineComp - > ComponentToWorld . TransformPosition ( EditedPoint . OutVal ) ;
// Move in world space
const FVector NewWorldPos = CurrentWorldPos + DeltaTranslate ;
// Convert back to local space
EditedPoint . OutVal = SplineComp - > ComponentToWorld . InverseTransformPosition ( NewWorldPos ) ;
}
if ( ! DeltaRotate . IsZero ( ) )
{
// Set point tangent as user controlled
EditedPoint . InterpMode = CIM_CurveUser ;
// Rotate tangent according to delta rotation
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FVector NewTangent = SplineComp - > ComponentToWorld . GetRotation ( ) . RotateVector ( EditedPoint . LeaveTangent ) ; // convert local-space tangent vector to world-space
NewTangent = DeltaRotate . RotateVector ( NewTangent ) ; // apply world-space delta rotation to world-space tangent
NewTangent = SplineComp - > ComponentToWorld . GetRotation ( ) . Inverse ( ) . RotateVector ( NewTangent ) ; // convert world-space tangent vector back into local-space
2014-12-15 03:05:31 -05:00
EditedPoint . LeaveTangent = NewTangent ;
EditedPoint . ArriveTangent = NewTangent ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
// Rotate spline rotation according to delta rotation
FQuat NewRot = SplineComp - > ComponentToWorld . GetRotation ( ) * EditedRotPoint . OutVal ; // convert local-space rotation to world-space
NewRot = DeltaRotate . Quaternion ( ) * NewRot ; // apply world-space rotation
NewRot = SplineComp - > ComponentToWorld . GetRotation ( ) . Inverse ( ) * NewRot ; // convert world-space rotation to local-space
EditedRotPoint . OutVal = NewRot ;
2014-12-15 03:05:31 -05:00
}
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
if ( DeltaScale . X ! = 0.0f )
2014-12-15 03:05:31 -05:00
{
// Set point tangent as user controlled
EditedPoint . InterpMode = CIM_CurveUser ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
const FVector NewTangent = EditedPoint . LeaveTangent * ( 1.0f + DeltaScale . X ) ;
2014-12-15 03:05:31 -05:00
EditedPoint . LeaveTangent = NewTangent ;
EditedPoint . ArriveTangent = NewTangent ;
}
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
if ( DeltaScale . Y ! = 0.0f )
2014-12-15 03:05:31 -05:00
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
// Scale in Y adjusts the scale spline
EditedScalePoint . OutVal . Y * = ( 1.0f + DeltaScale . Y ) ;
}
if ( DeltaScale . Z ! = 0.0f )
{
// Scale in Z adjusts the scale spline
EditedScalePoint . OutVal . Z * = ( 1.0f + DeltaScale . Z ) ;
2014-12-15 03:05:31 -05:00
}
}
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
2014-05-16 09:37:22 -04:00
2014-06-11 00:20:55 -04:00
NotifyComponentModified ( ) ;
2014-05-16 09:37:22 -04:00
return true ;
}
return false ;
}
2014-06-18 10:16:16 -04:00
bool FSplineComponentVisualizer : : HandleInputKey ( FEditorViewportClient * ViewportClient , FViewport * Viewport , FKey Key , EInputEvent Event )
2014-05-16 09:37:22 -04:00
{
bool bHandled = false ;
Improvements to SplineComponent, and added a new way of handling UI Command Lists.
#add Added a new FUICommandList::ProcessCommandBindings overload, which can be called from a Viewport Client's InputKey() method (in the absence of an FKeyboardEvent object).
#add Fixed key binding handling in SplineComponentVisualizer so that it works through the FUICommandList, instead of being hardcoded.
#change USplineComponent - changed method by which spline reparam table is created (now uses the old method of splitting each segment into a fixed number of steps, instead of using fixed arc length reparameterization, which doesn't lead to such good results where the distance between control points varies largely throughout the spline). The ReparamStepsPerSegment parameter remains, although I'd like to remove it when I can hit upon a better way to adaptively step through the spline. Merged UpdateSplineReparamTable and AutoSetTangents into a single UpdateSpline method.
#add Added a parameter to FInterpCurve::AutoSetTangents - bStationaryEndpoints - which determines whether the endpoints should be assigned zero tangents, or whether the tangents should be set in order to extrapolate the curve beyond the endpoints, essentially providing a constant velocity at the start/end.
#add Added bStationaryEndpoints as an editable parameter to USplineComponent. Use this if you only wish to traverse the spline at constant velocity, as it will lead to more accurate results.
#codereview James.Golding, Michael.Noland
[CL 2112073 by Richard TalbotWatkin in Main branch]
2014-06-20 14:38:07 -04:00
if ( Key = = EKeys : : LeftMouseButton & & Event = = IE_Released )
2014-05-16 09:37:22 -04:00
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
if ( SplineComp ! = nullptr )
{
// Recache widget rotation
int32 Index = SelectedTangentHandle ;
if ( Index = = INDEX_NONE )
{
// If not set, fall back to last key index selected
Index = LastKeyIndexSelected ;
}
CachedRotation = SplineComp - > GetQuaternionAtSplinePoint ( Index , ESplineCoordinateSpace : : World ) ;
}
2014-05-16 09:37:22 -04:00
// Reset duplication flag on LMB release
bAllowDuplication = true ;
}
Improvements to SplineComponent, and added a new way of handling UI Command Lists.
#add Added a new FUICommandList::ProcessCommandBindings overload, which can be called from a Viewport Client's InputKey() method (in the absence of an FKeyboardEvent object).
#add Fixed key binding handling in SplineComponentVisualizer so that it works through the FUICommandList, instead of being hardcoded.
#change USplineComponent - changed method by which spline reparam table is created (now uses the old method of splitting each segment into a fixed number of steps, instead of using fixed arc length reparameterization, which doesn't lead to such good results where the distance between control points varies largely throughout the spline). The ReparamStepsPerSegment parameter remains, although I'd like to remove it when I can hit upon a better way to adaptively step through the spline. Merged UpdateSplineReparamTable and AutoSetTangents into a single UpdateSpline method.
#add Added a parameter to FInterpCurve::AutoSetTangents - bStationaryEndpoints - which determines whether the endpoints should be assigned zero tangents, or whether the tangents should be set in order to extrapolate the curve beyond the endpoints, essentially providing a constant velocity at the start/end.
#add Added bStationaryEndpoints as an editable parameter to USplineComponent. Use this if you only wish to traverse the spline at constant velocity, as it will lead to more accurate results.
#codereview James.Golding, Michael.Noland
[CL 2112073 by Richard TalbotWatkin in Main branch]
2014-06-20 14:38:07 -04:00
if ( Event = = IE_Pressed )
2014-05-16 09:37:22 -04:00
{
Improvements to SplineComponent, and added a new way of handling UI Command Lists.
#add Added a new FUICommandList::ProcessCommandBindings overload, which can be called from a Viewport Client's InputKey() method (in the absence of an FKeyboardEvent object).
#add Fixed key binding handling in SplineComponentVisualizer so that it works through the FUICommandList, instead of being hardcoded.
#change USplineComponent - changed method by which spline reparam table is created (now uses the old method of splitting each segment into a fixed number of steps, instead of using fixed arc length reparameterization, which doesn't lead to such good results where the distance between control points varies largely throughout the spline). The ReparamStepsPerSegment parameter remains, although I'd like to remove it when I can hit upon a better way to adaptively step through the spline. Merged UpdateSplineReparamTable and AutoSetTangents into a single UpdateSpline method.
#add Added a parameter to FInterpCurve::AutoSetTangents - bStationaryEndpoints - which determines whether the endpoints should be assigned zero tangents, or whether the tangents should be set in order to extrapolate the curve beyond the endpoints, essentially providing a constant velocity at the start/end.
#add Added bStationaryEndpoints as an editable parameter to USplineComponent. Use this if you only wish to traverse the spline at constant velocity, as it will lead to more accurate results.
#codereview James.Golding, Michael.Noland
[CL 2112073 by Richard TalbotWatkin in Main branch]
2014-06-20 14:38:07 -04:00
bHandled = SplineComponentVisualizerActions - > ProcessCommandBindings ( Key , FSlateApplication : : Get ( ) . GetModifierKeys ( ) , false ) ;
2014-05-16 09:37:22 -04:00
}
return bHandled ;
}
void FSplineComponentVisualizer : : EndEditing ( )
{
SplineOwningActor = NULL ;
SplineCompPropName = NAME_None ;
2014-12-15 03:05:31 -05:00
ChangeSelectionState ( INDEX_NONE , false ) ;
SelectedSegmentIndex = INDEX_NONE ;
SelectedTangentHandle = INDEX_NONE ;
SelectedTangentHandleType = ESelectedTangentHandle : : None ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
void FSplineComponentVisualizer : : OnDuplicateKey ( )
{
2014-07-23 09:40:19 -04:00
const FScopedTransaction Transaction ( LOCTEXT ( " DuplicateSplinePoint " , " Duplicate Spline Point " ) ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
check ( SplineComp ! = nullptr ) ;
check ( LastKeyIndexSelected ! = INDEX_NONE ) ;
check ( SelectedKeys . Num ( ) > 0 ) ;
check ( SelectedKeys . Contains ( LastKeyIndexSelected ) ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
2014-11-06 15:09:39 -05:00
SplineComp - > Modify ( ) ;
2014-06-27 14:18:10 -04:00
if ( AActor * Owner = SplineComp - > GetOwner ( ) )
{
Owner - > Modify ( ) ;
}
2014-12-15 03:05:31 -05:00
// Get a sorted list of all the selected indices, highest to lowest
TArray < int32 > SelectedKeysSorted ;
for ( int32 SelectedKeyIndex : SelectedKeys )
{
SelectedKeysSorted . Add ( SelectedKeyIndex ) ;
}
SelectedKeysSorted . Sort ( [ ] ( int32 A , int32 B ) { return A > B ; } ) ;
// Insert duplicates into the list, highest index first, so that the lower indices remain the same
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FInterpCurveVector & SplineInfo = SplineComp - > SplineInfo ;
FInterpCurveQuat & SplineRotInfo = SplineComp - > SplineRotInfo ;
FInterpCurveVector & SplineScaleInfo = SplineComp - > SplineScaleInfo ;
2014-12-15 03:05:31 -05:00
for ( int32 SelectedKeyIndex : SelectedKeysSorted )
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
// Insert duplicates into arrays.
// It's necessary to take a copy because copying existing array items by reference isn't allowed (the array may reallocate)
SplineInfo . Points . Insert ( FInterpCurvePoint < FVector > ( SplineInfo . Points [ SelectedKeyIndex ] ) , SelectedKeyIndex ) ;
SplineRotInfo . Points . Insert ( FInterpCurvePoint < FQuat > ( SplineRotInfo . Points [ SelectedKeyIndex ] ) , SelectedKeyIndex ) ;
SplineScaleInfo . Points . Insert ( FInterpCurvePoint < FVector > ( SplineScaleInfo . Points [ SelectedKeyIndex ] ) , SelectedKeyIndex ) ;
2014-12-15 03:05:31 -05:00
}
// Repopulate the selected keys
SelectedKeys . Empty ( ) ;
int32 Offset = SelectedKeysSorted . Num ( ) ;
for ( int32 SelectedKeyIndex : SelectedKeysSorted )
{
SelectedKeys . Add ( SelectedKeyIndex + Offset ) ;
if ( LastKeyIndexSelected = = SelectedKeyIndex )
{
LastKeyIndexSelected + = Offset ;
}
Offset - - ;
}
// Unset tangent handle selection
SelectedTangentHandle = INDEX_NONE ;
SelectedTangentHandleType = ESelectedTangentHandle : : None ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
2014-06-11 00:20:55 -04:00
NotifyComponentModified ( ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
// CachedRotation = SplineComp->GetQuaternionAtSplinePoint(LastKeyIndexSelected, ESplineCoordinateSpace::World);
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
2014-06-27 14:18:10 -04:00
2014-07-23 09:40:19 -04:00
bool FSplineComponentVisualizer : : CanAddKey ( ) const
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
if ( SplineComp = = nullptr )
{
return false ;
}
const int32 NumPoints = SplineComp - > SplineInfo . Points . Num ( ) ;
const int32 NumSegments = SplineComp - > IsClosedLoop ( ) ? NumPoints : NumPoints - 1 ;
return ( SelectedSegmentIndex ! = INDEX_NONE & & SelectedSegmentIndex < NumSegments ) ;
2014-07-23 09:40:19 -04:00
}
void FSplineComponentVisualizer : : OnAddKey ( )
{
const FScopedTransaction Transaction ( LOCTEXT ( " AddSplinePoint " , " Add Spline Point " ) ) ;
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
check ( SplineComp ! = nullptr ) ;
check ( LastKeyIndexSelected ! = INDEX_NONE ) ;
check ( SelectedKeys . Num ( ) > 0 ) ;
check ( SelectedKeys . Contains ( LastKeyIndexSelected ) ) ;
check ( SelectedTangentHandle = = INDEX_NONE ) ;
check ( SelectedTangentHandleType = = ESelectedTangentHandle : : None ) ;
2014-07-23 09:40:19 -04:00
2014-11-06 15:09:39 -05:00
SplineComp - > Modify ( ) ;
2014-07-23 09:40:19 -04:00
if ( AActor * Owner = SplineComp - > GetOwner ( ) )
{
Owner - > Modify ( ) ;
}
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FInterpCurveVector & SplineInfo = SplineComp - > SplineInfo ;
FInterpCurveQuat & SplineRotInfo = SplineComp - > SplineRotInfo ;
FInterpCurveVector & SplineScaleInfo = SplineComp - > SplineScaleInfo ;
2014-10-01 11:14:01 -04:00
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FInterpCurvePoint < FVector > NewPoint ( 0.0f , SplineComp - > ComponentToWorld . InverseTransformPosition ( SelectedSplinePosition ) , FVector : : ZeroVector , FVector : : ZeroVector , CIM_CurveAuto ) ;
FInterpCurvePoint < FQuat > NewRotPoint ( 0.0f , FQuat : : Identity , FQuat : : Identity , FQuat : : Identity , CIM_CurveAuto ) ;
FInterpCurvePoint < FVector > NewScalePoint ( 0.0f , FVector ( 1.0f ) , FVector : : ZeroVector , FVector : : ZeroVector , CIM_CurveAuto ) ;
SplineInfo . Points . Insert ( NewPoint , SelectedSegmentIndex + 1 ) ;
SplineRotInfo . Points . Insert ( NewRotPoint , SelectedSegmentIndex + 1 ) ;
SplineScaleInfo . Points . Insert ( NewScalePoint , SelectedSegmentIndex + 1 ) ;
2014-12-15 03:05:31 -05:00
// Set selection to 'next' key
ChangeSelectionState ( SelectedSegmentIndex + 1 , false ) ;
2014-07-23 09:40:19 -04:00
SelectedSegmentIndex = INDEX_NONE ;
NotifyComponentModified ( ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
CachedRotation = SplineComp - > GetQuaternionAtSplinePoint ( LastKeyIndexSelected , ESplineCoordinateSpace : : World ) ;
2014-07-23 09:40:19 -04:00
}
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
void FSplineComponentVisualizer : : OnDeleteKey ( )
{
2014-07-23 09:40:19 -04:00
const FScopedTransaction Transaction ( LOCTEXT ( " DeleteSplinePoint " , " Delete Spline Point " ) ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
check ( SplineComp ! = nullptr ) ;
check ( LastKeyIndexSelected ! = INDEX_NONE ) ;
check ( SelectedKeys . Num ( ) > 0 ) ;
check ( SelectedKeys . Contains ( LastKeyIndexSelected ) ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
2014-11-06 15:09:39 -05:00
SplineComp - > Modify ( ) ;
2014-06-27 14:18:10 -04:00
if ( AActor * Owner = SplineComp - > GetOwner ( ) )
{
Owner - > Modify ( ) ;
}
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
2014-12-15 03:05:31 -05:00
// Get a sorted list of all the selected indices, highest to lowest
TArray < int32 > SelectedKeysSorted ;
for ( int32 SelectedKeyIndex : SelectedKeys )
{
SelectedKeysSorted . Add ( SelectedKeyIndex ) ;
}
SelectedKeysSorted . Sort ( [ ] ( int32 A , int32 B ) { return A > B ; } ) ;
// Delete selected keys from list, highest index first
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
FInterpCurveVector & SplineInfo = SplineComp - > SplineInfo ;
FInterpCurveQuat & SplineRotInfo = SplineComp - > SplineRotInfo ;
FInterpCurveVector & SplineScaleInfo = SplineComp - > SplineScaleInfo ;
2014-12-15 03:05:31 -05:00
for ( int32 SelectedKeyIndex : SelectedKeysSorted )
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
SplineInfo . Points . RemoveAt ( SelectedKeyIndex ) ;
SplineRotInfo . Points . RemoveAt ( SelectedKeyIndex ) ;
SplineScaleInfo . Points . RemoveAt ( SelectedKeyIndex ) ;
2014-12-15 03:05:31 -05:00
}
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
// Select first key
ChangeSelectionState ( 0 , false ) ;
2014-12-15 03:05:31 -05:00
SelectedSegmentIndex = INDEX_NONE ;
SelectedTangentHandle = INDEX_NONE ;
SelectedTangentHandleType = ESelectedTangentHandle : : None ;
2014-06-11 00:20:55 -04:00
NotifyComponentModified ( ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
CachedRotation = SplineComp - > GetQuaternionAtSplinePoint ( LastKeyIndexSelected , ESplineCoordinateSpace : : World ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
2014-06-27 14:18:10 -04:00
2014-10-01 11:14:01 -04:00
bool FSplineComponentVisualizer : : CanDeleteKey ( ) const
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
return ( SplineComp ! = nullptr & &
SelectedKeys . Num ( ) > 0 & &
SelectedKeys . Num ( ) ! = SplineComp - > SplineInfo . Points . Num ( ) & &
LastKeyIndexSelected ! = INDEX_NONE ) ;
2014-10-01 11:14:01 -04:00
}
2014-07-23 09:40:19 -04:00
bool FSplineComponentVisualizer : : IsKeySelectionValid ( ) const
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
return ( SplineComp ! = nullptr & &
SelectedKeys . Num ( ) > 0 & &
LastKeyIndexSelected ! = INDEX_NONE ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
2014-06-27 14:18:10 -04:00
void FSplineComponentVisualizer : : OnResetToAutomaticTangent ( EInterpCurveMode Mode )
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
if ( SplineComp ! = nullptr )
2014-06-27 14:18:10 -04:00
{
const FScopedTransaction Transaction ( LOCTEXT ( " ResetToAutomaticTangent " , " Reset to Automatic Tangent " ) ) ;
2014-12-15 03:05:31 -05:00
2014-11-06 15:09:39 -05:00
SplineComp - > Modify ( ) ;
2014-06-27 14:18:10 -04:00
if ( AActor * Owner = SplineComp - > GetOwner ( ) )
{
Owner - > Modify ( ) ;
}
2014-12-15 03:05:31 -05:00
for ( int32 SelectedKeyIndex : SelectedKeys )
{
auto & Point = SplineComp - > SplineInfo . Points [ SelectedKeyIndex ] ;
if ( Point . IsCurveKey ( ) )
{
Point . InterpMode = Mode ;
}
}
2014-06-27 14:18:10 -04:00
NotifyComponentModified ( ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
CachedRotation = SplineComp - > GetQuaternionAtSplinePoint ( LastKeyIndexSelected , ESplineCoordinateSpace : : World ) ;
2014-06-27 14:18:10 -04:00
}
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
2014-06-27 14:18:10 -04:00
bool FSplineComponentVisualizer : : CanResetToAutomaticTangent ( EInterpCurveMode Mode ) const
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
if ( SplineComp ! = nullptr & & LastKeyIndexSelected ! = INDEX_NONE )
{
for ( int32 SelectedKeyIndex : SelectedKeys )
{
const auto & Point = SplineComp - > SplineInfo . Points [ SelectedKeyIndex ] ;
if ( Point . IsCurveKey ( ) & & Point . InterpMode ! = Mode )
{
return true ;
}
}
}
return false ;
2014-06-27 14:18:10 -04:00
}
void FSplineComponentVisualizer : : OnSetKeyType ( EInterpCurveMode Mode )
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
if ( SplineComp ! = nullptr )
2014-06-27 14:18:10 -04:00
{
2014-07-23 09:40:19 -04:00
const FScopedTransaction Transaction ( LOCTEXT ( " SetSplinePointType " , " Set Spline Point Type " ) ) ;
2014-12-15 03:05:31 -05:00
2014-11-06 15:09:39 -05:00
SplineComp - > Modify ( ) ;
2014-06-27 14:18:10 -04:00
if ( AActor * Owner = SplineComp - > GetOwner ( ) )
{
Owner - > Modify ( ) ;
}
2014-12-15 03:05:31 -05:00
for ( int32 SelectedKeyIndex : SelectedKeys )
{
SplineComp - > SplineInfo . Points [ SelectedKeyIndex ] . InterpMode = Mode ;
}
2014-06-27 14:18:10 -04:00
NotifyComponentModified ( ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
CachedRotation = SplineComp - > GetQuaternionAtSplinePoint ( LastKeyIndexSelected , ESplineCoordinateSpace : : World ) ;
2014-06-27 14:18:10 -04:00
}
}
bool FSplineComponentVisualizer : : IsKeyTypeSet ( EInterpCurveMode Mode ) const
{
2014-07-23 09:40:19 -04:00
if ( IsKeySelectionValid ( ) )
2014-06-27 14:18:10 -04:00
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
check ( SplineComp ! = nullptr ) ;
2014-06-27 14:18:10 -04:00
2014-12-15 03:05:31 -05:00
for ( int32 SelectedKeyIndex : SelectedKeys )
{
const auto & SelectedPoint = SplineComp - > SplineInfo . Points [ SelectedKeyIndex ] ;
if ( ( Mode = = CIM_CurveAuto & & SelectedPoint . IsCurveKey ( ) ) | | SelectedPoint . InterpMode = = Mode )
{
return true ;
}
}
2014-06-27 14:18:10 -04:00
}
return false ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
void FSplineComponentVisualizer : : OnSetVisualizeRollAndScale ( )
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
check ( SplineComp ! = nullptr ) ;
SplineComp - > bShouldVisualizeScale = ! SplineComp - > bShouldVisualizeScale ;
GEditor - > RedrawLevelEditingViewports ( true ) ;
}
bool FSplineComponentVisualizer : : IsVisualizingRollAndScale ( ) const
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
check ( SplineComp ! = nullptr ) ;
return SplineComp - > bShouldVisualizeScale ;
}
void FSplineComponentVisualizer : : OnResetToDefault ( )
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
check ( SplineComp ! = nullptr ) ;
const FScopedTransaction Transaction ( LOCTEXT ( " ResetToDefault " , " Reset to Default " ) ) ;
SplineComp - > Modify ( ) ;
if ( SplineOwningActor . IsValid ( ) )
{
SplineOwningActor . Get ( ) - > Modify ( ) ;
}
SplineComp - > bSplineHasBeenEdited = false ;
// Select first key
ChangeSelectionState ( 0 , false ) ;
SelectedSegmentIndex = INDEX_NONE ;
SelectedTangentHandle = INDEX_NONE ;
SelectedTangentHandleType = ESelectedTangentHandle : : None ;
if ( SplineOwningActor . IsValid ( ) )
{
SplineOwningActor . Get ( ) - > PostEditMove ( false ) ;
}
GEditor - > RedrawLevelEditingViewports ( true ) ;
}
bool FSplineComponentVisualizer : : CanResetToDefault ( ) const
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
check ( SplineComp ! = nullptr ) ;
return SplineComp - > bSplineHasBeenEdited ;
}
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
TSharedPtr < SWidget > FSplineComponentVisualizer : : GenerateContextMenu ( ) const
{
FMenuBuilder MenuBuilder ( true , SplineComponentVisualizerActions ) ;
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
MenuBuilder . BeginSection ( " SplinePointEdit " , LOCTEXT ( " SplinePoint " , " Spline Point " ) ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
{
2014-07-23 09:40:19 -04:00
if ( SelectedSegmentIndex ! = INDEX_NONE )
2014-06-27 14:18:10 -04:00
{
2014-07-23 09:40:19 -04:00
MenuBuilder . AddMenuEntry ( FSplineComponentVisualizerCommands : : Get ( ) . AddKey ) ;
}
2014-12-15 03:05:31 -05:00
else if ( LastKeyIndexSelected ! = INDEX_NONE )
2014-07-23 09:40:19 -04:00
{
MenuBuilder . AddMenuEntry ( FSplineComponentVisualizerCommands : : Get ( ) . DeleteKey ) ;
MenuBuilder . AddMenuEntry ( FSplineComponentVisualizerCommands : : Get ( ) . DuplicateKey ) ;
2014-06-27 14:18:10 -04:00
MenuBuilder . AddSubMenu (
2014-07-23 09:40:19 -04:00
LOCTEXT ( " SplinePointType " , " Spline Point Type " ) ,
LOCTEXT ( " KeyTypeTooltip " , " Define the type of the spline point. " ) ,
FNewMenuDelegate : : CreateSP ( this , & FSplineComponentVisualizer : : GenerateSplinePointTypeSubMenu ) ) ;
2014-12-15 03:05:31 -05:00
// Only add the Automatic Tangents submenu if any of the keys is a curve type
2014-07-23 09:40:19 -04:00
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
2014-12-15 03:05:31 -05:00
if ( SplineComp ! = nullptr )
2014-07-23 09:40:19 -04:00
{
2014-12-15 03:05:31 -05:00
for ( int32 SelectedKeyIndex : SelectedKeys )
{
const auto & Point = SplineComp - > SplineInfo . Points [ SelectedKeyIndex ] ;
if ( Point . IsCurveKey ( ) )
{
MenuBuilder . AddSubMenu (
LOCTEXT ( " ResetToAutomaticTangent " , " Reset to Automatic Tangent " ) ,
LOCTEXT ( " ResetToAutomaticTangentTooltip " , " Reset the spline point tangent to an automatically generated value. " ) ,
FNewMenuDelegate : : CreateSP ( this , & FSplineComponentVisualizer : : GenerateTangentTypeSubMenu ) ) ;
break ;
}
}
2014-07-23 09:40:19 -04:00
}
2014-06-27 14:18:10 -04:00
}
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
MenuBuilder . EndSection ( ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
MenuBuilder . BeginSection ( " Spline " , LOCTEXT ( " Spline " , " Spline " ) ) ;
{
MenuBuilder . AddMenuEntry ( FSplineComponentVisualizerCommands : : Get ( ) . ResetToDefault ) ;
}
MenuBuilder . EndSection ( ) ;
MenuBuilder . BeginSection ( " Visualization " , LOCTEXT ( " Visualization " , " Visualization " ) ) ;
{
MenuBuilder . AddMenuEntry ( FSplineComponentVisualizerCommands : : Get ( ) . VisualizeRollAndScale ) ;
}
MenuBuilder . EndSection ( ) ;
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
}
TSharedPtr < SWidget > MenuWidget = MenuBuilder . MakeWidget ( ) ;
return MenuWidget ;
}
2014-06-27 14:18:10 -04:00
void FSplineComponentVisualizer : : GenerateSplinePointTypeSubMenu ( FMenuBuilder & MenuBuilder ) const
{
MenuBuilder . AddMenuEntry ( FSplineComponentVisualizerCommands : : Get ( ) . SetKeyToCurve ) ;
MenuBuilder . AddMenuEntry ( FSplineComponentVisualizerCommands : : Get ( ) . SetKeyToLinear ) ;
MenuBuilder . AddMenuEntry ( FSplineComponentVisualizerCommands : : Get ( ) . SetKeyToConstant ) ;
}
void FSplineComponentVisualizer : : GenerateTangentTypeSubMenu ( FMenuBuilder & MenuBuilder ) const
{
MenuBuilder . AddMenuEntry ( FSplineComponentVisualizerCommands : : Get ( ) . ResetToUnclampedTangent ) ;
MenuBuilder . AddMenuEntry ( FSplineComponentVisualizerCommands : : Get ( ) . ResetToClampedTangent ) ;
}
2014-06-11 00:20:55 -04:00
void FSplineComponentVisualizer : : NotifyComponentModified ( )
{
USplineComponent * SplineComp = GetEditedSplineComponent ( ) ;
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
SplineComp - > bSplineHasBeenEdited = true ;
Improvements to SplineComponent, and added a new way of handling UI Command Lists.
#add Added a new FUICommandList::ProcessCommandBindings overload, which can be called from a Viewport Client's InputKey() method (in the absence of an FKeyboardEvent object).
#add Fixed key binding handling in SplineComponentVisualizer so that it works through the FUICommandList, instead of being hardcoded.
#change USplineComponent - changed method by which spline reparam table is created (now uses the old method of splitting each segment into a fixed number of steps, instead of using fixed arc length reparameterization, which doesn't lead to such good results where the distance between control points varies largely throughout the spline). The ReparamStepsPerSegment parameter remains, although I'd like to remove it when I can hit upon a better way to adaptively step through the spline. Merged UpdateSplineReparamTable and AutoSetTangents into a single UpdateSpline method.
#add Added a parameter to FInterpCurve::AutoSetTangents - bStationaryEndpoints - which determines whether the endpoints should be assigned zero tangents, or whether the tangents should be set in order to extrapolate the curve beyond the endpoints, essentially providing a constant velocity at the start/end.
#add Added bStationaryEndpoints as an editable parameter to USplineComponent. Use this if you only wish to traverse the spline at constant velocity, as it will lead to more accurate results.
#codereview James.Golding, Michael.Noland
[CL 2112073 by Richard TalbotWatkin in Main branch]
2014-06-20 14:38:07 -04:00
SplineComp - > UpdateSpline ( ) ;
2014-06-11 00:20:55 -04:00
// Notify that the spline info has been modified
UProperty * SplineInfoProperty = FindField < UProperty > ( USplineComponent : : StaticClass ( ) , GET_MEMBER_NAME_CHECKED ( USplineComponent , SplineInfo ) ) ;
FPropertyChangedEvent PropertyChangedEvent ( SplineInfoProperty ) ;
SplineComp - > PostEditChangeProperty ( PropertyChangedEvent ) ;
// Notify of change so any CS is re-run
if ( SplineOwningActor . IsValid ( ) )
{
Big revamp to SplineComponent (continuing work-in-progress).
#jira UE-11822 - Add up vector, roll and scale properties to USplineComponent which can be used when calculating rotations/transforms at a point on the spline
#jira UE-13333 - BP spline components do not update when setting points
#jira UE-3637 - SplineComponent: Add a get transform at distance accessor
Summary of changes:
- FInterpCurve now natively understands looping. A input key can be set, at which point the spline will loop back to its start point. Adjusted FInterpCurve methods to take looped curves into account.
- Fixed bugs in FInterpCurve regarding returning default values (T(ForceInit) instead of T() otherwise FVectors and FQuats are not initialized correctly).
- SplineComponent now holds three separate splines (location, rotation and scale).
- The SplineReparamTable is no longer transient, but is built and saved as part of the asset.
- Changed the SplineComponent API. All methods now take a ESplineCoordinateSpace value which specifies whether the values are intended for use in local or world space. The old methods have been deprecated but not removed (for now).
- bAllowSplineEditingPerInstance is deprecated. A new member (bSplineHasBeenEdited) has superseded it, and is set automatically when editing the spline with the visualizer. Added "Reset to Default" option in the visualizer, which restores the archetype defaults.
- SplineComponentVisualizer determines if spline points have been initialized by the user construction script, and, if so, will disallow editing. This is to conform with the general idea that the UCS always overrides property values.
- Fixed a number of bugs in the visualizer, and added new facilities to allow the scale and rotation to be edited (still work-in-progress).
[CL 2524087 by Richard TalbotWatkin in Main branch]
2015-04-24 06:25:50 -04:00
SplineOwningActor . Get ( ) - > PostEditMove ( false ) ;
2014-06-11 00:20:55 -04:00
}
GEditor - > RedrawLevelEditingViewports ( true ) ;
}
Improvements to SplineComponent and its visualization.
#branch UE4
#proj Editor.ComponentVisualizers, Editor.UnrealEd, Runtime.Core, Runtime.Engine
#change FInterpCurve now uses a binary search to obtain the correct key. Removed the optional out-parameter on Eval, EvalDerivative, etc. Removed FORCEINLINEs on large methods.
#change USplineComponent now builds the remap table with points spaced at equal distances, which leads to better results. Added internal methods to obtain the segment length, and the interpolation parameter along the segment at a given distance.
#add Added Duration to USplineComponent.
#add Added a number of different methods for obtaining position, tangent and rotation at a specified distance, or a specified time (optionally at constant velocity).
#add Added methods for building the spline procedurally.
#add Supports right-click context menu on ComponentVisualizers in the standard interface.
#add Key tangents can be manually edited.
#change FLevelEditorViewportClient::ProcessClick now handles right clicks to the Unreal gizmo in the same manner as left clicks, i.e. the method recurses using a version of the hit proxy with the gizmo removed, so we can look at what's underneath. This allows for "genuine" context menus, i.e. depending on what was clicked, instead of using a single default provided by the current level editor.
#reviewedby James.Golding
[CL 2089561 by Richard TalbotWatkin in Main branch]
2014-05-30 07:58:16 -04:00
# undef LOCTEXT_NAMESPACE