You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3121996 on 2016/09/12 by Ben.Marsh
Add support for Visual Studio 2017 (aka "15"; assuming consistent naming with other versions until final name is announced).
* Compiler, STL implementation and CRT are binary compatible with VS2015 (see https://blogs.msdn.microsoft.com/vcblog/2016/08/24/c1417-features-and-stl-fixes-in-vs-15-preview-4/), so no new third-party libraries needed so far. WindowsPlatform.GetVisualStudioCompilerVersionName() returns "2015" as a result.
* Default compiler for compiling and generating project files is still VS 2015 for now. Pass -2017 on the command line to GenerateProjectFiles.bat to generate VS2017 projects. Projects generated for VS2017 will use the 2017 compiler by default.
* Visual Studio source code accessor can talk to VS 2017 instances.
* Added a VS2017 configuration for UnrealVS, and added precompiled vsix package.
* Switched GetVSComnTools to check the SOFTWARE\Microsoft\VisualStudio\SxS\VS7 registry key rather than the individual product install registry key. "15" doesn't seem to have it's own "InstallDir" key, but this system seems to work for all versions of Visual Studio (including previous releases of VS Express).
* Removed ATL dependency from VisualStudioSourceCodeAccessor. It's not installed with VS by default any more, and is only used for a couple of smart pointer classes.
Tested running the editor and packaging TP_Flying for Win64. Packaging from the editor still defaults to using the 2015 compiler, so ConfigureToolchain() needs to be overriden from the .target.cs file if multiple Visual Studio versions are installed.
Change 3189363 on 2016/11/07 by Ben.Marsh
Consolidate functionality for determining the path to MSBuild.exe to use for compiling UE4 tools into a single batch file (GetMSBuildToolPath) and fix "Clean" not working on PS4 due to include/library paths being set to something by the Visual Studio environment.
Change 3210598 on 2016/11/27 by Ben.Marsh
UBT: Prevent the name of each file compiled being output twice on XboxOne. Compiler already outputs this string; the action doesn't need to.
Change 3210601 on 2016/11/27 by Ben.Marsh
PR #2967: Add silent version of switch game version (Contributed by EricLeeFriedman)
Change 3210602 on 2016/11/27 by Ben.Marsh
PR #2964: GitDependencies shouldn't try to clean up working directory files that are excluded or ignored (Contributed by joelmcginnis)
Change 3210605 on 2016/11/27 by Ben.Marsh
UGS: Add a warning when syncing latest would remove changes that have been authored locally. Typically happens when working with precompiled binaries.
Change 3211656 on 2016/11/28 by Ben.Marsh
UBT: Move ModuleRules and TargetRules into their own file.
Change 3211797 on 2016/11/28 by Ben.Marsh
UBT: Remove utility functions from TargetRules for checking different classes of target types. Moving TargetRules to be data-only.
Change 3211833 on 2016/11/28 by Ben.Marsh
UBT: Remove overridable configuration name from target rules. This feature is not used anywhere.
Change 3211859 on 2016/11/28 by Ben.Marsh
UBT: Deprecate the GetGeneratedCodeVersion() callback in favor of a member variable instead.
Change 3211942 on 2016/11/28 by Ben.Marsh
UBT: Remove legacy code which tries to change the output paths for console binaries. Output paths for monolithic binaries are always in the project folder now.
Change 3215333 on 2016/11/30 by Ben.Marsh
UBT: Replace the GetSupportedPlatforms() callback on TargetRules with a SupportedPlatforms attribute. Since a TargetRules object can only be instantiated with an actual platform, it doesn't make sense for it to be an instance method.
Change 3215482 on 2016/11/30 by Ben.Marsh
UBT: Remove the GetSupportedConfigurations() callback on the TargetRules class. A configuration is required to construct a TargetRules instance, so it doesn't make sense to need to call an instance method to find out which configurations are supported.
Change 3215743 on 2016/11/30 by Ben.Marsh
UBT: Deprecate the TargetRules.ShouldCompileMonolithic() function: this function requires access to the global command line to operate correctly, which prevents creating target-specific instances, and does not use the platform/configuration passed into the TargetRules constructor.
Rather than being a callback, the LinkType field can now be set to TargetLinkType.Modular or TargetLinkType.Monolithic from the constructor as appropriate. The default value (TargetLinkType.Default) results in the default link type for the target type being used. Parsing of the command-line overrides is now done when building the TargetDescriptor.
Change 3215778 on 2016/11/30 by Ben.Marsh
UBT: Mark overrides of the TargetRules.GetModulesToPrecompile method as obsolete.
Change 3217681 on 2016/12/01 by Ben.Marsh
UAT: Prevent UE4Build deleting .modules files when running with the -Clean argument; these files are artifacts generated by UBT itself, not by the exported XGE script.
Change 3217723 on 2016/12/01 by Ben.Marsh
UBT: Run pre- and post-build steps for all plugins that are being built, not just those that are enabled.
Change 3217930 on 2016/12/01 by Ben.Marsh
UGS: Add a perforce settings window, allowing users to set optional values for tuning Perforce performance on unreliable connections.
Change 3218762 on 2016/12/02 by Ben.Marsh
Enable warnings whenever an undefined macro is used in a constant expression inside an #if or #elif directive, and fix existing violations.
Change 3219161 on 2016/12/02 by Ben.Marsh
Core: Use the directory containing the current module to derive the UE4 base directory, rather than the executable directory. Allows UE4 to be hosted by a process in a different directory.
Change 3219197 on 2016/12/02 by Ben.Marsh
Core: When loading a DLL from disk, convert any relative paths to absolute before calling LoadLibrary. The OS resolves these paths relative to the directory containing the process executable -- not the working directory -- so paths need to be absolute to allow UE4 to be hosted by a process elsewhere.
Change 3219209 on 2016/12/02 by Ben.Marsh
Replace some calls to LoadLibrary() with FPlatformProcess::GetDllHandle(). The UE4 function makes sure that relative paths are resolved relative to the correct base directory, which is important when the host executable is not in Engine/Binaries/Win64.
Change 3219610 on 2016/12/02 by Ben.Marsh
Add the -q (quiet) option to the Mac unzip command, since it's creating too much log output to be useful.
Change 3219731 on 2016/12/02 by Ben.Marsh
UBT: Add option to disable IWYU checks regarding the use of monolithic headers (Engine.h, UnrealEd.h, etc...) and including the matching header for a cpp file first. bEnforceIWYU can be set to false in UEBuildConfiguration or on a per-module basis in the module rules.
Change 3220796 on 2016/12/04 by Ben.Marsh
Remove PrepForUATPackageOrDeploy from the UEBuildDeploy base class. It never has to be accessed through the base class anyway.
Change 3220825 on 2016/12/04 by Ben.Marsh
UBT: Change all executors to derive from a common base class (ActionExecutor).
Change 3220834 on 2016/12/04 by Ben.Marsh
UBT: Remove the global CommandLineContains() function.
Change 3222706 on 2016/12/05 by Ben.Marsh
Merging CL 3221949 from //UE4/Release-4.14: Fixes to code analysis template causing problems with stock install of VS2017.
Change 3222712 on 2016/12/05 by Ben.Marsh
Merging CL 3222021 from //UE4/Release-4.14: Change detection of MSBuild.exe path to match GetMSBuildPath.bat
Change 3223628 on 2016/12/06 by Ben.Marsh
Merging CL 3223369 from 4.14 branch: Use the same logic as GetMsBuildPath.bat inside FDesktopPlatformBase to determine path to MSBuild.exe
Change 3223817 on 2016/12/06 by Ben.Marsh
Remove non-ANSI characters from source files. Compiler/P4 support is patchy for this, and we want to avoid failing prey to different codepages resulting in different interpretations of the source text.
Change 3224046 on 2016/12/06 by Ben.Marsh
Remove the need for the iOS/TVOS deployment instances to have an IOSPlatformContext instance. The only dependency between the two -- a call to GetRequiredCapabilities() -- is now implemented by querying the INI file for the supported architectures when neeeded.
Change 3224792 on 2016/12/07 by Ben.Marsh
UBT: Touch PCH wrapper files whenever the file they include is newer rather than writing the timestamp for the included file into it as a comment. Allows use of ccache and similar tools.
Change 3225212 on 2016/12/07 by Ben.Marsh
UBT: Move settings required for deployment into the UEBuildDeployTarget class, allowing them to be serialized to and from a file the intermediate directory without having to construct a phony UEBuildTarget to deploy.
Deployment is now performed by a method on UEBuildPlatform, rather than having to create a UEBuildPlatformContext and using that to create a UEBuildDeploy object.
The -prepfordeploy UBT invocation from UAT, previously done by the per-platform PostBuildTarget() callback when building with XGE, is replaced by running UBT with a path to the serialized UEBuildDeployTarget object, and can be done in a platform agnostic manner.
Change 3226310 on 2016/12/07 by Ben.Marsh
PR #3015: Fixes wrong VSC++ flags being passed for .c files (Contributed by badlogic)
Change 3228273 on 2016/12/08 by Ben.Marsh
Update copyright notices for QAGame.
Change 3229166 on 2016/12/09 by Ben.Marsh
UBT: Rewritten config file parser. No longer requires hard-coded list of sections to be parsed, but parses them on demand. Measured 2x faster read speeds (largely due to eliminating construction of temporary string objects when parsing each line, to trim whitespace and so on). Also includes an attribute-driven parser, which allows reading named config values for marked up fields in an object.
Change 3230601 on 2016/12/12 by Ben.Marsh
Swarm: Change Swarm AgentInterface to target .NET framework 4.5, to remove dependency on having 4.0 framework installed.
Change 3230737 on 2016/12/12 by Ben.Marsh
UAT: Stop UE4Build deriving from CommandUtils. Confusing pattern, and causes problems trying to access instance variables that are only set for build commands.
Change 3230751 on 2016/12/12 by Ben.Marsh
UAT: Move ParseParam*() functions which use the instanced parameter list from CommandUtils to BuildCommand, since that's the only thing that it's instanced for.
Change 3230804 on 2016/12/12 by Ben.Marsh
UBT: Add the IsPromotedBuild flag to Build.version, and only set the bFormalBuild flag in UBT if it's set. This allows UGS users to avoid having to compile separate RC files for each output binary.
Change 3230831 on 2016/12/12 by Ben.Marsh
UGS: Warn when trying to switch streams if files are checked out.
Change 3231281 on 2016/12/12 by Chad.Garyet
Fixing a bug where .modules files were getting put into receipts with their absolute path instead of their relative one
Change 3231496 on 2016/12/12 by Ben.Marsh
Disable code analysis in CrashReportProcess; causes warnings when compiled with VS2015.
Change 3231979 on 2016/12/12 by Ben.Marsh
UBT: Suppress LNK4221 when generating import libraries. This can happen often when generating import libraries separately to linking.
Change 3232619 on 2016/12/13 by Ben.Marsh
Fix "#pragma once in main file" errors on Mac, which are occurring in //UE4/Main.
[CL 3232653 by Ben Marsh in Main branch]
1301 lines
44 KiB
C++
1301 lines
44 KiB
C++
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SplineComponentVisualizer.h"
|
|
#include "Framework/Application/SlateApplication.h"
|
|
#include "Framework/Commands/InputChord.h"
|
|
#include "Framework/Commands/Commands.h"
|
|
#include "Framework/Commands/UICommandList.h"
|
|
#include "Framework/MultiBox/MultiBoxBuilder.h"
|
|
#include "EditorStyleSet.h"
|
|
#include "UnrealWidget.h"
|
|
#include "Editor.h"
|
|
#include "EditorViewportClient.h"
|
|
#include "Components/SplineComponent.h"
|
|
#include "ScopedTransaction.h"
|
|
#include "ActorEditorUtils.h"
|
|
|
|
IMPLEMENT_HIT_PROXY(HSplineVisProxy, HComponentVisProxy);
|
|
IMPLEMENT_HIT_PROXY(HSplineKeyProxy, HSplineVisProxy);
|
|
IMPLEMENT_HIT_PROXY(HSplineSegmentProxy, HSplineVisProxy);
|
|
IMPLEMENT_HIT_PROXY(HSplineTangentHandleProxy, HSplineVisProxy);
|
|
|
|
#define LOCTEXT_NAMESPACE "SplineComponentVisualizer"
|
|
|
|
#define VISUALIZE_SPLINE_UPVECTORS 0
|
|
|
|
/** 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()
|
|
)
|
|
{
|
|
}
|
|
|
|
virtual void RegisterCommands() override
|
|
{
|
|
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());
|
|
UI_COMMAND(VisualizeRollAndScale, "Visualize Roll and Scale", "Whether the visualization should show roll and scale on this spline.", EUserInterfaceActionType::ToggleButton, FInputChord());
|
|
UI_COMMAND(DiscontinuousSpline, "Allow Discontinuous Splines", "Whether the visualization allows Arrive and Leave tangents to be set separately.", EUserInterfaceActionType::ToggleButton, FInputChord());
|
|
UI_COMMAND(ResetToDefault, "Reset to Default", "Reset this spline to its archetype default.", EUserInterfaceActionType::Button, FInputChord());
|
|
}
|
|
|
|
public:
|
|
/** Delete key */
|
|
TSharedPtr<FUICommandInfo> DeleteKey;
|
|
|
|
/** Duplicate key */
|
|
TSharedPtr<FUICommandInfo> DuplicateKey;
|
|
|
|
/** Add key */
|
|
TSharedPtr<FUICommandInfo> AddKey;
|
|
|
|
/** 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;
|
|
|
|
/** Whether the visualization should show roll and scale */
|
|
TSharedPtr<FUICommandInfo> VisualizeRollAndScale;
|
|
|
|
/** Whether we allow separate Arrive / Leave tangents, resulting in a discontinuous spline */
|
|
TSharedPtr<FUICommandInfo> DiscontinuousSpline;
|
|
|
|
/** Reset this spline to its default */
|
|
TSharedPtr<FUICommandInfo> ResetToDefault;
|
|
};
|
|
|
|
|
|
|
|
FSplineComponentVisualizer::FSplineComponentVisualizer()
|
|
: FComponentVisualizer()
|
|
, LastKeyIndexSelected(INDEX_NONE)
|
|
, SelectedSegmentIndex(INDEX_NONE)
|
|
, SelectedTangentHandle(INDEX_NONE)
|
|
, SelectedTangentHandleType(ESelectedTangentHandle::None)
|
|
, bAllowDuplication(true)
|
|
{
|
|
FSplineComponentVisualizerCommands::Register();
|
|
|
|
SplineComponentVisualizerActions = MakeShareable(new FUICommandList);
|
|
|
|
SplineCurvesProperty = FindField<UProperty>(USplineComponent::StaticClass(), GET_MEMBER_NAME_CHECKED(USplineComponent, SplineCurves));
|
|
}
|
|
|
|
void FSplineComponentVisualizer::OnRegister()
|
|
{
|
|
const auto& Commands = FSplineComponentVisualizerCommands::Get();
|
|
|
|
SplineComponentVisualizerActions->MapAction(
|
|
Commands.DeleteKey,
|
|
FExecuteAction::CreateSP(this, &FSplineComponentVisualizer::OnDeleteKey),
|
|
FCanExecuteAction::CreateSP(this, &FSplineComponentVisualizer::CanDeleteKey));
|
|
|
|
SplineComponentVisualizerActions->MapAction(
|
|
Commands.DuplicateKey,
|
|
FExecuteAction::CreateSP(this, &FSplineComponentVisualizer::OnDuplicateKey),
|
|
FCanExecuteAction::CreateSP(this, &FSplineComponentVisualizer::IsKeySelectionValid));
|
|
|
|
SplineComponentVisualizerActions->MapAction(
|
|
Commands.AddKey,
|
|
FExecuteAction::CreateSP(this, &FSplineComponentVisualizer::OnAddKey),
|
|
FCanExecuteAction::CreateSP(this, &FSplineComponentVisualizer::CanAddKey));
|
|
|
|
SplineComponentVisualizerActions->MapAction(
|
|
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));
|
|
|
|
SplineComponentVisualizerActions->MapAction(
|
|
Commands.VisualizeRollAndScale,
|
|
FExecuteAction::CreateSP(this, &FSplineComponentVisualizer::OnSetVisualizeRollAndScale),
|
|
FCanExecuteAction(),
|
|
FIsActionChecked::CreateSP(this, &FSplineComponentVisualizer::IsVisualizingRollAndScale));
|
|
|
|
SplineComponentVisualizerActions->MapAction(
|
|
Commands.DiscontinuousSpline,
|
|
FExecuteAction::CreateSP(this, &FSplineComponentVisualizer::OnSetDiscontinuousSpline),
|
|
FCanExecuteAction(),
|
|
FIsActionChecked::CreateSP(this, &FSplineComponentVisualizer::IsDiscontinuousSpline));
|
|
|
|
SplineComponentVisualizerActions->MapAction(
|
|
Commands.ResetToDefault,
|
|
FExecuteAction::CreateSP(this, &FSplineComponentVisualizer::OnResetToDefault),
|
|
FCanExecuteAction::CreateSP(this, &FSplineComponentVisualizer::CanResetToDefault));
|
|
}
|
|
|
|
FSplineComponentVisualizer::~FSplineComponentVisualizer()
|
|
{
|
|
FSplineComponentVisualizerCommands::Unregister();
|
|
}
|
|
|
|
static float GetDashSize(const FSceneView* View, const FVector& Start, const FVector& End, float Scale)
|
|
{
|
|
const float StartW = View->WorldToScreen(Start).W;
|
|
const float EndW = View->WorldToScreen(End).W;
|
|
|
|
const float WLimit = 10.0f;
|
|
if (StartW > WLimit || EndW > WLimit)
|
|
{
|
|
return FMath::Max(StartW, EndW) * Scale;
|
|
}
|
|
|
|
return 0.0f;
|
|
}
|
|
|
|
void FSplineComponentVisualizer::DrawVisualization(const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI)
|
|
{
|
|
if (const USplineComponent* SplineComp = Cast<const USplineComponent>(Component))
|
|
{
|
|
const FInterpCurveVector& SplineInfo = SplineComp->GetSplinePointsPosition();
|
|
const USplineComponent* EditedSplineComp = GetEditedSplineComponent();
|
|
|
|
const USplineComponent* Archetype = CastChecked<USplineComponent>(SplineComp->GetArchetype());
|
|
const bool bIsSplineEditable = !SplineComp->bModifiedByConstructionScript; // bSplineHasBeenEdited || SplineInfo == Archetype->SplineCurves.Position || SplineComp->bInputSplinePointsToConstructionScript;
|
|
|
|
const FColor ReadOnlyColor = FColor(255, 0, 255, 255);
|
|
const FColor NormalColor = bIsSplineEditable ? FColor(SplineComp->EditorUnselectedSplineSegmentColor.ToFColor(true)) : ReadOnlyColor;
|
|
const FColor SelectedColor = bIsSplineEditable ? FColor(SplineComp->EditorSelectedSplineSegmentColor.ToFColor(true)) : ReadOnlyColor;
|
|
const float GrabHandleSize = 12.0f;
|
|
const float TangentHandleSize = 10.0f;
|
|
|
|
// Draw the tangent handles before anything else so they will not overdraw the rest of the spline
|
|
if (SplineComp == EditedSplineComp)
|
|
{
|
|
for (int32 SelectedKey : SelectedKeys)
|
|
{
|
|
if (SplineInfo.Points[SelectedKey].IsCurveKey())
|
|
{
|
|
const FVector Location = SplineComp->GetLocationAtSplinePoint(SelectedKey, ESplineCoordinateSpace::World);
|
|
const FVector LeaveTangent = SplineComp->GetLeaveTangentAtSplinePoint(SelectedKey, ESplineCoordinateSpace::World);
|
|
const FVector ArriveTangent = SplineComp->bAllowDiscontinuousSpline ?
|
|
SplineComp->GetArriveTangentAtSplinePoint(SelectedKey, ESplineCoordinateSpace::World) : LeaveTangent;
|
|
|
|
PDI->SetHitProxy(NULL);
|
|
|
|
const float DashSize1 = GetDashSize(View, Location, Location + LeaveTangent, 0.01f);
|
|
if (DashSize1 > 0.0f)
|
|
{
|
|
DrawDashedLine(PDI, Location, Location + LeaveTangent, SelectedColor, DashSize1, SDPG_Foreground);
|
|
}
|
|
|
|
const float DashSize2 = GetDashSize(View, Location, Location - ArriveTangent, 0.01f);
|
|
if (DashSize2 > 0.0f)
|
|
{
|
|
DrawDashedLine(PDI, Location, Location - ArriveTangent, SelectedColor, DashSize2, SDPG_Foreground);
|
|
}
|
|
|
|
if (bIsSplineEditable)
|
|
{
|
|
PDI->SetHitProxy(new HSplineTangentHandleProxy(Component, SelectedKey, false));
|
|
}
|
|
PDI->DrawPoint(Location + LeaveTangent, SelectedColor, TangentHandleSize, SDPG_Foreground);
|
|
|
|
if (bIsSplineEditable)
|
|
{
|
|
PDI->SetHitProxy(new HSplineTangentHandleProxy(Component, SelectedKey, true));
|
|
}
|
|
PDI->DrawPoint(Location - ArriveTangent, SelectedColor, TangentHandleSize, SDPG_Foreground);
|
|
|
|
PDI->SetHitProxy(NULL);
|
|
}
|
|
}
|
|
}
|
|
|
|
const bool bShouldVisualizeScale = SplineComp->bShouldVisualizeScale;
|
|
const float DefaultScale = SplineComp->ScaleVisualizationWidth;
|
|
|
|
FVector OldKeyPos(0);
|
|
FVector OldKeyRightVector(0);
|
|
FVector OldKeyScale(0);
|
|
|
|
const int32 NumPoints = SplineInfo.Points.Num();
|
|
const int32 NumSegments = SplineInfo.bIsLooped ? NumPoints : NumPoints - 1;
|
|
for (int32 KeyIdx = 0; KeyIdx < NumSegments + 1; KeyIdx++)
|
|
{
|
|
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;
|
|
|
|
const FColor KeyColor = (SplineComp == EditedSplineComp && SelectedKeys.Contains(KeyIdx)) ? SelectedColor : NormalColor;
|
|
|
|
// Draw the keypoint and up/right vectors
|
|
if (KeyIdx < NumPoints)
|
|
{
|
|
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));
|
|
}
|
|
PDI->DrawPoint(NewKeyPos, KeyColor, GrabHandleSize, SDPG_Foreground);
|
|
PDI->SetHitProxy(NULL);
|
|
}
|
|
|
|
// If not the first keypoint, draw a line to the previous keypoint.
|
|
if (KeyIdx > 0)
|
|
{
|
|
const FColor LineColor = (SplineComp == EditedSplineComp && SelectedKeys.Contains(KeyIdx - 1)) ? SelectedColor : NormalColor;
|
|
if (bIsSplineEditable)
|
|
{
|
|
PDI->SetHitProxy(new HSplineSegmentProxy(Component, KeyIdx - 1));
|
|
}
|
|
|
|
// For constant interpolation - don't draw ticks - just draw dotted line.
|
|
if (SplineInfo.Points[KeyIdx - 1].InterpMode == CIM_Constant)
|
|
{
|
|
const float DashSize = GetDashSize(View, OldKeyPos, NewKeyPos, 0.03f);
|
|
if (DashSize > 0.0f)
|
|
{
|
|
DrawDashedLine(PDI, OldKeyPos, NewKeyPos, LineColor, DashSize, SDPG_World);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Find position on first keyframe.
|
|
FVector OldPos = OldKeyPos;
|
|
FVector OldRightVector = OldKeyRightVector;
|
|
FVector OldScale = OldKeyScale;
|
|
|
|
// Then draw a line for each substep.
|
|
const int32 NumSteps = 20;
|
|
|
|
for (int32 StepIdx = 1; StepIdx <= NumSteps; StepIdx++)
|
|
{
|
|
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;
|
|
|
|
PDI->DrawLine(OldPos, NewPos, LineColor, SDPG_Foreground);
|
|
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);
|
|
|
|
#if VISUALIZE_SPLINE_UPVECTORS
|
|
const FVector NewUpVector = SplineComp->GetUpVectorAtSplineInputKey(Key, ESplineCoordinateSpace::World);
|
|
PDI->DrawLine(NewPos, NewPos + NewUpVector * SplineComp->ScaleVisualizationWidth * 0.5f, LineColor, SDPG_Foreground);
|
|
PDI->DrawLine(NewPos, NewPos + NewRightVector * SplineComp->ScaleVisualizationWidth * 0.5f, LineColor, SDPG_Foreground);
|
|
#endif
|
|
}
|
|
|
|
OldPos = NewPos;
|
|
OldRightVector = NewRightVector;
|
|
OldScale = NewScale;
|
|
}
|
|
}
|
|
|
|
PDI->SetHitProxy(NULL);
|
|
}
|
|
|
|
OldKeyPos = NewKeyPos;
|
|
OldKeyRightVector = NewKeyRightVector;
|
|
OldKeyScale = NewKeyScale;
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
|
|
bool FSplineComponentVisualizer::VisProxyHandleClick(FEditorViewportClient* InViewportClient, HComponentVisProxy* VisProxy, const FViewportClick& Click)
|
|
{
|
|
if(VisProxy && VisProxy->Component.IsValid())
|
|
{
|
|
const USplineComponent* SplineComp = CastChecked<const USplineComponent>(VisProxy->Component.Get());
|
|
|
|
SplineCompPropName = GetComponentPropertyName(SplineComp);
|
|
if(SplineCompPropName.IsValid())
|
|
{
|
|
AActor* OldSplineOwningActor = SplineOwningActor.Get();
|
|
SplineOwningActor = SplineComp->GetOwner();
|
|
|
|
if (OldSplineOwningActor != SplineOwningActor)
|
|
{
|
|
// Reset selection state if we are selecting a different actor to the one previously selected
|
|
ChangeSelectionState(INDEX_NONE, false);
|
|
SelectedSegmentIndex = INDEX_NONE;
|
|
SelectedTangentHandle = INDEX_NONE;
|
|
SelectedTangentHandleType = ESelectedTangentHandle::None;
|
|
}
|
|
|
|
if (VisProxy->IsA(HSplineKeyProxy::StaticGetType()))
|
|
{
|
|
// Control point clicked
|
|
|
|
HSplineKeyProxy* KeyProxy = (HSplineKeyProxy*)VisProxy;
|
|
|
|
// 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());
|
|
}
|
|
SelectedSegmentIndex = INDEX_NONE;
|
|
SelectedTangentHandle = INDEX_NONE;
|
|
SelectedTangentHandleType = ESelectedTangentHandle::None;
|
|
|
|
if (LastKeyIndexSelected == INDEX_NONE)
|
|
{
|
|
SplineOwningActor = nullptr;
|
|
return false;
|
|
}
|
|
|
|
CachedRotation = SplineComp->GetQuaternionAtSplinePoint(LastKeyIndexSelected, ESplineCoordinateSpace::World);
|
|
|
|
return true;
|
|
}
|
|
else if (VisProxy->IsA(HSplineSegmentProxy::StaticGetType()))
|
|
{
|
|
// Spline segment clicked
|
|
|
|
// 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;
|
|
ChangeSelectionState(SegmentProxy->SegmentIndex, InViewportClient->IsCtrlPressed());
|
|
SelectedSegmentIndex = SegmentProxy->SegmentIndex;
|
|
SelectedTangentHandle = INDEX_NONE;
|
|
SelectedTangentHandleType = ESelectedTangentHandle::None;
|
|
|
|
if (LastKeyIndexSelected == INDEX_NONE)
|
|
{
|
|
SplineOwningActor = nullptr;
|
|
return false;
|
|
}
|
|
|
|
CachedRotation = SplineComp->GetQuaternionAtSplinePoint(LastKeyIndexSelected, ESplineCoordinateSpace::World);
|
|
|
|
float SubsegmentStartKey = static_cast<float>(SelectedSegmentIndex);
|
|
FVector SubsegmentStart = SplineComp->GetLocationAtSplineInputKey(SubsegmentStartKey, ESplineCoordinateSpace::World);
|
|
|
|
float ClosestDistance = TNumericLimits<float>::Max();
|
|
FVector BestLocation = SubsegmentStart;
|
|
|
|
for (int32 Step = 1; Step < NumSubdivisions; Step++)
|
|
{
|
|
const float SubsegmentEndKey = SelectedSegmentIndex + Step / static_cast<float>(NumSubdivisions);
|
|
const FVector SubsegmentEnd = SplineComp->GetLocationAtSplineInputKey(SubsegmentEndKey, ESplineCoordinateSpace::World);
|
|
|
|
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;
|
|
|
|
return true;
|
|
}
|
|
else if (VisProxy->IsA(HSplineTangentHandleProxy::StaticGetType()))
|
|
{
|
|
// Tangent handle clicked
|
|
|
|
HSplineTangentHandleProxy* KeyProxy = (HSplineTangentHandleProxy*)VisProxy;
|
|
|
|
// Note: don't change key selection when a tangent handle is clicked
|
|
SelectedSegmentIndex = INDEX_NONE;
|
|
SelectedTangentHandle = KeyProxy->KeyIndex;
|
|
SelectedTangentHandleType = KeyProxy->bArriveTangent ? ESelectedTangentHandle::Arrive : ESelectedTangentHandle::Leave;
|
|
|
|
CachedRotation = SplineComp->GetQuaternionAtSplinePoint(SelectedTangentHandle, ESplineCoordinateSpace::World);
|
|
|
|
return true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
SplineOwningActor = nullptr;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
USplineComponent* FSplineComponentVisualizer::GetEditedSplineComponent() const
|
|
{
|
|
return Cast<USplineComponent>(GetComponentFromPropertyName(SplineOwningActor.Get(), SplineCompPropName));
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::GetWidgetLocation(const FEditorViewportClient* ViewportClient, FVector& OutLocation) const
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
if (SplineComp != nullptr)
|
|
{
|
|
const FInterpCurveVector& Position = SplineComp->GetSplinePointsPosition();
|
|
|
|
if (SelectedTangentHandle != INDEX_NONE)
|
|
{
|
|
// If tangent handle index is set, use that
|
|
check(SelectedTangentHandle < Position.Points.Num());
|
|
const auto& Point = Position.Points[SelectedTangentHandle];
|
|
|
|
check(SelectedTangentHandleType != ESelectedTangentHandle::None);
|
|
if (SelectedTangentHandleType == ESelectedTangentHandle::Leave)
|
|
{
|
|
OutLocation = SplineComp->ComponentToWorld.TransformPosition(Point.OutVal + Point.LeaveTangent);
|
|
}
|
|
else if (SelectedTangentHandleType == ESelectedTangentHandle::Arrive)
|
|
{
|
|
OutLocation = SplineComp->ComponentToWorld.TransformPosition(Point.OutVal - Point.ArriveTangent);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
else if (LastKeyIndexSelected != INDEX_NONE)
|
|
{
|
|
// Otherwise use the last key index set
|
|
check(LastKeyIndexSelected < Position.Points.Num());
|
|
check(SelectedKeys.Contains(LastKeyIndexSelected));
|
|
const auto& Point = Position.Points[LastKeyIndexSelected];
|
|
OutLocation = SplineComp->ComponentToWorld.TransformPosition(Point.OutVal);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::GetCustomInputCoordinateSystem(const FEditorViewportClient* ViewportClient, FMatrix& OutMatrix) const
|
|
{
|
|
if (ViewportClient->GetWidgetCoordSystemSpace() == COORD_Local || ViewportClient->GetWidgetMode() == FWidget::WM_Rotate)
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
if (SplineComp != nullptr)
|
|
{
|
|
OutMatrix = FRotationMatrix::Make(CachedRotation);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::IsVisualizingArchetype() const
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
return (SplineComp && SplineComp->GetOwner() && FActorEditorUtils::IsAPreviewOrInactiveActor(SplineComp->GetOwner()));
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::HandleInputDelta(FEditorViewportClient* ViewportClient, FViewport* Viewport, FVector& DeltaTranslate, FRotator& DeltaRotate, FVector& DeltaScale)
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
if (SplineComp != nullptr)
|
|
{
|
|
FInterpCurveVector& SplinePosition = SplineComp->GetSplinePointsPosition();
|
|
FInterpCurveQuat& SplineRotation = SplineComp->GetSplinePointsRotation();
|
|
FInterpCurveVector& SplineScale = SplineComp->GetSplinePointsScale();
|
|
|
|
const int32 NumPoints = SplinePosition.Points.Num();
|
|
|
|
if (SelectedTangentHandle != INDEX_NONE)
|
|
{
|
|
// When tangent handles are manipulated...
|
|
|
|
check(SelectedTangentHandle < NumPoints);
|
|
|
|
if (!DeltaTranslate.IsZero())
|
|
{
|
|
check(SelectedTangentHandleType != ESelectedTangentHandle::None);
|
|
|
|
SplineComp->Modify();
|
|
|
|
FInterpCurvePoint<FVector>& EditedPoint = SplinePosition.Points[SelectedTangentHandle];
|
|
if (SplineComp->bAllowDiscontinuousSpline)
|
|
{
|
|
if (SelectedTangentHandleType == ESelectedTangentHandle::Leave)
|
|
{
|
|
EditedPoint.LeaveTangent += SplineComp->ComponentToWorld.InverseTransformVector(DeltaTranslate);
|
|
}
|
|
else
|
|
{
|
|
EditedPoint.ArriveTangent += SplineComp->ComponentToWorld.InverseTransformVector(-DeltaTranslate);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// When spline keys are manipulated...
|
|
|
|
check(LastKeyIndexSelected != INDEX_NONE);
|
|
check(LastKeyIndexSelected < NumPoints);
|
|
check(SelectedKeys.Num() > 0);
|
|
|
|
SplineComp->Modify();
|
|
|
|
if (ViewportClient->IsAltPressed() && bAllowDuplication)
|
|
{
|
|
DuplicateKey();
|
|
|
|
// Don't duplicate again until we release LMB
|
|
bAllowDuplication = false;
|
|
}
|
|
|
|
for (int32 SelectedKeyIndex : SelectedKeys)
|
|
{
|
|
FInterpCurvePoint<FVector>& EditedPoint = SplinePosition.Points[SelectedKeyIndex];
|
|
FInterpCurvePoint<FQuat>& EditedRotPoint = SplineRotation.Points[SelectedKeyIndex];
|
|
FInterpCurvePoint<FVector>& EditedScalePoint = SplineScale.Points[SelectedKeyIndex];
|
|
|
|
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
|
|
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
|
|
EditedPoint.LeaveTangent = NewTangent;
|
|
EditedPoint.ArriveTangent = NewTangent;
|
|
|
|
// 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;
|
|
}
|
|
|
|
if (DeltaScale.X != 0.0f)
|
|
{
|
|
// Set point tangent as user controlled
|
|
EditedPoint.InterpMode = CIM_CurveUser;
|
|
|
|
const FVector NewTangent = EditedPoint.LeaveTangent * (1.0f + DeltaScale.X);
|
|
EditedPoint.LeaveTangent = NewTangent;
|
|
EditedPoint.ArriveTangent = NewTangent;
|
|
}
|
|
|
|
if (DeltaScale.Y != 0.0f)
|
|
{
|
|
// 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);
|
|
}
|
|
}
|
|
}
|
|
|
|
SplineComp->UpdateSpline();
|
|
SplineComp->bSplineHasBeenEdited = true;
|
|
|
|
NotifyPropertyModified(SplineComp, SplineCurvesProperty);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
bool FSplineComponentVisualizer::HandleInputKey(FEditorViewportClient* ViewportClient, FViewport* Viewport, FKey Key, EInputEvent Event)
|
|
{
|
|
bool bHandled = false;
|
|
|
|
if (Key == EKeys::LeftMouseButton && Event == IE_Released)
|
|
{
|
|
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);
|
|
}
|
|
|
|
// Reset duplication flag on LMB release
|
|
bAllowDuplication = true;
|
|
}
|
|
|
|
if (Event == IE_Pressed)
|
|
{
|
|
bHandled = SplineComponentVisualizerActions->ProcessCommandBindings(Key, FSlateApplication::Get().GetModifierKeys(), false);
|
|
}
|
|
|
|
return bHandled;
|
|
}
|
|
|
|
|
|
void FSplineComponentVisualizer::EndEditing()
|
|
{
|
|
SplineOwningActor = NULL;
|
|
SplineCompPropName.Clear();
|
|
ChangeSelectionState(INDEX_NONE, false);
|
|
SelectedSegmentIndex = INDEX_NONE;
|
|
SelectedTangentHandle = INDEX_NONE;
|
|
SelectedTangentHandleType = ESelectedTangentHandle::None;
|
|
}
|
|
|
|
|
|
void FSplineComponentVisualizer::OnDuplicateKey()
|
|
{
|
|
const FScopedTransaction Transaction(LOCTEXT("DuplicateSplinePoint", "Duplicate Spline Point"));
|
|
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
DuplicateKey();
|
|
|
|
SplineComp->UpdateSpline();
|
|
SplineComp->bSplineHasBeenEdited = true;
|
|
|
|
NotifyPropertyModified(SplineComp, SplineCurvesProperty);
|
|
}
|
|
|
|
|
|
void FSplineComponentVisualizer::DuplicateKey()
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
check(SplineComp != nullptr);
|
|
check(LastKeyIndexSelected != INDEX_NONE);
|
|
check(SelectedKeys.Num() > 0);
|
|
check(SelectedKeys.Contains(LastKeyIndexSelected));
|
|
|
|
SplineComp->Modify();
|
|
if (AActor* Owner = SplineComp->GetOwner())
|
|
{
|
|
Owner->Modify();
|
|
}
|
|
|
|
// 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
|
|
FInterpCurveVector& SplinePosition = SplineComp->SplineCurves.Position;
|
|
FInterpCurveQuat& SplineRotation = SplineComp->SplineCurves.Rotation;
|
|
FInterpCurveVector& SplineScale = SplineComp->SplineCurves.Scale;
|
|
|
|
for (int32 SelectedKeyIndex : SelectedKeysSorted)
|
|
{
|
|
// 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)
|
|
SplinePosition.Points.Insert(FInterpCurvePoint<FVector>(SplinePosition.Points[SelectedKeyIndex]), SelectedKeyIndex);
|
|
SplineRotation.Points.Insert(FInterpCurvePoint<FQuat>(SplineRotation.Points[SelectedKeyIndex]), SelectedKeyIndex);
|
|
SplineScale.Points.Insert(FInterpCurvePoint<FVector>(SplineScale.Points[SelectedKeyIndex]), SelectedKeyIndex);
|
|
|
|
// Adjust input keys of subsequent points
|
|
for (int Index = SelectedKeyIndex + 1; Index < SplinePosition.Points.Num(); Index++)
|
|
{
|
|
SplinePosition.Points[Index].InVal += 1.0f;
|
|
SplineRotation.Points[Index].InVal += 1.0f;
|
|
SplineScale.Points[Index].InVal += 1.0f;
|
|
}
|
|
}
|
|
|
|
// 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;
|
|
|
|
GEditor->RedrawLevelEditingViewports(true);
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::CanAddKey() const
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
if (SplineComp == nullptr)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
const int32 NumPoints = SplineComp->SplineCurves.Position.Points.Num();
|
|
const int32 NumSegments = SplineComp->IsClosedLoop() ? NumPoints : NumPoints - 1;
|
|
|
|
return (SelectedSegmentIndex != INDEX_NONE && SelectedSegmentIndex < NumSegments);
|
|
}
|
|
|
|
|
|
void FSplineComponentVisualizer::OnAddKey()
|
|
{
|
|
const FScopedTransaction Transaction(LOCTEXT("AddSplinePoint", "Add Spline Point"));
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
check(SplineComp != nullptr);
|
|
check(LastKeyIndexSelected != INDEX_NONE);
|
|
check(SelectedKeys.Num() > 0);
|
|
check(SelectedKeys.Contains(LastKeyIndexSelected));
|
|
check(SelectedTangentHandle == INDEX_NONE);
|
|
check(SelectedTangentHandleType == ESelectedTangentHandle::None);
|
|
|
|
SplineComp->Modify();
|
|
if (AActor* Owner = SplineComp->GetOwner())
|
|
{
|
|
Owner->Modify();
|
|
}
|
|
|
|
FInterpCurveVector& SplinePosition = SplineComp->GetSplinePointsPosition();
|
|
FInterpCurveQuat& SplineRotation = SplineComp->GetSplinePointsRotation();
|
|
FInterpCurveVector& SplineScale = SplineComp->GetSplinePointsScale();
|
|
|
|
FInterpCurvePoint<FVector> NewPoint(
|
|
SelectedSegmentIndex,
|
|
SplineComp->ComponentToWorld.InverseTransformPosition(SelectedSplinePosition),
|
|
FVector::ZeroVector,
|
|
FVector::ZeroVector,
|
|
CIM_CurveAuto);
|
|
|
|
FInterpCurvePoint<FQuat> NewRotPoint(
|
|
SelectedSegmentIndex,
|
|
FQuat::Identity,
|
|
FQuat::Identity,
|
|
FQuat::Identity,
|
|
CIM_CurveAuto);
|
|
|
|
FInterpCurvePoint<FVector> NewScalePoint(
|
|
SelectedSegmentIndex,
|
|
FVector(1.0f),
|
|
FVector::ZeroVector,
|
|
FVector::ZeroVector,
|
|
CIM_CurveAuto);
|
|
|
|
SplinePosition.Points.Insert(NewPoint, SelectedSegmentIndex + 1);
|
|
SplineRotation.Points.Insert(NewRotPoint, SelectedSegmentIndex + 1);
|
|
SplineScale.Points.Insert(NewScalePoint, SelectedSegmentIndex + 1);
|
|
|
|
// Adjust input keys of subsequent points
|
|
for (int Index = SelectedSegmentIndex + 1; Index < SplinePosition.Points.Num(); Index++)
|
|
{
|
|
SplinePosition.Points[Index].InVal += 1.0f;
|
|
SplineRotation.Points[Index].InVal += 1.0f;
|
|
SplineScale.Points[Index].InVal += 1.0f;
|
|
}
|
|
|
|
// Set selection to 'next' key
|
|
ChangeSelectionState(SelectedSegmentIndex + 1, false);
|
|
SelectedSegmentIndex = INDEX_NONE;
|
|
|
|
SplineComp->UpdateSpline();
|
|
SplineComp->bSplineHasBeenEdited = true;
|
|
|
|
NotifyPropertyModified(SplineComp, SplineCurvesProperty);
|
|
|
|
CachedRotation = SplineComp->GetQuaternionAtSplinePoint(LastKeyIndexSelected, ESplineCoordinateSpace::World);
|
|
|
|
GEditor->RedrawLevelEditingViewports(true);
|
|
}
|
|
|
|
|
|
void FSplineComponentVisualizer::OnDeleteKey()
|
|
{
|
|
const FScopedTransaction Transaction(LOCTEXT("DeleteSplinePoint", "Delete Spline Point"));
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
check(SplineComp != nullptr);
|
|
check(LastKeyIndexSelected != INDEX_NONE);
|
|
check(SelectedKeys.Num() > 0);
|
|
check(SelectedKeys.Contains(LastKeyIndexSelected));
|
|
|
|
SplineComp->Modify();
|
|
if (AActor* Owner = SplineComp->GetOwner())
|
|
{
|
|
Owner->Modify();
|
|
}
|
|
|
|
// 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
|
|
FInterpCurveVector& SplinePosition = SplineComp->SplineCurves.Position;
|
|
FInterpCurveQuat& SplineRotation = SplineComp->SplineCurves.Rotation;
|
|
FInterpCurveVector& SplineScale = SplineComp->SplineCurves.Scale;
|
|
|
|
for (int32 SelectedKeyIndex : SelectedKeysSorted)
|
|
{
|
|
SplinePosition.Points.RemoveAt(SelectedKeyIndex);
|
|
SplineRotation.Points.RemoveAt(SelectedKeyIndex);
|
|
SplineScale.Points.RemoveAt(SelectedKeyIndex);
|
|
|
|
for (int Index = SelectedKeyIndex; Index < SplinePosition.Points.Num(); Index++)
|
|
{
|
|
SplinePosition.Points[Index].InVal -= 1.0f;
|
|
SplineRotation.Points[Index].InVal -= 1.0f;
|
|
SplineScale.Points[Index].InVal -= 1.0f;
|
|
}
|
|
}
|
|
|
|
// Select first key
|
|
ChangeSelectionState(0, false);
|
|
SelectedSegmentIndex = INDEX_NONE;
|
|
SelectedTangentHandle = INDEX_NONE;
|
|
SelectedTangentHandleType = ESelectedTangentHandle::None;
|
|
|
|
SplineComp->UpdateSpline();
|
|
SplineComp->bSplineHasBeenEdited = true;
|
|
|
|
NotifyPropertyModified(SplineComp, SplineCurvesProperty);
|
|
|
|
CachedRotation = SplineComp->GetQuaternionAtSplinePoint(LastKeyIndexSelected, ESplineCoordinateSpace::World);
|
|
|
|
GEditor->RedrawLevelEditingViewports(true);
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::CanDeleteKey() const
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
return (SplineComp != nullptr &&
|
|
SelectedKeys.Num() > 0 &&
|
|
SelectedKeys.Num() != SplineComp->SplineCurves.Position.Points.Num() &&
|
|
LastKeyIndexSelected != INDEX_NONE);
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::IsKeySelectionValid() const
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
return (SplineComp != nullptr &&
|
|
SelectedKeys.Num() > 0 &&
|
|
LastKeyIndexSelected != INDEX_NONE);
|
|
}
|
|
|
|
|
|
void FSplineComponentVisualizer::OnResetToAutomaticTangent(EInterpCurveMode Mode)
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
if (SplineComp != nullptr)
|
|
{
|
|
const FScopedTransaction Transaction(LOCTEXT("ResetToAutomaticTangent", "Reset to Automatic Tangent"));
|
|
|
|
SplineComp->Modify();
|
|
if (AActor* Owner = SplineComp->GetOwner())
|
|
{
|
|
Owner->Modify();
|
|
}
|
|
|
|
for (int32 SelectedKeyIndex : SelectedKeys)
|
|
{
|
|
auto& Point = SplineComp->SplineCurves.Position.Points[SelectedKeyIndex];
|
|
if (Point.IsCurveKey())
|
|
{
|
|
Point.InterpMode = Mode;
|
|
}
|
|
}
|
|
|
|
SplineComp->UpdateSpline();
|
|
SplineComp->bSplineHasBeenEdited = true;
|
|
|
|
NotifyPropertyModified(SplineComp, SplineCurvesProperty);
|
|
|
|
CachedRotation = SplineComp->GetQuaternionAtSplinePoint(LastKeyIndexSelected, ESplineCoordinateSpace::World);
|
|
}
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::CanResetToAutomaticTangent(EInterpCurveMode Mode) const
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
if (SplineComp != nullptr && LastKeyIndexSelected != INDEX_NONE)
|
|
{
|
|
for (int32 SelectedKeyIndex : SelectedKeys)
|
|
{
|
|
const auto& Point = SplineComp->SplineCurves.Position.Points[SelectedKeyIndex];
|
|
if (Point.IsCurveKey() && Point.InterpMode != Mode)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
void FSplineComponentVisualizer::OnSetKeyType(EInterpCurveMode Mode)
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
if (SplineComp != nullptr)
|
|
{
|
|
const FScopedTransaction Transaction(LOCTEXT("SetSplinePointType", "Set Spline Point Type"));
|
|
|
|
SplineComp->Modify();
|
|
if (AActor* Owner = SplineComp->GetOwner())
|
|
{
|
|
Owner->Modify();
|
|
}
|
|
|
|
for (int32 SelectedKeyIndex : SelectedKeys)
|
|
{
|
|
SplineComp->SplineCurves.Position.Points[SelectedKeyIndex].InterpMode = Mode;
|
|
}
|
|
|
|
SplineComp->UpdateSpline();
|
|
SplineComp->bSplineHasBeenEdited = true;
|
|
|
|
NotifyPropertyModified(SplineComp, SplineCurvesProperty);
|
|
|
|
CachedRotation = SplineComp->GetQuaternionAtSplinePoint(LastKeyIndexSelected, ESplineCoordinateSpace::World);
|
|
}
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::IsKeyTypeSet(EInterpCurveMode Mode) const
|
|
{
|
|
if (IsKeySelectionValid())
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
check(SplineComp != nullptr);
|
|
|
|
for (int32 SelectedKeyIndex : SelectedKeys)
|
|
{
|
|
const auto& SelectedPoint = SplineComp->SplineCurves.Position.Points[SelectedKeyIndex];
|
|
if ((Mode == CIM_CurveAuto && SelectedPoint.IsCurveKey()) || SelectedPoint.InterpMode == Mode)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
void FSplineComponentVisualizer::OnSetVisualizeRollAndScale()
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
check(SplineComp != nullptr);
|
|
|
|
SplineComp->Modify();
|
|
if (AActor* Owner = SplineComp->GetOwner())
|
|
{
|
|
Owner->Modify();
|
|
}
|
|
|
|
SplineComp->bShouldVisualizeScale = !SplineComp->bShouldVisualizeScale;
|
|
|
|
NotifyPropertyModified(SplineComp, FindField<UProperty>(USplineComponent::StaticClass(), GET_MEMBER_NAME_CHECKED(USplineComponent, bShouldVisualizeScale)));
|
|
|
|
GEditor->RedrawLevelEditingViewports(true);
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::IsVisualizingRollAndScale() const
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
|
|
return SplineComp ? SplineComp->bShouldVisualizeScale : false;
|
|
}
|
|
|
|
|
|
void FSplineComponentVisualizer::OnSetDiscontinuousSpline()
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
check(SplineComp != nullptr);
|
|
|
|
SplineComp->Modify();
|
|
if (AActor* Owner = SplineComp->GetOwner())
|
|
{
|
|
Owner->Modify();
|
|
}
|
|
|
|
SplineComp->bAllowDiscontinuousSpline = !SplineComp->bAllowDiscontinuousSpline;
|
|
|
|
// If not allowed discontinuous splines, set all ArriveTangents to match LeaveTangents
|
|
if (!SplineComp->bAllowDiscontinuousSpline)
|
|
{
|
|
for (int Index = 0; Index < SplineComp->SplineCurves.Position.Points.Num(); Index++)
|
|
{
|
|
SplineComp->SplineCurves.Position.Points[Index].ArriveTangent = SplineComp->SplineCurves.Position.Points[Index].LeaveTangent;
|
|
}
|
|
}
|
|
|
|
TArray<UProperty*> Properties;
|
|
Properties.Add(SplineCurvesProperty);
|
|
Properties.Add(FindField<UProperty>(USplineComponent::StaticClass(), GET_MEMBER_NAME_CHECKED(USplineComponent, bAllowDiscontinuousSpline)));
|
|
NotifyPropertiesModified(SplineComp, Properties);
|
|
|
|
GEditor->RedrawLevelEditingViewports(true);
|
|
}
|
|
|
|
|
|
bool FSplineComponentVisualizer::IsDiscontinuousSpline() const
|
|
{
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
|
|
return SplineComp ? SplineComp->bAllowDiscontinuousSpline : false;
|
|
}
|
|
|
|
|
|
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->SplineCurves != CastChecked<USplineComponent>(SplineComp->GetArchetype())->SplineCurves;
|
|
// return SplineComp->bSplineHasBeenEdited;
|
|
}
|
|
|
|
|
|
TSharedPtr<SWidget> FSplineComponentVisualizer::GenerateContextMenu() const
|
|
{
|
|
FMenuBuilder MenuBuilder(true, SplineComponentVisualizerActions);
|
|
{
|
|
MenuBuilder.BeginSection("SplinePointEdit", LOCTEXT("SplinePoint", "Spline Point"));
|
|
{
|
|
if (SelectedSegmentIndex != INDEX_NONE)
|
|
{
|
|
MenuBuilder.AddMenuEntry(FSplineComponentVisualizerCommands::Get().AddKey);
|
|
}
|
|
else if (LastKeyIndexSelected != INDEX_NONE)
|
|
{
|
|
MenuBuilder.AddMenuEntry(FSplineComponentVisualizerCommands::Get().DeleteKey);
|
|
MenuBuilder.AddMenuEntry(FSplineComponentVisualizerCommands::Get().DuplicateKey);
|
|
|
|
MenuBuilder.AddSubMenu(
|
|
LOCTEXT("SplinePointType", "Spline Point Type"),
|
|
LOCTEXT("KeyTypeTooltip", "Define the type of the spline point."),
|
|
FNewMenuDelegate::CreateSP(this, &FSplineComponentVisualizer::GenerateSplinePointTypeSubMenu));
|
|
|
|
// Only add the Automatic Tangents submenu if any of the keys is a curve type
|
|
USplineComponent* SplineComp = GetEditedSplineComponent();
|
|
if (SplineComp != nullptr)
|
|
{
|
|
for (int32 SelectedKeyIndex : SelectedKeys)
|
|
{
|
|
const auto& Point = SplineComp->SplineCurves.Position.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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
MenuBuilder.EndSection();
|
|
|
|
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.AddMenuEntry(FSplineComponentVisualizerCommands::Get().DiscontinuousSpline);
|
|
}
|
|
MenuBuilder.EndSection();
|
|
}
|
|
|
|
TSharedPtr<SWidget> MenuWidget = MenuBuilder.MakeWidget();
|
|
return MenuWidget;
|
|
}
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|