TSharedPtr<FSequencerTrackNode> GetParentTrackNode(FSequencerDisplayNode& In) { FSequencerDisplayNode* Current = &In; while(Current && Current->GetType() != ESequencerNode::Object) { if (Current->GetType() == ESequencerNode::Track) { return StaticCastSharedRef<FSequencerTrackNode>(Current->AsShared()); } Current = Current->GetParent().Get(); } return nullptr; }
FKeyAreaLayout::FKeyAreaLayout(FSequencerDisplayNode& InNode, int32 InSectionIndex) { TotalHeight = 0.f; float LastPadding = 0.f; auto SetupKeyArea = [&](FSequencerDisplayNode& Node){ if (Node.GetType() == ESequencerNode::KeyArea) { Elements.Add(FKeyAreaLayoutElement::FromKeyAreaNode(StaticCastSharedRef<FSectionKeyAreaNode>(Node.AsShared()), InSectionIndex, TotalHeight)); } else if (!Node.IsExpanded()) { Elements.Add(FKeyAreaLayoutElement::FromGroup(Node.UpdateKeyGrouping(InSectionIndex), TotalHeight, Node.GetNodeHeight())); } }; // First, layout the parent { FSequencerDisplayNode* LayoutNode = &InNode; if (InNode.GetType() == ESequencerNode::Track) { TSharedPtr<FSequencerDisplayNode> KeyAreaNode = static_cast<FTrackNode&>(InNode).GetTopLevelKeyNode(); if (KeyAreaNode.IsValid()) { LayoutNode = KeyAreaNode.Get(); } } SetupKeyArea(*LayoutNode); LastPadding = LayoutNode->GetNodePadding().Bottom; TotalHeight += LayoutNode->GetNodeHeight() + LastPadding; } // Then any children InNode.TraverseVisible_ParentFirst([&](FSequencerDisplayNode& Node){ TotalHeight += Node.GetNodePadding().Top; SetupKeyArea(Node); LastPadding = Node.GetNodePadding().Bottom; TotalHeight += Node.GetNodeHeight() + LastPadding; return true; }, false); // Remove the padding from the bottom TotalHeight -= LastPadding; }
bool FSequencerNodeTree::GetDefaultExpansionState( const FSequencerDisplayNode& Node ) const { // For now, all types except categories and key areas are expanded by default return Node.GetType() != ESequencerNode::Category && Node.GetType() != ESequencerNode::KeyArea; }
bool FSequencerNodeTree::GetDefaultExpansionState( const FSequencerDisplayNode& Node ) const { // For now, only object nodes are expanded by default return Node.GetType() == ESequencerNode::Object; }