Minor improvements

This commit is contained in:
2023-09-19 21:37:24 +02:00
parent e9cf188c2d
commit f0b5d3b838
3 changed files with 12 additions and 3 deletions
@@ -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);
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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;