Files
UnrealEngineUWP/Engine/Source/Editor/UnrealEd/Private/Animation/EditorAnimCompositeSegment.cpp
jurre debaare b8c3f5335c Montage segment changes:
- Deprecated public access to AnimReference
    * Used for new behaviour that keeps track of PlayLength from referenced asset
    * In case the cached PlayLength does not match the current _and_ the cache playlength == than the segment length it can be deemed out-of-date due to a reimport
    * Out-of-date segments show in the OrangeAccent on the timeline rather than GreenAccent
    * Out-of-date segments will introduce log warnings on-load
- Patched up all paths using AnimReference (get/set)
- Modernized parts of EditorAnim* files
- Face-lifted details customization for AnimSegment
    * Scrollboxes now have (dynamic) UI/Clamp according to the context
    * Added behaviour for interactive operation when dragging the timeline (dragable) bars
- Implemented FAnimModel_AnimMontage::OnDataModelChanged to handle curve changes only - as play length etc is handled by montage editor itself

#rb Thomas.Sarkanen
#preflight 620fb4c9be45100d32bcc000

#ROBOMERGE-OWNER: jurre.debaare
#ROBOMERGE-AUTHOR: jurre.debaare
#ROBOMERGE-SOURCE: CL 19051190 via CL 19051207 via CL 19051231 via CL 19051241 via CL 19058489
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v918-19018356)

[CL 19066040 by jurre debaare in ue5-main branch]
2022-02-21 01:10:52 -05:00

73 lines
2.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
AnimMontage.cpp: Montage classes that contains slots
=============================================================================*/
#include "Animation/EditorAnimCompositeSegment.h"
#include "Animation/AnimComposite.h"
UEditorAnimCompositeSegment::UEditorAnimCompositeSegment(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
AnimSegmentIndex = 0;
}
void UEditorAnimCompositeSegment::InitAnimSegment(int32 AnimSegmentIndexIn)
{
AnimSegmentIndex = AnimSegmentIndexIn;
if(UAnimComposite* Composite = Cast<UAnimComposite>(AnimObject))
{
if(Composite->AnimationTrack.AnimSegments.IsValidIndex(AnimSegmentIndex))
{
AnimSegment = Composite->AnimationTrack.AnimSegments[AnimSegmentIndex];
}
}
}
void UEditorAnimCompositeSegment::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
if (PropertyChangedEvent.GetPropertyName() == GET_MEMBER_NAME_CHECKED(FAnimSegment, AnimReference))
{
AnimSegment.UpdateCachedPlayLength();
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
Super::PostEditChangeProperty(PropertyChangedEvent);
}
bool UEditorAnimCompositeSegment::ApplyChangesToMontage()
{
if(UAnimComposite* Composite = Cast<UAnimComposite>(AnimObject))
{
if(Composite->AnimationTrack.AnimSegments.IsValidIndex(AnimSegmentIndex))
{
if (AnimSegment.GetAnimReference() && Composite->GetSkeleton()->IsCompatible(AnimSegment.GetAnimReference()->GetSkeleton()))
{
Composite->AnimationTrack.AnimSegments[AnimSegmentIndex] = AnimSegment;
return true;
}
else
{
AnimSegment.SetAnimReference(Composite->AnimationTrack.AnimSegments[AnimSegmentIndex].GetAnimReference(), false);
return false;
}
}
}
return false;
}
bool UEditorAnimCompositeSegment::PropertyChangeRequiresRebuild(FPropertyChangedEvent& PropertyChangedEvent)
{
const FName PropertyName = PropertyChangedEvent.Property ? PropertyChangedEvent.Property->GetFName() : NAME_None;
// Changing the end or start time of the segment length can't change the order of the montage segments.
// Return false so that the montage editor does not fully rebuild its UI and we can keep this UEditorAnimSegment object
// in the details view. (A better solution would be handling the rebuilding in a way that didn't possibly invalidate the UEditorMontageObj in the details view)
return !(PropertyName == GET_MEMBER_NAME_CHECKED(FAnimSegment, AnimEndTime) || PropertyName == GET_MEMBER_NAME_CHECKED(FAnimSegment, AnimStartTime) || PropertyName == GET_MEMBER_NAME_CHECKED(FAnimSegment, AnimPlayRate) || PropertyName == GET_MEMBER_NAME_CHECKED(FAnimSegment, LoopingCount));
}