You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#AnimEditing: support inserting frame
- This only supports a frame insertion, not resizing length - Main difficulty is to link with curves that have been modified. We'll need to properly shift whole thing if we want to. [CL 2480582 by Lina Halper in Main branch]
This commit is contained in:
@@ -52,6 +52,7 @@ void SAnimationScrubPanel::Construct( const SAnimationScrubPanel::FArguments& In
|
||||
.ViewInputMax(InArgs._ViewInputMax)
|
||||
.OnSetInputViewRange(InArgs._OnSetInputViewRange)
|
||||
.OnCropAnimSequence( this, &SAnimationScrubPanel::OnCropAnimSequence )
|
||||
.OnAddAnimSequence( this, &SAnimationScrubPanel::OnInsertAnimSequence )
|
||||
.OnReZeroAnimSequence( this, &SAnimationScrubPanel::OnReZeroAnimSequence )
|
||||
.bAllowZoom(InArgs._bAllowZoom)
|
||||
.IsRealtimeStreamingMode(this, &SAnimationScrubPanel::IsRealtimeStreamingMode)
|
||||
@@ -483,6 +484,36 @@ void SAnimationScrubPanel::OnCropAnimSequence( bool bFromStart, float CurrentTim
|
||||
}
|
||||
}
|
||||
|
||||
void SAnimationScrubPanel::OnInsertAnimSequence( bool bBefore, int32 CurrentFrame )
|
||||
{
|
||||
UAnimSingleNodeInstance* PreviewInstance = GetPreviewInstance();
|
||||
if(PreviewInstance)
|
||||
{
|
||||
float Length = PreviewInstance->GetLength();
|
||||
if(PreviewInstance->CurrentAsset)
|
||||
{
|
||||
UAnimSequence* AnimSequence = Cast<UAnimSequence>(PreviewInstance->CurrentAsset);
|
||||
if(AnimSequence)
|
||||
{
|
||||
const FScopedTransaction Transaction(LOCTEXT("InsertAnimSequence", "Insert Animation Sequence"));
|
||||
|
||||
//Call modify to restore slider position
|
||||
PreviewInstance->Modify();
|
||||
|
||||
//Call modify to restore anim sequence current state
|
||||
AnimSequence->Modify();
|
||||
|
||||
// Crop the raw anim data.
|
||||
int32 StartFrame = (bBefore)? CurrentFrame : CurrentFrame + 1;
|
||||
int32 EndFrame = StartFrame + 1;
|
||||
AnimSequence->InsertFramesToRawAnimData(StartFrame, EndFrame, CurrentFrame);
|
||||
// Recompress animation from Raw.
|
||||
FAnimationUtils::CompressAnimSequence(AnimSequence, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SAnimationScrubPanel::OnReZeroAnimSequence( )
|
||||
{
|
||||
UAnimSingleNodeInstance* PreviewInstance = GetPreviewInstance();
|
||||
|
||||
Reference in New Issue
Block a user