tree based bt debugger
This commit is contained in:
parent
c9967f09d9
commit
b5d5a8f9f3
12 changed files with 271 additions and 19 deletions
38
addons/BehaviorDebug/BehaviorDebug.cs
Normal file
38
addons/BehaviorDebug/BehaviorDebug.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#if TOOLS
|
||||
|
||||
using Dancer;
|
||||
using Godot.Collections;
|
||||
|
||||
[Tool]
|
||||
public partial class BehaviorDebug : EditorPlugin
|
||||
{
|
||||
private BtEditorDebugger _btEditorDebugger = new BtEditorDebugger();
|
||||
|
||||
public override void _EnterTree() => AddDebuggerPlugin(_btEditorDebugger);
|
||||
public override void _ExitTree() => RemoveDebuggerPlugin(_btEditorDebugger);
|
||||
|
||||
private partial class BtEditorDebugger : EditorDebuggerPlugin
|
||||
{
|
||||
private BehaviorDebugControl? _behaviorTreeView1;
|
||||
private static readonly PackedScene DebuggerScene = GD.Load<PackedScene>("res://addons/BehaviorDebug/behavior_debug_dock.tscn");
|
||||
public override bool _HasCapture(string capture) => capture == "behavior_debug";
|
||||
public override bool _Capture(string message, Array data, int sessionId)
|
||||
{
|
||||
if (message == "behavior_debug:add_tree")
|
||||
{
|
||||
_behaviorTreeView1?.AddTreeData(data);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void _SetupSession(int sessionId)
|
||||
{
|
||||
_behaviorTreeView1 = DebuggerScene.Instantiate<BehaviorDebugControl>();
|
||||
_behaviorTreeView1.Name = "Behavior Trees";
|
||||
var session = GetSession(sessionId);
|
||||
session.AddSessionTab(_behaviorTreeView1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue