Add red/green highlights to debug BT node decorator result

This commit is contained in:
2026-09-24 22:57:06 +02:00
parent d56fdcce57
commit 0d4ea64caa
6 changed files with 39 additions and 2 deletions
+18 -1
View File
@@ -209,7 +209,25 @@ String Behavior::GetNodeDebugInfo(const BehaviorTreeNode* node, Behavior* behavi
if (!node)
return String::Empty;
BehaviorUpdateContext context;
InitNodeDebugContext(node, behavior, context);
return node->GetDebugInfo(context);
}
int32 Behavior::GetDecoratorDebugResult(BehaviorTreeDecorator* node, Behavior* behavior)
{
if (!node)
return -1;
BehaviorUpdateContext context;
InitNodeDebugContext(node, behavior, context);
return node->CanUpdate(context) ? 1 : 0;
}
void Behavior::InitNodeDebugContext(const BehaviorTreeNode* node, Behavior* behavior, BehaviorUpdateContext& context)
{
// Zero out context
Platform::MemoryClear(&context, sizeof(context));
// Check if the node is relevant (active in tree with state created)
if (GetNodeDebugRelevancy(node, behavior))
{
// Pass behavior and knowledge data only for relevant nodes to properly access it
@@ -219,7 +237,6 @@ String Behavior::GetNodeDebugInfo(const BehaviorTreeNode* node, Behavior* behavi
context.RelevantNodes = &behavior->_knowledge.RelevantNodes;
context.Time = behavior->_totalTime;
}
return node->GetDebugInfo(context);
}
#endif
+2
View File
@@ -110,5 +110,7 @@ private:
// Editor-only utilities to debug nodes state.
API_FUNCTION(Internal) static bool GetNodeDebugRelevancy(const BehaviorTreeNode* node, const Behavior* behavior);
API_FUNCTION(Internal) static String GetNodeDebugInfo(const BehaviorTreeNode* node, Behavior* behavior);
API_FUNCTION(Internal) static int32 GetDecoratorDebugResult(class BehaviorTreeDecorator* node, Behavior* behavior);
static void InitNodeDebugContext(const BehaviorTreeNode* node, Behavior* behavior, BehaviorUpdateContext& context);
#endif
};
+1
View File
@@ -300,6 +300,7 @@ namespace FlaxEngine
TextBoxBackgroundSelected = Color.FromBgra(0xFF3F3F46),
CollectionBackgroundColor = Color.FromBgra(0x14CCCCCC),
ProgressNormal = Color.FromBgra(0xFF0ad328),
ProgressError = new Color(0.79f, 0.146f, 0.0f, 1.0f),
Statusbar = new Style.StatusbarStyle
{
PlayMode = Color.FromBgra(0xFF2F9135),
+6
View File
@@ -170,6 +170,12 @@ namespace FlaxEngine.GUI
[EditorOrder(200)]
public Color ProgressNormal;
/// <summary>
/// The progress error color.
/// </summary>
[EditorOrder(201)]
public Color ProgressError;
/// <summary>
/// The selection and drag drop highlights colors.
/// </summary>