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::SetCurveDefault(FRichCurve& InCurve, float Value) { if (TryModify()) { InCurve.SetDefaultValue(Value); } }
void UMovieScene3DPathSection::AddPath( float Time, float SequenceEndTime, const FGuid& InPathId ) { if (TryModify()) { ConstraintId = InPathId; TimingCurve.UpdateOrAddKey(Time, 0); TimingCurve.UpdateOrAddKey(SequenceEndTime, 1); } }
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); } } } }