void UFaceFXAnimationTrack::AddSection(float KeyTime, const FFaceFXAnimComponentSet& AnimCompSet) { UFaceFXAnimationSection* NewSection = Cast<UFaceFXAnimationSection>(CreateNewSection()); { NewSection->SetData(AnimCompSet); NewSection->InitialPlacement(AnimationSections, KeyTime, KeyTime + NewSection->GetAnimationDuration(), SupportsMultipleRows()); } AddSection(*NewSection); }
void UMovieSceneMaterialTrack::AddVectorParameterKey( FName ParameterName, float Time, FLinearColor Value ) { UMovieSceneMaterialParameterSection* NearestSection = Cast<UMovieSceneMaterialParameterSection>( MovieSceneHelpers::FindNearestSectionAtTime( Sections, Time ) ); if ( NearestSection == nullptr ) { NearestSection = Cast<UMovieSceneMaterialParameterSection>( CreateNewSection() ); NearestSection->SetStartTime( Time ); NearestSection->SetEndTime( Time ); Sections.Add( NearestSection ); } NearestSection->AddVectorParameterKey( ParameterName, Time, Value ); }
UMovieSceneSection* UMovieScenePropertyTrack::FindOrAddSection( float Time ) { // Find a spot for the section so that they are sorted by start time for( int32 SectionIndex = 0; SectionIndex < Sections.Num(); ++SectionIndex ) { UMovieSceneSection* Section = Sections[SectionIndex]; if( Section->IsTimeWithinSection( Time ) ) { return Section; } // Check if there are no more sections that would overlap the time if( !Sections.IsValidIndex( SectionIndex+1 ) || Sections[SectionIndex+1]->GetStartTime() > Time ) { // No sections overlap the time if( SectionIndex > 0 ) { // Append and grow the previous section UMovieSceneSection* PreviousSection = Sections[ SectionIndex ? SectionIndex-1 : 0 ]; PreviousSection->SetEndTime( Time ); return PreviousSection; } else if( Sections.IsValidIndex( SectionIndex+1 ) ) { // Prepend and grow the next section because there are no sections before this one UMovieSceneSection* NextSection = Sections[SectionIndex+1]; NextSection->SetStartTime( Time ); return NextSection; } else { // SectionIndex == 0 UMovieSceneSection* PreviousSection = Sections[0]; if( PreviousSection->GetEndTime() < Time ) { // Append and grow the section PreviousSection->SetEndTime( Time ); } else { // Prepend and grow the section PreviousSection->SetStartTime( Time ); } return PreviousSection; } } } check( Sections.Num() == 0 ); // Add a new section that starts and ends at the same time UMovieSceneSection* NewSection = CreateNewSection(); NewSection->SetStartTime( Time ); NewSection->SetEndTime( Time ); Sections.Add( NewSection ); return NewSection; }