diff --git a/Source/Editor/Surface/Archetypes/BehaviorTree.cs b/Source/Editor/Surface/Archetypes/BehaviorTree.cs index 9bb82fe7c..bfc5bfad8 100644 --- a/Source/Editor/Surface/Archetypes/BehaviorTree.cs +++ b/Source/Editor/Surface/Archetypes/BehaviorTree.cs @@ -701,6 +701,7 @@ namespace FlaxEditor.Surface.Archetypes Color = Style.Current.ForegroundGrey, Parent = this, Margin = new Margin(1), + Visible = Surface.CanEdit, Brush = new SpriteBrush(Editor.Instance.Icons.DragBar12), Tag = this, Drag = img => { img.DoDragDrop(_dragDecorator.ToDragData(ID)); } @@ -751,6 +752,14 @@ namespace FlaxEditor.Surface.Archetypes } } + public override void OnSurfaceCanEditChanged(bool canEdit) + { + base.OnSurfaceCanEditChanged(canEdit); + + if (_dragIcon != null) + _dragIcon.Visible = canEdit; + } + public override DragDropEffect OnDragEnter(ref Float2 location, DragData data) { var result = base.OnDragEnter(ref location, data); diff --git a/Source/Editor/Surface/SurfaceNode.cs b/Source/Editor/Surface/SurfaceNode.cs index 944cea6d0..780ef81f0 100644 --- a/Source/Editor/Surface/SurfaceNode.cs +++ b/Source/Editor/Surface/SurfaceNode.cs @@ -217,7 +217,7 @@ namespace FlaxEditor.Surface width = Mathf.Max(width, control.Right + 4 - Constants.NodeMarginX); height = Mathf.Max(height, control.Bottom + 4 - Constants.NodeMarginY - Constants.NodeHeaderSize); } - else + else if (!_headerRect.Intersects(control.Bounds)) { width = Mathf.Max(width, control.Width + 4); height = Mathf.Max(height, control.Height + 4); diff --git a/Source/Engine/AI/Behavior.cpp b/Source/Engine/AI/Behavior.cpp index 8234125f4..8ec389469 100644 --- a/Source/Engine/AI/Behavior.cpp +++ b/Source/Engine/AI/Behavior.cpp @@ -171,7 +171,7 @@ void Behavior::OnDisable() bool Behavior::GetNodeDebugRelevancy(const BehaviorTreeNode* node, const Behavior* behavior) { - return node && behavior && behavior->_knowledge.RelevantNodes.Get(node->_executionIndex); + return node && behavior && node->_executionIndex != -1 && behavior->_knowledge.RelevantNodes.Get(node->_executionIndex); } String Behavior::GetNodeDebugInfo(const BehaviorTreeNode* node, Behavior* behavior) @@ -180,7 +180,7 @@ String Behavior::GetNodeDebugInfo(const BehaviorTreeNode* node, Behavior* behavi return String::Empty; BehaviorUpdateContext context; Platform::MemoryClear(&context, sizeof(context)); - if (behavior && behavior->_knowledge.RelevantNodes.Get(node->_executionIndex)) + if (behavior && node->_executionIndex != -1 && behavior->_knowledge.RelevantNodes.Get(node->_executionIndex)) { // Pass behavior and knowledge data only for relevant nodes to properly access it context.Behavior = behavior;