void FSequencerNodeTree::SaveExpansionState( const FSequencerDisplayNode& Node, bool bExpanded )
{	
	UMovieScene* MovieScene = Sequencer.GetFocusedMovieScene();

	FMovieSceneEditorData& EditorData = MovieScene->GetEditorData();

	if( bExpanded )
	{
		EditorData.CollapsedSequencerNodes.Remove( Node.GetPathName() );
	}
	else
	{
		// Collapsed nodes are stored instead of expanded so that new nodes are expanded by default
		EditorData.CollapsedSequencerNodes.AddUnique( Node.GetPathName() ) ;
	}

}
void FSequencerNodeTree::SaveExpansionState( const FSequencerDisplayNode& Node, bool bExpanded )
{	
	// @todo Sequencer - This should be moved to the sequence level
	UMovieScene* MovieScene = Sequencer.GetFocusedMovieSceneSequence()->GetMovieScene();

	FMovieSceneEditorData& EditorData = MovieScene->GetEditorData();

	EditorData.ExpansionStates.Add( Node.GetPathName(), FMovieSceneExpansionState(bExpanded) );
}
bool FSequencerNodeTree::GetSavedExpansionState( const FSequencerDisplayNode& Node ) const
{
	// @todo Sequencer - This should be moved to the sequence level
	UMovieScene* MovieScene = Sequencer.GetFocusedMovieSceneSequence()->GetMovieScene();

	FMovieSceneEditorData& EditorData = MovieScene->GetEditorData();
	FMovieSceneExpansionState* ExpansionState = EditorData.ExpansionStates.Find( Node.GetPathName() );

	return ExpansionState ? ExpansionState->bExpanded : GetDefaultExpansionState(Node);
}
bool FSequencerNodeTree::GetSavedExpansionState( const FSequencerDisplayNode& Node ) const
{
	UMovieScene* MovieScene = Sequencer.GetFocusedMovieScene();

	FMovieSceneEditorData& EditorData = MovieScene->GetEditorData();

	// Collapsed nodes are stored instead of expanded so that new nodes are expanded by default
	bool bCollapsed = EditorData.CollapsedSequencerNodes.Contains( Node.GetPathName() );

	return !bCollapsed;
}
FGroupedKeyArea::FGroupedKeyArea(FSequencerDisplayNode& InNode, int32 InSectionIndex)
	: Section(nullptr)
{
	// Calling this virtual function is safe here, as it's just called through standard name-lookup, not runtime dispatch
	FGroupedKeyCollection::InitializeRecursive(InNode, InSectionIndex);

	for (const TSharedPtr<IKeyArea>& KeyArea : KeyAreas)
	{
		auto* OwningSection = KeyArea->GetOwningSection();
		// Ensure they all belong to the same section
		ensure(!Section || Section == OwningSection);
		Section = OwningSection;
	}

	if (Section)
	{
		IndexKey = FIndexKey(InNode.GetPathName(), Section);
		UpdateIndex();
	}
}