|
@@ -269,6 +269,26 @@ void SEzAbleTreeViewWidget::BindCommands()
|
|
Commands.DeleteStates,
|
|
Commands.DeleteStates,
|
|
FExecuteAction::CreateSP(this, &SEzAbleTreeViewWidget::HandleDeleteStates),
|
|
FExecuteAction::CreateSP(this, &SEzAbleTreeViewWidget::HandleDeleteStates),
|
|
FCanExecuteAction::CreateSP(this, &SEzAbleTreeViewWidget::HasSelection));
|
|
FCanExecuteAction::CreateSP(this, &SEzAbleTreeViewWidget::HasSelection));
|
|
|
|
+
|
|
|
|
+ CommandList->MapAction(
|
|
|
|
+ Commands.AddChildState,
|
|
|
|
+ FExecuteAction::CreateSP(this, &SEzAbleTreeViewWidget::HandleAddChildState),
|
|
|
|
+ FCanExecuteAction::CreateSP(this, &SEzAbleTreeViewWidget::HasSelection));
|
|
|
|
+
|
|
|
|
+ CommandList->MapAction(
|
|
|
|
+ Commands.AddSiblingState,
|
|
|
|
+ FExecuteAction::CreateSP(this, &SEzAbleTreeViewWidget::HandleAddSiblingState),
|
|
|
|
+ FCanExecuteAction());
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+UEzAbilityState* SEzAbleTreeViewWidget::GetFirstSelectedState() const
|
|
|
|
+{
|
|
|
|
+ TArray<UEzAbilityState*> SelectedStates;
|
|
|
|
+ if (AbleTreeViewOperationMode)
|
|
|
|
+ {
|
|
|
|
+ AbleTreeViewOperationMode->GetSelectedStates(SelectedStates);
|
|
|
|
+ }
|
|
|
|
+ return SelectedStates.IsEmpty() ? nullptr : SelectedStates[0];
|
|
}
|
|
}
|
|
|
|
|
|
void SEzAbleTreeViewWidget::HandleDeleteStates()
|
|
void SEzAbleTreeViewWidget::HandleDeleteStates()
|
|
@@ -280,6 +300,27 @@ void SEzAbleTreeViewWidget::HandleDeleteStates()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void SEzAbleTreeViewWidget::HandleAddChildState()
|
|
|
|
+{
|
|
|
|
+ if (AbleTreeViewOperationMode)
|
|
|
|
+ {
|
|
|
|
+ UEzAbilityState* ParentState = GetFirstSelectedState();
|
|
|
|
+ if (ParentState)
|
|
|
|
+ {
|
|
|
|
+ AbleTreeViewOperationMode->AddChildState(ParentState);
|
|
|
|
+ TreeView->SetItemExpansion(ParentState, true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void SEzAbleTreeViewWidget::HandleAddSiblingState()
|
|
|
|
+{
|
|
|
|
+ if (AbleTreeViewOperationMode)
|
|
|
|
+ {
|
|
|
|
+ AbleTreeViewOperationMode->AddState(GetFirstSelectedState());
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
FReply SEzAbleTreeViewWidget::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent)
|
|
FReply SEzAbleTreeViewWidget::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent)
|
|
{
|
|
{
|
|
if (CommandList->ProcessCommandBindings(InKeyEvent))
|
|
if (CommandList->ProcessCommandBindings(InKeyEvent))
|