Add reroute node usage to Visject only if surface type allows it
This commit is contained in:
@@ -299,7 +299,7 @@ namespace FlaxEditor.Surface
|
||||
if (IsMouseOver && !_leftMouseDown && !IsPrimaryMenuOpened)
|
||||
{
|
||||
var nextViewScale = ViewScale + delta * 0.1f;
|
||||
|
||||
|
||||
if (delta > 0 && !_rightMouseDown)
|
||||
{
|
||||
// Scale towards mouse when zooming in
|
||||
@@ -314,7 +314,7 @@ namespace FlaxEditor.Surface
|
||||
ViewScale = nextViewScale;
|
||||
ViewCenterPosition = viewCenter;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -329,12 +329,12 @@ namespace FlaxEditor.Surface
|
||||
if (!handled)
|
||||
CustomMouseDoubleClick?.Invoke(ref location, button, ref handled);
|
||||
|
||||
if (!handled && CanEdit)
|
||||
// Insert reroute node
|
||||
if (!handled && CanEdit && CanUseNodeType(7, 29))
|
||||
{
|
||||
var mousePos = _rootControl.PointFromParent(ref _mousePos);
|
||||
if (IntersectsConnection(mousePos, out InputBox inputBox, out OutputBox outputBox) && GetControlUnderMouse() == null)
|
||||
{
|
||||
// Insert reroute node
|
||||
if (Undo != null)
|
||||
{
|
||||
bool undoEnabled = Undo.Enabled;
|
||||
|
||||
@@ -524,6 +524,27 @@ namespace FlaxEditor.Surface
|
||||
/// </summary>
|
||||
public virtual bool CanSetParameters => false;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified node archetype can be used in the surface.
|
||||
/// </summary>
|
||||
/// <param name="groupID">The nodes group archetype identifier.</param>
|
||||
/// <param name="typeID">The node archetype identifier.</param>
|
||||
/// <returns>True if can use this node archetype, otherwise false.</returns>
|
||||
public bool CanUseNodeType(ushort groupID, ushort typeID)
|
||||
{
|
||||
var result = false;
|
||||
var nodeArchetypes = NodeArchetypes ?? NodeFactory.DefaultGroups;
|
||||
if (NodeFactory.GetArchetype(nodeArchetypes, groupID, typeID, out var groupArchetype, out var nodeArchetype))
|
||||
{
|
||||
var flags = nodeArchetype.Flags;
|
||||
nodeArchetype.Flags &= ~NodeFlags.NoSpawnViaGUI;
|
||||
nodeArchetype.Flags &= ~NodeFlags.NoSpawnViaPaste;
|
||||
result = CanUseNodeType(groupArchetype, nodeArchetype);
|
||||
nodeArchetype.Flags = flags;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified node archetype can be used in the surface.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user