AbleTreeEditorStyle.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. // Copyright Epic Games, Inc. All Rights Reserved.
  2. #include "AbleTreeEditorStyle.h"
  3. #include "Brushes/SlateBoxBrush.h"
  4. #include "Styling/SlateStyleRegistry.h"
  5. #include "Brushes/SlateImageBrush.h"
  6. #include "Styling/CoreStyle.h"
  7. #include "Brushes/SlateRoundedBoxBrush.h"
  8. #include "Styling/SlateTypes.h"
  9. #include "Misc/Paths.h"
  10. #include "Styling/StyleColors.h"
  11. //#include "StateTreeTypes.h"
  12. #include "EzAbilityTypes.h"
  13. #include "Styling/SlateStyleMacros.h"
  14. namespace UE::AbleTree::Editor
  15. {
  16. class FAbleContentRootScope
  17. {
  18. public:
  19. FAbleContentRootScope(FAbleTreeEditorStyle* InStyle, const FString& NewContentRoot)
  20. : Style(InStyle)
  21. , PreviousContentRoot(InStyle->GetContentRootDir())
  22. {
  23. Style->SetContentRoot(NewContentRoot);
  24. }
  25. ~FAbleContentRootScope()
  26. {
  27. Style->SetContentRoot(PreviousContentRoot);
  28. }
  29. private:
  30. FAbleTreeEditorStyle* Style;
  31. FString PreviousContentRoot;
  32. };
  33. };
  34. FAbleTreeEditorStyle::FAbleTreeEditorStyle()
  35. : FSlateStyleSet(TEXT("AbleTreeEditorStyle"))
  36. {
  37. const FString EngineSlateContentDir = FPaths::EngineContentDir() / TEXT("Slate");
  38. const FString EngineEditorSlateContentDir = FPaths::EngineContentDir() / TEXT("Editor/Slate");
  39. SetCoreContentRoot(EngineSlateContentDir);
  40. const FString StateTreePluginContentDir = FPaths::EnginePluginsDir() / TEXT("Runtime/StateTree/Resources");
  41. SetContentRoot(StateTreePluginContentDir);
  42. const FScrollBarStyle ScrollBar = FAppStyle::GetWidgetStyle<FScrollBarStyle>("ScrollBar");
  43. const FTextBlockStyle& NormalText = FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText");
  44. // State
  45. {
  46. const FTextBlockStyle StateIcon = FTextBlockStyle(NormalText)
  47. .SetFont(FAppStyle::Get().GetFontStyle("FontAwesome.12"))
  48. .SetColorAndOpacity(FLinearColor(230.0f / 255.0f, 230.0f / 255.0f, 230.0f / 255.0f, 0.5f));
  49. Set("StateTree.Icon", StateIcon);
  50. const FTextBlockStyle StateTitle = FTextBlockStyle(NormalText)
  51. .SetFont(DEFAULT_FONT("Bold", 12))
  52. .SetColorAndOpacity(FLinearColor(230.0f / 255.0f, 230.0f / 255.0f, 230.0f / 255.0f, 0.9f));
  53. Set("StateTree.State.Title", StateTitle);
  54. const FEditableTextBoxStyle StateTitleEditableText = FEditableTextBoxStyle()
  55. .SetTextStyle(NormalText)
  56. .SetFont(DEFAULT_FONT("Bold", 12))
  57. .SetBackgroundImageNormal(CORE_BOX_BRUSH("Common/TextBox", FMargin(4.0f / 16.0f)))
  58. .SetBackgroundImageHovered(CORE_BOX_BRUSH("Common/TextBox_Hovered", FMargin(4.0f / 16.0f)))
  59. .SetBackgroundImageFocused(CORE_BOX_BRUSH("Common/TextBox_Hovered", FMargin(4.0f / 16.0f)))
  60. .SetBackgroundImageReadOnly(CORE_BOX_BRUSH("Common/TextBox_ReadOnly", FMargin(4.0f / 16.0f)))
  61. .SetBackgroundColor(FLinearColor(0,0,0,0.1f))
  62. .SetPadding(FMargin(0))
  63. .SetScrollBarStyle(ScrollBar);
  64. Set("StateTree.State.TitleEditableText", StateTitleEditableText);
  65. Set("StateTree.State.TitleInlineEditableText", FInlineEditableTextBlockStyle()
  66. .SetTextStyle(StateTitle)
  67. .SetEditableTextBoxStyle(StateTitleEditableText));
  68. Set("StateTree.State.Border", new FSlateBorderBrush(NAME_None, FMargin(2.0f)));
  69. Set("StateTree.State", new FSlateRoundedBoxBrush(FLinearColor::White, 2.0f));
  70. }
  71. // Details
  72. {
  73. const FTextBlockStyle Details = FTextBlockStyle(NormalText)
  74. .SetFont(DEFAULT_FONT("Regular", 10))
  75. .SetColorAndOpacity(FLinearColor(230.0f / 255.0f, 230.0f / 255.0f, 230.0f / 255.0f, 0.75f));
  76. Set("StateTree.Details", Details);
  77. Set("StateTree.Node.Label", new FSlateRoundedBoxBrush(FStyleColors::AccentGray, 6.f));
  78. // For multi selection with mixed values for a given property
  79. const FLinearColor Color = FStyleColors::Hover.GetSpecifiedColor();
  80. const FLinearColor HollowColor = Color.CopyWithNewOpacity(0.0);
  81. Set("StateTree.Node.Label.Mixed", new FSlateRoundedBoxBrush(HollowColor, 6.0f, Color, 1.0f));
  82. const FTextBlockStyle DetailsCategory = FTextBlockStyle(NormalText)
  83. .SetFont(DEFAULT_FONT("Bold", 8));
  84. Set("StateTree.Category", DetailsCategory);
  85. }
  86. // Task
  87. {
  88. const FLinearColor ForegroundCol = FStyleColors::Foreground.GetSpecifiedColor();
  89. Set("StateTree.Task.Title", FTextBlockStyle(NormalText)
  90. .SetFont(DEFAULT_FONT("Regular", 10))
  91. .SetColorAndOpacity(ForegroundCol.CopyWithNewOpacity(0.8f)));
  92. Set("StateTree.Task.Title.Bold", FTextBlockStyle(NormalText)
  93. .SetFont(DEFAULT_FONT("Bold", 10))
  94. .SetColorAndOpacity(ForegroundCol.CopyWithNewOpacity(0.8f)));
  95. Set("StateTree.Task.Title.Subdued", FTextBlockStyle(NormalText)
  96. .SetFont(DEFAULT_FONT("Regular", 10))
  97. .SetColorAndOpacity(ForegroundCol.CopyWithNewOpacity(0.4f)));
  98. // Tasks to be show up a bit darker than the state
  99. Set("StateTree.Task.Rect", new FSlateColorBrush(FLinearColor(FVector3f(0.67f))));
  100. }
  101. // Details rich text
  102. {
  103. Set("Details.Normal", FTextBlockStyle(NormalText)
  104. .SetFont(FAppStyle::GetFontStyle(TEXT("PropertyWindow.NormalFont"))));
  105. Set("Details.Bold", FTextBlockStyle(NormalText)
  106. .SetFont(FAppStyle::GetFontStyle(TEXT("PropertyWindow.BoldFont"))));
  107. Set("Details.Italic", FTextBlockStyle(NormalText)
  108. .SetFont(FAppStyle::GetFontStyle(TEXT("PropertyWindow.ItalicFont"))));
  109. Set("Details.Subdued", FTextBlockStyle(NormalText)
  110. .SetColorAndOpacity(FSlateColor::UseSubduedForeground())
  111. .SetFont(FAppStyle::GetFontStyle(TEXT("PropertyWindow.NormalFont"))));
  112. }
  113. // Normal rich text
  114. {
  115. Set("Normal.Normal", FTextBlockStyle(NormalText)
  116. .SetColorAndOpacity(FSlateColor::UseForeground())
  117. .SetFont(DEFAULT_FONT("Regular", 10)));
  118. Set("Normal.Bold", FTextBlockStyle(NormalText)
  119. .SetColorAndOpacity(FSlateColor::UseForeground())
  120. .SetFont(DEFAULT_FONT("Bold", 10)));
  121. Set("Normal.Italic", FTextBlockStyle(NormalText)
  122. .SetColorAndOpacity(FSlateColor::UseForeground())
  123. .SetFont(DEFAULT_FONT("Italic", 10)));
  124. Set("Normal.Subdued", FTextBlockStyle(NormalText)
  125. .SetColorAndOpacity(FSlateColor::UseSubduedForeground())
  126. .SetFont(DEFAULT_FONT("Regular", 10)));
  127. }
  128. // Transition rich text
  129. {
  130. const FLinearColor ForegroundCol = FStyleColors::White.GetSpecifiedColor();
  131. Set("Transition.Normal", FTextBlockStyle(NormalText)
  132. .SetColorAndOpacity(ForegroundCol.CopyWithNewOpacity(0.9f))
  133. .SetFont(DEFAULT_FONT("Regular", 11)));
  134. Set("Transition.Bold", FTextBlockStyle(NormalText)
  135. .SetColorAndOpacity(ForegroundCol.CopyWithNewOpacity(0.9f))
  136. .SetFont(DEFAULT_FONT("Bold", 11)));
  137. Set("Transition.Italic", FTextBlockStyle(NormalText)
  138. .SetColorAndOpacity(ForegroundCol.CopyWithNewOpacity(0.9f))
  139. .SetFont(DEFAULT_FONT("Italic", 11)));
  140. Set("Transition.Subdued", FTextBlockStyle(NormalText)
  141. .SetColorAndOpacity(ForegroundCol.CopyWithNewOpacity(0.5f))
  142. .SetFont(DEFAULT_FONT("Regular", 11)));
  143. }
  144. // Diff tool
  145. {
  146. Set("DiffTools.Added", FLinearColor(0.3f, 1.f, 0.3f)); // green
  147. Set("DiffTools.Removed", FLinearColor(1.0f, 0.2f, 0.3f)); // red
  148. Set("DiffTools.Changed", FLinearColor(0.85f, 0.71f, 0.25f)); // yellow
  149. Set("DiffTools.Moved", FLinearColor(0.5f, 0.8f, 1.f)); // light blue
  150. Set("DiffTools.Enabled", FLinearColor(0.7f, 1.f, 0.7f)); // light green
  151. Set("DiffTools.Disabled", FLinearColor(1.0f, 0.6f, 0.5f)); // light red
  152. Set("DiffTools.Properties", FLinearColor(0.2f, 0.4f, 1.f)); // blue
  153. }
  154. // Debugger
  155. {
  156. Set("StateTreeDebugger.Element.Normal",
  157. FTextBlockStyle(NormalText)
  158. .SetFont(DEFAULT_FONT("Regular", 10)));
  159. Set("StateTreeDebugger.Element.Bold",
  160. FTextBlockStyle(NormalText)
  161. .SetFont(DEFAULT_FONT("Bold", 10)));
  162. Set("StateTreeDebugger.Element.Subdued",
  163. FTextBlockStyle(NormalText)
  164. .SetFont(DEFAULT_FONT("Regular", 10))
  165. .SetColorAndOpacity(FSlateColor::UseSubduedForeground()));
  166. }
  167. const FLinearColor SelectionColor = FColor(0, 0, 0, 32);
  168. const FTableRowStyle& NormalTableRowStyle = FAppStyle::Get().GetWidgetStyle<FTableRowStyle>("TableView.Row");
  169. Set("StateTree.Selection",
  170. FTableRowStyle(NormalTableRowStyle)
  171. .SetActiveBrush(CORE_IMAGE_BRUSH("Common/Selection", CoreStyleConstants::Icon8x8, SelectionColor))
  172. .SetActiveHoveredBrush(CORE_IMAGE_BRUSH("Common/Selection", CoreStyleConstants::Icon8x8, SelectionColor))
  173. .SetInactiveBrush(CORE_IMAGE_BRUSH("Common/Selection", CoreStyleConstants::Icon8x8, SelectionColor))
  174. .SetInactiveHoveredBrush(CORE_IMAGE_BRUSH("Common/Selection", CoreStyleConstants::Icon8x8, SelectionColor))
  175. .SetSelectorFocusedBrush(CORE_IMAGE_BRUSH("Common/Selection", CoreStyleConstants::Icon8x8, SelectionColor))
  176. );
  177. const FComboButtonStyle& ComboButtonStyle = FCoreStyle::Get().GetWidgetStyle<FComboButtonStyle>("ComboButton");
  178. // Expression Operand combo button
  179. const FButtonStyle OperandButton = FButtonStyle()
  180. .SetNormal(FSlateRoundedBoxBrush(FStyleColors::AccentGreen.GetSpecifiedColor().Desaturate(0.3f), 4.0f))
  181. .SetHovered(FSlateRoundedBoxBrush(FStyleColors::AccentGreen.GetSpecifiedColor().Desaturate(0.2f), 4.0f))
  182. .SetPressed(FSlateRoundedBoxBrush(FStyleColors::AccentGreen.GetSpecifiedColor().Desaturate(0.1f), 4.0f))
  183. .SetNormalForeground(FStyleColors::Foreground)
  184. .SetHoveredForeground(FStyleColors::ForegroundHover)
  185. .SetPressedForeground(FStyleColors::ForegroundHover)
  186. .SetDisabledForeground(FStyleColors::ForegroundHover)
  187. .SetNormalPadding(FMargin(2, 2, 2, 2))
  188. .SetPressedPadding(FMargin(2, 3, 2, 1));
  189. Set("StateTree.Node.Operand.ComboBox", FComboButtonStyle(ComboButtonStyle).SetButtonStyle(OperandButton));
  190. Set("StateTree.Node.Operand", FTextBlockStyle(NormalText)
  191. .SetFont(FAppStyle::GetFontStyle(TEXT("PropertyWindow.BoldFont")))
  192. .SetFontSize(8));
  193. Set("StateTree.Node.Parens", FTextBlockStyle(NormalText)
  194. .SetFont(FAppStyle::GetFontStyle(TEXT("PropertyWindow.NormalFont")))
  195. .SetFontSize(12));
  196. // Parameter labels
  197. Set("StateTree.Param.Label", FTextBlockStyle(NormalText)
  198. .SetFont(FAppStyle::GetFontStyle(TEXT("PropertyWindow.BoldFont")))
  199. .SetFontSize(7));
  200. Set("StateTree.Param.Background", new FSlateRoundedBoxBrush(FStyleColors::Hover, 6.f));
  201. // Expression Indent combo button
  202. const FButtonStyle IndentButton = FButtonStyle()
  203. .SetNormal(FSlateRoundedBoxBrush(FLinearColor::Transparent, 2.0f))
  204. .SetHovered(FSlateRoundedBoxBrush(FStyleColors::Background, 2.0f, FStyleColors::InputOutline, 1.0f))
  205. .SetPressed(FSlateRoundedBoxBrush(FStyleColors::Background, 2.0f, FStyleColors::Hover, 1.0f))
  206. .SetNormalForeground(FStyleColors::Transparent)
  207. .SetHoveredForeground(FStyleColors::Hover)
  208. .SetPressedForeground(FStyleColors::Foreground)
  209. .SetNormalPadding(FMargin(2, 2, 2, 2))
  210. .SetPressedPadding(FMargin(2, 3, 2, 1));
  211. Set("StateTree.Node.Indent.ComboBox", FComboButtonStyle(ComboButtonStyle).SetButtonStyle(IndentButton));
  212. // Node text styles
  213. {
  214. FEditableTextStyle EditableTextStyle = FEditableTextStyle(FAppStyle::GetWidgetStyle<FEditableTextStyle>("NormalEditableText"));
  215. EditableTextStyle.Font = FAppStyle::GetFontStyle(TEXT("PropertyWindow.NormalFont"));
  216. EditableTextStyle.Font.Size = 10.0f;
  217. Set("StateTree.Node.Editable", EditableTextStyle);
  218. FEditableTextBoxStyle EditableTextBlockStyle = FEditableTextBoxStyle(FAppStyle::GetWidgetStyle<FEditableTextBoxStyle>("NormalEditableTextBox"));
  219. EditableTextStyle.Font = FAppStyle::GetFontStyle(TEXT("PropertyWindow.NormalFont"));
  220. EditableTextStyle.Font.Size = 10.0f;
  221. Set("StateTree.Node.EditableTextBlock", EditableTextBlockStyle);
  222. const FTextBlockStyle StateNodeNormalText = FTextBlockStyle(NormalText)
  223. .SetFont(FAppStyle::GetFontStyle(TEXT("PropertyWindow.NormalFont")))
  224. .SetFontSize(10);
  225. Set("StateTree.Node.Normal", StateNodeNormalText);
  226. Set("StateTree.Node.Bold", FTextBlockStyle(NormalText)
  227. .SetFont(FAppStyle::GetFontStyle(TEXT("PropertyWindow.BoldFont")))
  228. .SetFontSize(10));
  229. Set("StateTree.Node.Subdued", FTextBlockStyle(NormalText)
  230. .SetColorAndOpacity(FSlateColor::UseSubduedForeground())
  231. .SetFont(FAppStyle::GetFontStyle(TEXT("PropertyWindow.NormalFont")))
  232. .SetFontSize(10));
  233. Set("StateTree.Node.TitleInlineEditableText", FInlineEditableTextBlockStyle()
  234. .SetTextStyle(StateNodeNormalText)
  235. .SetEditableTextBoxStyle(EditableTextBlockStyle));
  236. }
  237. // Command icons
  238. {
  239. // From generic Engine
  240. UE::AbleTree::Editor::FAbleContentRootScope Scope(this, EngineSlateContentDir);
  241. Set("StateTreeEditor.CutStates", new IMAGE_BRUSH_SVG("Starship/Common/Cut", CoreStyleConstants::Icon16x16));
  242. Set("StateTreeEditor.CopyStates", new IMAGE_BRUSH_SVG("Starship/Common/Copy", CoreStyleConstants::Icon16x16));
  243. Set("StateTreeEditor.DuplicateStates", new IMAGE_BRUSH_SVG("Starship/Common/Duplicate", CoreStyleConstants::Icon16x16));
  244. Set("StateTreeEditor.DeleteStates", new IMAGE_BRUSH_SVG("Starship/Common/Delete", CoreStyleConstants::Icon16x16));
  245. Set("StateTreeEditor.RenameState", new IMAGE_BRUSH_SVG("Starship/Common/Rename", CoreStyleConstants::Icon16x16));
  246. Set("StateTreeEditor.AutoScroll", new IMAGE_BRUSH_SVG("Starship/Insights/AutoScrollRight_20", CoreStyleConstants::Icon16x16));
  247. Set("StateTreeEditor.Debugger.ResetTracks", new IMAGE_BRUSH_SVG("Starship/Common/Delete", CoreStyleConstants::Icon16x16));
  248. Set("StateTreeEditor.Debugger.State.Enter", new CORE_IMAGE_BRUSH_SVG("Starship/Common/arrow-right", CoreStyleConstants::Icon16x16, FStyleColors::Foreground));
  249. Set("StateTreeEditor.Debugger.State.Exit", new CORE_IMAGE_BRUSH_SVG("Starship/Common/arrow-left", CoreStyleConstants::Icon16x16, FStyleColors::Foreground));
  250. Set("StateTreeEditor.Debugger.State.Selected", new CORE_IMAGE_BRUSH_SVG("Starship/Common/arrow-right", CoreStyleConstants::Icon16x16, FStyleColors::AccentYellow));
  251. Set("StateTreeEditor.Debugger.State.Completed", new CORE_IMAGE_BRUSH_SVG("Starship/Common/check", CoreStyleConstants::Icon16x16, FStyleColors::AccentGreen));
  252. Set("StateTreeEditor.Debugger.Task.Enter", new CORE_IMAGE_BRUSH_SVG("Starship/Common/arrow-right", CoreStyleConstants::Icon16x16, FStyleColors::Foreground));
  253. Set("StateTreeEditor.Debugger.Task.Exit", new CORE_IMAGE_BRUSH_SVG("Starship/Common/arrow-left", CoreStyleConstants::Icon16x16, FStyleColors::Foreground));
  254. Set("StateTreeEditor.Debugger.Task.Failed", new CORE_IMAGE_BRUSH_SVG("Starship/Common/close-small", CoreStyleConstants::Icon16x16, FStyleColors::AccentRed));
  255. Set("StateTreeEditor.Debugger.Task.Succeeded", new CORE_IMAGE_BRUSH_SVG("Starship/Common/check", CoreStyleConstants::Icon16x16, FStyleColors::AccentGreen));
  256. Set("StateTreeEditor.Debugger.Task.Stopped", new CORE_IMAGE_BRUSH_SVG("Starship/Common/close-small", CoreStyleConstants::Icon16x16, FStyleColors::AccentRed));
  257. Set("StateTreeEditor.Debugger.Condition.Passed", new CORE_IMAGE_BRUSH_SVG("Starship/Common/check", CoreStyleConstants::Icon16x16, FStyleColors::AccentGreen));
  258. Set("StateTreeEditor.Debugger.Condition.Failed", new CORE_IMAGE_BRUSH_SVG("Starship/Common/close-small", CoreStyleConstants::Icon16x16, FStyleColors::AccentRed));
  259. Set("StateTreeEditor.Debugger.Condition.OnEvaluating", new CORE_IMAGE_BRUSH_SVG("Starship/Common/Update", CoreStyleConstants::Icon16x16, FStyleColors::AccentYellow));
  260. Set("StateTreeEditor.Debugger.Unset", new CORE_IMAGE_BRUSH_SVG("Starship/Common/help", CoreStyleConstants::Icon16x16, FStyleColors::AccentBlack));
  261. // Common Node Icons
  262. Set("Node.EnableDisable", new CORE_IMAGE_BRUSH_SVG("Starship/Common/check-circle", CoreStyleConstants::Icon16x16));
  263. Set("Node.Time", new CORE_IMAGE_BRUSH_SVG("Starship/Common/Recent", CoreStyleConstants::Icon16x16));
  264. Set("Node.Sync", new CORE_IMAGE_BRUSH_SVG("Starship/Common/Update", CoreStyleConstants::Icon16x16));
  265. }
  266. {
  267. // From generic Engine Editor
  268. UE::AbleTree::Editor::FAbleContentRootScope Scope(this, EngineEditorSlateContentDir);
  269. Set("StateTreeEditor.Debugger.StartRecording", new IMAGE_BRUSH("Sequencer/Transport_Bar/Record_24x", CoreStyleConstants::Icon16x16));
  270. Set("StateTreeEditor.Debugger.StopRecording", new IMAGE_BRUSH("Sequencer/Transport_Bar/Recording_24x", CoreStyleConstants::Icon16x16));
  271. Set("StateTreeEditor.Debugger.PreviousFrameWithStateChange", new IMAGE_BRUSH("Sequencer/Transport_Bar/Go_To_Front_24x", CoreStyleConstants::Icon16x16));
  272. Set("StateTreeEditor.Debugger.PreviousFrameWithEvents", new IMAGE_BRUSH("Sequencer/Transport_Bar/Step_Backwards_24x", CoreStyleConstants::Icon16x16));
  273. Set("StateTreeEditor.Debugger.NextFrameWithEvents", new IMAGE_BRUSH("Sequencer/Transport_Bar/Step_Forward_24x", CoreStyleConstants::Icon16x16));
  274. Set("StateTreeEditor.Debugger.NextFrameWithStateChange", new IMAGE_BRUSH("Sequencer/Transport_Bar/Go_To_End_24x", CoreStyleConstants::Icon16x16));
  275. Set("StateTreeEditor.Debugger.ToggleOnEnterStateBreakpoint", new IMAGE_BRUSH_SVG("Starship/Blueprints/Breakpoint_Valid", CoreStyleConstants::Icon16x16));
  276. Set("StateTreeEditor.Debugger.EnableOnEnterStateBreakpoint", new IMAGE_BRUSH_SVG("Starship/Blueprints/Breakpoint_Valid", CoreStyleConstants::Icon16x16));
  277. Set("StateTreeEditor.Debugger.EnableOnExitStateBreakpoint", new IMAGE_BRUSH_SVG("Starship/Blueprints/Breakpoint_Valid", CoreStyleConstants::Icon16x16));
  278. Set("StateTreeEditor.DebugOptions", new IMAGE_BRUSH_SVG("Starship/Common/Bug", CoreStyleConstants::Icon16x16));
  279. Set("StateTreeEditor.Debugger.OwnerTrack", new IMAGE_BRUSH_SVG("Starship/AssetIcons/AIController_64", CoreStyleConstants::Icon16x16));
  280. Set("StateTreeEditor.Debugger.InstanceTrack", new IMAGE_BRUSH_SVG("Starship/AssetIcons/AnimInstance_64", CoreStyleConstants::Icon16x16));
  281. Set("StateTreeEditor.EnableStates", new IMAGE_BRUSH("Icons/Empty_16x", CoreStyleConstants::Icon16x16));
  282. Set("StateTreeEditor.Debugger.Breakpoint.EnabledAndValid", new IMAGE_BRUSH_SVG( "Starship/Blueprints/Breakpoint_Valid", CoreStyleConstants::Icon16x16, FStyleColors::AccentRed));
  283. Set("StateTreeEditor.Debugger.ResumeDebuggerAnalysis", new IMAGE_BRUSH_SVG("Starship/Common/Timeline", CoreStyleConstants::Icon16x16));
  284. Set("StateTreeEditor.Transition.None", new CORE_IMAGE_BRUSH_SVG("Starship/Common/x-circle", CoreStyleConstants::Icon16x16, FSlateColor::UseSubduedForeground()));
  285. Set("StateTreeEditor.Transition.Succeeded", new CORE_IMAGE_BRUSH_SVG("Starship/Common/check", CoreStyleConstants::Icon16x16, FStyleColors::AccentGreen));
  286. Set("StateTreeEditor.Transition.Failed", new CORE_IMAGE_BRUSH_SVG("Starship/Common/close-small", CoreStyleConstants::Icon16x16, FStyleColors::AccentRed));
  287. Set("StateTreeEditor.Transition.Succeeded", new CORE_IMAGE_BRUSH_SVG("Starship/Common/check", CoreStyleConstants::Icon16x16, FStyleColors::AccentGreen));
  288. Set("StateTreeEditor.Transition.Failed", new CORE_IMAGE_BRUSH_SVG("Starship/Common/close-small", CoreStyleConstants::Icon16x16, FStyleColors::AccentRed));
  289. // Common Node Icons
  290. Set("Node.Navigation", new IMAGE_BRUSH_SVG("Starship/Common/Navigation", CoreStyleConstants::Icon16x16));
  291. Set("Node.Event", new IMAGE_BRUSH_SVG("Starship/Common/Event", CoreStyleConstants::Icon16x16));
  292. Set("Node.Animation", new IMAGE_BRUSH_SVG("Starship/Common/Animation", CoreStyleConstants::Icon16x16));
  293. Set("Node.Debug", new IMAGE_BRUSH_SVG("Starship/Common/Debug", CoreStyleConstants::Icon16x16));
  294. Set("Node.Find", new IMAGE_BRUSH_SVG("Starship/Common/Find", CoreStyleConstants::Icon16x16));
  295. }
  296. {
  297. // From plugin
  298. Set("StateTreeEditor.AddSiblingState", new IMAGE_BRUSH_SVG("Icons/Sibling_State", CoreStyleConstants::Icon16x16));
  299. Set("StateTreeEditor.AddChildState", new IMAGE_BRUSH_SVG("Icons/Child_State", CoreStyleConstants::Icon16x16));
  300. Set("StateTreeEditor.PasteStatesAsSiblings", new IMAGE_BRUSH_SVG("Icons/Sibling_State", CoreStyleConstants::Icon16x16));
  301. Set("StateTreeEditor.PasteStatesAsChildren", new IMAGE_BRUSH_SVG("Icons/Child_State", CoreStyleConstants::Icon16x16));
  302. Set("StateTreeEditor.SelectNone", new IMAGE_BRUSH_SVG("Icons/Select_None", CoreStyleConstants::Icon16x16));
  303. Set("StateTreeEditor.TryEnterState", new IMAGE_BRUSH_SVG("Icons/Try_Enter_State", CoreStyleConstants::Icon16x16));
  304. Set("StateTreeEditor.TrySelectChildrenInOrder", new IMAGE_BRUSH_SVG("Icons/Try_Select_Children_In_Order", CoreStyleConstants::Icon16x16));
  305. Set("StateTreeEditor.TrySelectChildrenAtRandom", new IMAGE_BRUSH_SVG("Icons/Try_Select_Children_At_Random", CoreStyleConstants::Icon16x16));
  306. Set("StateTreeEditor.TryFollowTransitions", new IMAGE_BRUSH_SVG("Icons/Try_Follow_Transitions", CoreStyleConstants::Icon16x16));
  307. Set("StateTreeEditor.StateConditions", new IMAGE_BRUSH_SVG("Icons/State_Conditions", CoreStyleConstants::Icon16x16));
  308. Set("StateTreeEditor.Conditions", new IMAGE_BRUSH_SVG("Icons/Conditions", CoreStyleConstants::Icon16x16));
  309. Set("StateTreeEditor.Conditions.Large", new IMAGE_BRUSH_SVG("Icons/Conditions", CoreStyleConstants::Icon24x24));
  310. Set("StateTreeEditor.Evaluators", new IMAGE_BRUSH_SVG("Icons/Evaluators", CoreStyleConstants::Icon16x16));
  311. Set("StateTreeEditor.Parameters", new IMAGE_BRUSH_SVG("Icons/Parameters", CoreStyleConstants::Icon16x16));
  312. Set("StateTreeEditor.Utility", new IMAGE_BRUSH_SVG("Icons/Utility", CoreStyleConstants::Icon16x16));
  313. Set("StateTreeEditor.Utility.Large", new IMAGE_BRUSH_SVG("Icons/Utility", CoreStyleConstants::Icon24x24));
  314. Set("StateTreeEditor.Tasks", new IMAGE_BRUSH_SVG("Icons/Tasks", CoreStyleConstants::Icon16x16));
  315. Set("StateTreeEditor.Tasks.Large", new IMAGE_BRUSH_SVG("Icons/Tasks", CoreStyleConstants::Icon24x24));
  316. Set("StateTreeEditor.Transitions", new IMAGE_BRUSH_SVG("Icons/Transitions", CoreStyleConstants::Icon16x16));
  317. Set("StateTreeEditor.StateSubtree", new IMAGE_BRUSH_SVG("Icons/State_Subtree", CoreStyleConstants::Icon16x16));
  318. Set("StateTreeEditor.StateLinked", new IMAGE_BRUSH_SVG("Icons/State_Linked", CoreStyleConstants::Icon16x16));
  319. Set("StateTreeEditor.Transition.Dash", new IMAGE_BRUSH_SVG("Icons/Transition_Dash", CoreStyleConstants::Icon16x16, FStyleColors::Foreground));
  320. Set("StateTreeEditor.Transition.Goto", new IMAGE_BRUSH_SVG("Icons/Transition_Goto", CoreStyleConstants::Icon16x16, FStyleColors::Foreground));
  321. Set("StateTreeEditor.Transition.Next", new IMAGE_BRUSH_SVG("Icons/Transition_Next", CoreStyleConstants::Icon16x16, FStyleColors::Foreground));
  322. Set("StateTreeEditor.Transition.Parent", new IMAGE_BRUSH_SVG("Icons/Transition_Parent", CoreStyleConstants::Icon16x16, FStyleColors::Foreground));
  323. Set("StateTreeEditor.Transition.Condition", new IMAGE_BRUSH_SVG("Icons/State_Conditions", CoreStyleConstants::Icon16x16, FStyleColors::AccentGray));
  324. Set("StateTreeEditor.Debugger.Condition.OnTransition", new IMAGE_BRUSH_SVG("Icons/State_Conditions", CoreStyleConstants::Icon16x16, FStyleColors::AccentGray));
  325. Set("StateTreeEditor.Debugger.Log.Warning", new IMAGE_BRUSH_SVG("Icons/Alert", CoreStyleConstants::Icon16x16, FStyleColors::AccentYellow));
  326. Set("StateTreeEditor.Debugger.Log.Error", new IMAGE_BRUSH_SVG("Icons/Failure", CoreStyleConstants::Icon16x16, FStyleColors::AccentRed));
  327. // Common Node Icons
  328. Set("Node.Movement", new IMAGE_BRUSH_SVG("Icons/Movement", CoreStyleConstants::Icon16x16));
  329. Set("Node.Tag", new IMAGE_BRUSH_SVG("Icons/Tag", CoreStyleConstants::Icon16x16));
  330. Set("Node.RunParallel", new IMAGE_BRUSH_SVG("Icons/RunParallel", CoreStyleConstants::Icon16x16));
  331. Set("Node.Task", new IMAGE_BRUSH_SVG("Icons/Task", CoreStyleConstants::Icon16x16));
  332. Set("Node.Text", new IMAGE_BRUSH_SVG("Icons/Text", CoreStyleConstants::Icon16x16));
  333. Set("Node.Function", new IMAGE_BRUSH_SVG("Icons/Function", CoreStyleConstants::Icon16x16));
  334. }
  335. }
  336. void FAbleTreeEditorStyle::Register()
  337. {
  338. FSlateStyleRegistry::RegisterSlateStyle(Get());
  339. }
  340. void FAbleTreeEditorStyle::Unregister()
  341. {
  342. FSlateStyleRegistry::UnRegisterSlateStyle(Get());
  343. }
  344. FAbleTreeEditorStyle& FAbleTreeEditorStyle::Get()
  345. {
  346. static FAbleTreeEditorStyle Instance;
  347. return Instance;
  348. }
  349. const FSlateBrush* FAbleTreeEditorStyle::GetBrushForSelectionBehaviorType(EEzAbilityStateSelectionBehavior InBehaviour, bool bHasChildren, EEzAbilityStateType StateType)
  350. {
  351. if (InBehaviour == EEzAbilityStateSelectionBehavior::None)
  352. {
  353. return Get().GetBrush("StateTreeEditor.SelectNone");
  354. }
  355. else if (InBehaviour == EEzAbilityStateSelectionBehavior::TryEnterState)
  356. {
  357. return Get().GetBrush("StateTreeEditor.TryEnterState");
  358. }
  359. else if (InBehaviour == EEzAbilityStateSelectionBehavior::TrySelectChildrenInOrder)
  360. {
  361. if (!bHasChildren
  362. || StateType == EEzAbilityStateType::Linked
  363. || StateType == EEzAbilityStateType::LinkedAsset)
  364. {
  365. return Get().GetBrush("StateTreeEditor.TryEnterState");
  366. }
  367. else
  368. {
  369. return Get().GetBrush("StateTreeEditor.TrySelectChildrenInOrder");
  370. }
  371. }
  372. return nullptr;
  373. }