Bladeren bron

添加节点名称

maboren 5 maanden geleden
bovenliggende
commit
f9d72c67f8

+ 3 - 1
Ability/Plugins/EzAbility/Source/EzAbilityEditor/Private/AbleTreeEditorStyle.cpp

@@ -434,6 +434,8 @@ FAbleTreeEditorStyle& FAbleTreeEditorStyle::Get()
 
 const FSlateBrush* FAbleTreeEditorStyle::GetBrushForSelectionBehaviorType()
 {	
+
+	return  Get().GetBrush("StateTreeEditor.SelectNone");
 // 	if (InBehaviour == EStateTreeStateSelectionBehavior::None)
 // 	{
 // 		return Get().GetBrush("StateTreeEditor.SelectNone");
@@ -466,5 +468,5 @@ const FSlateBrush* FAbleTreeEditorStyle::GetBrushForSelectionBehaviorType()
 // 		return Get().GetBrush("StateTreeEditor.TryFollowTransitions");
 // 	}
 
-	return nullptr;
+	//return nullptr;
 }

+ 18 - 17
Ability/Plugins/EzAbility/Source/EzAbilityEditor/Private/SEzAbleTreeViewRowWidget.cpp

@@ -5,7 +5,9 @@
 #include "SlateOptMacros.h"
 #include "SAbleTreeExpanderArrow.h"
 #include "AbleTreeEditorStyle.h"
-//#include "SInlineEditableTextBlock.h"
+#include "Styling/SlateTypes.h"
+#include "Widgets/Text/SInlineEditableTextBlock.h"
+
 
 #define LOCTEXT_NAMESPACE "AbleTreeViewRow"
 BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
@@ -126,7 +128,7 @@ void SEzAbleTreeViewRowWidget::Construct(const FArguments& InArgs, const TShared
 								.BaseIndentLevel(0)
 								.ImageSize(FVector2f(16, 16))
 								.ImagePadding(FMargin(9, 14, 0, 0))
-								.Image(this, &SEzAbleTreeViewRowWidget::GetSelectorIcon) // SStateTreeViewRow::GetSelectorIcon
+								.Image(FAbleTreeEditorStyle::Get().GetBrush("StateTreeEditor.TryFollowTransitions")) // this, &SEzAbleTreeViewRowWidget::GetSelectorIcon
 								.ColorAndOpacity(FLinearColor(1, 1, 1, 0.2f))
 								.WireColorAndOpacity(FLinearColor(1, 1, 1, 0.2f))
 						]
@@ -161,11 +163,11 @@ void SEzAbleTreeViewRowWidget::Construct(const FArguments& InArgs, const TShared
 														[
 															SNew(SBorder)
 																.BorderImage(FAbleTreeEditorStyle::Get().GetBrush("StateTree.State.Border"))
-																//.BorderBackgroundColor(this, &SStateTreeViewRow::GetActiveStateColor)
+																.BorderBackgroundColor(FLinearColor(FColor(236, 134, 39)))//this, &SStateTreeViewRow::GetActiveStateColor //选择节点时上面的红色框体
 																[
 																	SNew(SBorder)
 																		.BorderImage(FAbleTreeEditorStyle::Get().GetBrush("StateTree.State"))
-																		//.BorderBackgroundColor(this, &SStateTreeViewRow::GetTitleColor, 1.0f, 0.0f)
+																		.BorderBackgroundColor(FLinearColor(FColor(31, 151, 167)))//this, &SStateTreeViewRow::GetTitleColor, 1.0f, 0.0f  //节点的背景
 																		.Padding(FMargin(0.f, 0.f, 12.f, 0.f))
 																		.IsEnabled_Lambda([InState]
 																			{
@@ -222,7 +224,7 @@ void SEzAbleTreeViewRowWidget::Construct(const FArguments& InArgs, const TShared
 																								.Padding(FMargin(4.f, 0.f, 0.f, 0.f))
 																								[
 																									SNew(SImage)
-																										//.Image(this, &SStateTreeViewRow::GetSelectorIcon)
+																										.Image(FAbleTreeEditorStyle::Get().GetBrush("StateTreeEditor.SelectNone"))//this, &SStateTreeViewRow::GetSelectorIcon 这里还不知道是哪个东西
 																										.ColorAndOpacity(IconTint)
 																										//.ToolTipText(this, &SStateTreeViewRow::GetSelectorTooltip)
 																								]
@@ -247,16 +249,16 @@ void SEzAbleTreeViewRowWidget::Construct(const FArguments& InArgs, const TShared
 																						+ SHorizontalBox::Slot()
 																						.VAlign(VAlign_Center)
 																						.AutoWidth()
-// 																						[
-// 																							SAssignNew(NameTextBlock, SInlineEditableTextBlock)
-// 																								.Style(FAbleTreeEditorStyle::Get(), "StateTree.State.TitleInlineEditableText")
-// 																								//.OnTextCommitted(this, &SStateTreeViewRow::HandleNodeLabelTextCommitted)
-// 																								//.OnVerifyTextChanged(this, &SStateTreeViewRow::HandleVerifyNodeLabelTextChanged)
-// 																								//.Text(this, &SStateTreeViewRow::GetStateDesc)
-// 																								//.ToolTipText(this, &SStateTreeViewRow::GetStateTypeTooltip)
-// 																								.Clipping(EWidgetClipping::ClipToBounds)
-// 																								//.IsSelected(this, &SStateTreeViewRow::IsStateSelected)
-// 																						]
+																						[
+																							SAssignNew(NameTextBlock, SInlineEditableTextBlock)
+																								//.Style(FAbleTreeEditorStyle::Get(), "StateTree.State.TitleInlineEditableText")
+																								//.OnTextCommitted(this, &SStateTreeViewRow::HandleNodeLabelTextCommitted)
+																								//.OnVerifyTextChanged(this, &SStateTreeViewRow::HandleVerifyNodeLabelTextChanged)
+																								.Text(FText::FromName(FName(TEXT("AbleTree")))) // this, &SStateTreeViewRow::GetStateDesc
+																								//.ToolTipText(this, &SStateTreeViewRow::GetStateTypeTooltip)
+																								.Clipping(EWidgetClipping::ClipToBounds)
+																								//.IsSelected(this, &SStateTreeViewRow::IsStateSelected)
+																						]
 
 																						// Linked State
 																						+ SHorizontalBox::Slot()
@@ -461,8 +463,7 @@ const FSlateBrush* SEzAbleTreeViewRowWidget::GetSelectorIcon() const
 {
 	if (const UEzAbilityState* State = WeakState.Get())
 	{
-		FSlateBrush* SlateBrush = new FSlateBrush();
-		return SlateBrush;
+		return FAbleTreeEditorStyle::GetBrushForSelectionBehaviorType();
 		//return FStateTreeEditorStyle::GetBrushForSelectionBehaviorType(State->SelectionBehavior, !State->Children.IsEmpty(), State->Type);
 	}