Add red/green highlights to debug BT node decorator result
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user