Merge branch 'xxSeys1-VisjectConnectionCmPolish'
This commit is contained in:
@@ -40,6 +40,11 @@ namespace FlaxEditor.Surface
|
|||||||
[HideInEditor]
|
[HideInEditor]
|
||||||
public class SurfaceNode : SurfaceControl
|
public class SurfaceNode : SurfaceControl
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The box to draw a highlight around. Drawing will be skipped if null.
|
||||||
|
/// </summary>
|
||||||
|
internal Box highlightBox;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flag used to discard node values setting during event sending for node UI flushing.
|
/// Flag used to discard node values setting during event sending for node UI flushing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1102,6 +1107,9 @@ namespace FlaxEditor.Surface
|
|||||||
Render2D.DrawSprite(icon, new Rectangle(-7, -7, 16, 16), new Color(0.9f, 0.9f, 0.9f));
|
Render2D.DrawSprite(icon, new Rectangle(-7, -7, 16, 16), new Color(0.9f, 0.9f, 0.9f));
|
||||||
Render2D.DrawSprite(icon, new Rectangle(-6, -6, 14, 14), new Color(0.894117647f, 0.0784313725f, 0.0f));
|
Render2D.DrawSprite(icon, new Rectangle(-6, -6, 14, 14), new Color(0.894117647f, 0.0784313725f, 0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (highlightBox != null)
|
||||||
|
Render2D.DrawRectangle(highlightBox.Bounds, style.BorderHighlighted, 2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ namespace FlaxEditor.Surface
|
|||||||
_cmDistributeNodesHorizontallyButton = _cmFormatNodesMenu.ContextMenu.AddButton("Distribute horizontally", Editor.Instance.Options.Options.Input.NodesDistributeHorizontal, () => { DistributeNodes(SelectedNodes, false); });
|
_cmDistributeNodesHorizontallyButton = _cmFormatNodesMenu.ContextMenu.AddButton("Distribute horizontally", Editor.Instance.Options.Options.Input.NodesDistributeHorizontal, () => { DistributeNodes(SelectedNodes, false); });
|
||||||
_cmDistributeNodesVerticallyButton = _cmFormatNodesMenu.ContextMenu.AddButton("Distribute vertically", Editor.Instance.Options.Options.Input.NodesDistributeVertical, () => { DistributeNodes(SelectedNodes, true); });
|
_cmDistributeNodesVerticallyButton = _cmFormatNodesMenu.ContextMenu.AddButton("Distribute vertically", Editor.Instance.Options.Options.Input.NodesDistributeVertical, () => { DistributeNodes(SelectedNodes, true); });
|
||||||
|
|
||||||
_cmRemoveNodeConnectionsButton = menu.AddButton("Remove all connections to that node(s)", () =>
|
_cmRemoveNodeConnectionsButton = menu.AddButton("Remove all connections", () =>
|
||||||
{
|
{
|
||||||
var nodes = ((List<SurfaceNode>)menu.Tag);
|
var nodes = ((List<SurfaceNode>)menu.Tag);
|
||||||
|
|
||||||
@@ -453,8 +453,10 @@ namespace FlaxEditor.Surface
|
|||||||
|
|
||||||
MarkAsEdited();
|
MarkAsEdited();
|
||||||
});
|
});
|
||||||
_cmRemoveNodeConnectionsButton.Enabled = CanEdit;
|
bool anyConnection = SelectedNodes.Any(n => n.GetBoxes().Any(b => b.HasAnyConnection));
|
||||||
_cmRemoveBoxConnectionsButton = menu.AddButton("Remove all connections to that box", () =>
|
_cmRemoveNodeConnectionsButton.Enabled = CanEdit && anyConnection;
|
||||||
|
|
||||||
|
_cmRemoveBoxConnectionsButton = menu.AddButton("Remove all socket connections", () =>
|
||||||
{
|
{
|
||||||
var boxUnderMouse = (Box)_cmRemoveBoxConnectionsButton.Tag;
|
var boxUnderMouse = (Box)_cmRemoveBoxConnectionsButton.Tag;
|
||||||
if (Undo != null)
|
if (Undo != null)
|
||||||
@@ -475,6 +477,16 @@ namespace FlaxEditor.Surface
|
|||||||
var boxUnderMouse = GetChildAtRecursive(location) as Box;
|
var boxUnderMouse = GetChildAtRecursive(location) as Box;
|
||||||
_cmRemoveBoxConnectionsButton.Enabled = boxUnderMouse != null && boxUnderMouse.HasAnyConnection;
|
_cmRemoveBoxConnectionsButton.Enabled = boxUnderMouse != null && boxUnderMouse.HasAnyConnection;
|
||||||
_cmRemoveBoxConnectionsButton.Tag = boxUnderMouse;
|
_cmRemoveBoxConnectionsButton.Tag = boxUnderMouse;
|
||||||
|
|
||||||
|
if (boxUnderMouse != null)
|
||||||
|
{
|
||||||
|
boxUnderMouse.ParentNode.highlightBox = boxUnderMouse;
|
||||||
|
menu.VisibleChanged += (c) =>
|
||||||
|
{
|
||||||
|
if (!c.Visible)
|
||||||
|
boxUnderMouse.ParentNode.highlightBox = null;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controlUnderMouse?.OnShowSecondaryContextMenu(menu, controlUnderMouse.PointFromParent(location));
|
controlUnderMouse?.OnShowSecondaryContextMenu(menu, controlUnderMouse.PointFromParent(location));
|
||||||
|
|||||||
Reference in New Issue
Block a user