void SSequencerLabelBrowser::HandleLabelListRowLabelRenamed(TSharedPtr<FSequencerLabelTreeNode> Node, const FString& NewLabel) { if (Sequencer.IsValid() && Sequencer.Pin()->GetLabelManager().RenameLabel(Node->Label, NewLabel)) { ReloadLabelList(true); } }
void SSequencerLabelEditor::CreateLabelFromFilterText() { for (auto ObjectId : ObjectIds) { Sequencer->GetLabelManager().AddObjectLabel(ObjectId, FilterBox->GetText().ToString()); } FilterBox->SetText(FText::GetEmpty()); ReloadLabelList(true); }
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION void SSequencerLabelBrowser::Construct(const FArguments& InArgs, TSharedRef<FSequencer> InSequencer) { OnSelectionChanged = InArgs._OnSelectionChanged; Sequencer = InSequencer; ChildSlot [ SAssignNew(LabelTreeView, STreeView<TSharedPtr<FSequencerLabelTreeNode>>) .ItemHeight(20.0f) .OnContextMenuOpening(this, &SSequencerLabelBrowser::HandleLabelTreeViewContextMenuOpening) .OnGenerateRow(this, &SSequencerLabelBrowser::HandleLabelTreeViewGenerateRow) .OnGetChildren(this, &SSequencerLabelBrowser::HandleLabelTreeViewGetChildren) .OnSelectionChanged(this, &SSequencerLabelBrowser::HandleLabelTreeViewSelectionChanged) .SelectionMode(ESelectionMode::Single) .TreeItemsSource(&LabelList) ]; Sequencer.Pin()->GetLabelManager().OnLabelsChanged().AddSP(this, &SSequencerLabelBrowser::HandleLabelManagerLabelsChanged); ReloadLabelList(true); }
void SSequencerLabelEditor::HandleFilterBoxTextChanged(const FText& NewText) { ReloadLabelList(false); }
void SSequencerLabelEditor::Construct(const FArguments& InArgs, FSequencer& InSequencer, const TArray<FGuid>& InObjectIds) { Sequencer = &InSequencer; ObjectIds = InObjectIds; ChildSlot [ SNew(SVerticalBox) + SVerticalBox::Slot() .AutoHeight() [ SNew(STextBlock) .Text(LOCTEXT("LabelAs", "Label as:")) ] + SVerticalBox::Slot() .AutoHeight() .Padding(0.0f, 2.0f) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() .FillWidth(1.0f) [ SAssignNew(FilterBox, SEditableTextBox) .ClearKeyboardFocusOnCommit(false) .MinDesiredWidth(144.0f) .OnKeyDownHandler(this, &SSequencerLabelEditor::HandleFilterBoxKeyDown) .OnTextChanged(this, &SSequencerLabelEditor::HandleFilterBoxTextChanged) .SelectAllTextWhenFocused(true) .ToolTipText(LOCTEXT("FilterBoxToolTip", "Type one or more strings to filter by. New label names may not contain whitespace. Use the `.` symbol to filter or create hierarchical labels")) ] + SHorizontalBox::Slot() .AutoWidth() .Padding(4.0f, 0.0f, 0.0f, 0.0f) [ SNew(SButton) .IsEnabled(this, &SSequencerLabelEditor::HandleCreateNewLabelButtonIsEnabled) .OnClicked(this, &SSequencerLabelEditor::HandleCreateNewLabelButtonClicked) .Content() [ SNew(STextBlock) .Text(LOCTEXT("CreateNewLabelButton", "Create New")) ] ] ] + SVerticalBox::Slot() .AutoHeight() .Padding(0.0f, 4.0f, 0.0f, 0.0f) [ SAssignNew(LabelListView, SListView<TSharedPtr<FString>>) .ItemHeight(20.0f) .ListItemsSource(&LabelList) .OnGenerateRow(this, &SSequencerLabelEditor::HandleLabelListViewGenerateRow) .SelectionMode(ESelectionMode::None) ] ]; ReloadLabelList(true); }
void SSequencerLabelBrowser::HandleLabelManagerLabelsChanged() { ReloadLabelList(true); }