void UMovieScene3DTransformSection::GetKeyHandles(TSet<FKeyHandle>& KeyHandles) const { for (int32 Axis = 0; Axis < 3; ++Axis) { for (auto It(Translation[Axis].GetKeyHandleIterator()); It; ++It) { float Time = Translation[Axis].GetKeyTime(It.Key()); if (IsTimeWithinSection(Time)) { KeyHandles.Add(It.Key()); } } for (auto It(Rotation[Axis].GetKeyHandleIterator()); It; ++It) { float Time = Rotation[Axis].GetKeyTime(It.Key()); if (IsTimeWithinSection(Time)) { KeyHandles.Add(It.Key()); } } for (auto It(Scale[Axis].GetKeyHandleIterator()); It; ++It) { float Time = Scale[Axis].GetKeyTime(It.Key()); if (IsTimeWithinSection(Time)) { KeyHandles.Add(It.Key()); } } } }
FKeyHandle UMovieSceneActorReferenceSection::AddKey(float Time, const FGuid& Value) { if (IsTimeWithinSection(Time)) { if (TryModify()) { FKeyHandle ExistingKeyHandle = ActorGuidIndexCurve.FindKey(Time); if (ActorGuidIndexCurve.IsKeyHandleValid(ExistingKeyHandle)) { int32 ActorGuidIndex = ActorGuidIndexCurve.GetKeyValue(ExistingKeyHandle); if (ActorGuidIndex >= 0 && ActorGuidIndex < ActorGuids.Num()) { ActorGuids[ActorGuidIndex] = Value; return ExistingKeyHandle; } else { int32 NewActorGuidIndex = ActorGuids.Add(Value); return ActorGuidIndexCurve.UpdateOrAddKey(Time, NewActorGuidIndex); } } else { int32 NewActorGuidIndex = ActorGuids.Add(Value); return ActorGuidIndexCurve.AddKey(Time, NewActorGuidIndex); } } } return FKeyHandle(); }
UMovieSceneSection* UMovieSceneSection::SplitSection(float SplitTime) { if (!IsTimeWithinSection(SplitTime)) { return nullptr; } SetFlags(RF_Transactional); if (TryModify()) { float SectionEndTime = GetEndTime(); // Trim off the right SetEndTime(SplitTime); // Create a new section UMovieSceneTrack* Track = CastChecked<UMovieSceneTrack>(GetOuter()); Track->Modify(); UMovieSceneSection* NewSection = DuplicateObject<UMovieSceneSection>(this, Track); check(NewSection); NewSection->SetStartTime(SplitTime); NewSection->SetEndTime(SectionEndTime); Track->AddSection(*NewSection); return NewSection; } return nullptr; }
void UMovieSceneSection::AddKeyToCurve( FRichCurve& InCurve, float Time, float Value ) { if(IsTimeWithinSection(Time)) { Modify(); InCurve.UpdateOrAddKey(Time, Value); } }
void UMovieScene3DPathSection::GetKeyHandles(TSet<FKeyHandle>& KeyHandles) const { for (auto It(TimingCurve.GetKeyHandleIterator()); It; ++It) { float Time = TimingCurve.GetKeyTime(It.Key()); if (IsTimeWithinSection(Time)) { KeyHandles.Add(It.Key()); } } }
void UMovieSceneSection::AddKeyToCurve(FRichCurve& InCurve, float Time, float Value, EMovieSceneKeyInterpolation Interpolation, const bool bUnwindRotation) { if (IsTimeWithinSection(Time)) { if (TryModify()) { FKeyHandle ExistingKeyHandle = InCurve.FindKey(Time); FKeyHandle NewKeyHandle = InCurve.UpdateOrAddKey(Time, Value, bUnwindRotation); if (!InCurve.IsKeyHandleValid(ExistingKeyHandle) && InCurve.IsKeyHandleValid(NewKeyHandle)) { MovieSceneHelpers::SetKeyInterpolation(InCurve, NewKeyHandle, Interpolation); } } } }
void UMovieSceneSection::TrimSection(float TrimTime, bool bTrimLeft) { if (IsTimeWithinSection(TrimTime)) { SetFlags(RF_Transactional); if (TryModify()) { if (bTrimLeft) { SetStartTime(TrimTime); } else { SetEndTime(TrimTime); } } } }
void UMovieSceneSubSection::TrimSection( float TrimTime, bool bTrimLeft ) { if ( !IsTimeWithinSection( TrimTime ) ) { return; } float InitialStartTime = GetStartTime(); float InitialStartOffset = StartOffset; UMovieSceneSection::TrimSection( TrimTime, bTrimLeft ); // If trimming off the left, set the offset of the shot if ( bTrimLeft ) { float NewStartOffset = ( TrimTime - InitialStartTime ) / TimeScale; NewStartOffset += InitialStartOffset; // Ensure start offset is not less than 0 StartOffset = FMath::Max( NewStartOffset, 0.f ); } }
UMovieSceneSection* UMovieSceneSubSection::SplitSection( float SplitTime ) { if ( !IsTimeWithinSection( SplitTime ) ) { return nullptr; } float InitialStartTime = GetStartTime(); float InitialStartOffset = StartOffset; float NewStartOffset = ( SplitTime - InitialStartTime ) / TimeScale; NewStartOffset += InitialStartOffset; // Ensure start offset is not less than 0 NewStartOffset = FMath::Max( NewStartOffset, 0.f ); UMovieSceneSubSection* NewSection = Cast<UMovieSceneSubSection>( UMovieSceneSection::SplitSection( SplitTime ) ); if ( NewSection ) { NewSection->StartOffset = NewStartOffset; return NewSection; } return nullptr; }