- Visject Drag and Drop now tries to get a parameter setter node while holding the alt key
- Visual Script surface now returns a setter node
This commit is contained in:
@@ -129,7 +129,12 @@ namespace FlaxEditor.Surface
|
|||||||
/// <param name="args">The drag drop arguments data.</param>
|
/// <param name="args">The drag drop arguments data.</param>
|
||||||
protected virtual void HandleDragDropParameters(List<string> objects, DragDropEventArgs args)
|
protected virtual void HandleDragDropParameters(List<string> objects, DragDropEventArgs args)
|
||||||
{
|
{
|
||||||
var arch = GetParameterGetterNodeArchetype(out var groupId);
|
// Try to get the setter node when holding the ALT key, otherwise get the getter node
|
||||||
|
if (!Input.GetKey(KeyboardKeys.Alt) || !TryGetParameterSetterNodeArchetype(out var groupId, out var arch))
|
||||||
|
{
|
||||||
|
arch = GetParameterGetterNodeArchetype(out groupId);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < objects.Count; i++)
|
for (int i = 0; i < objects.Count; i++)
|
||||||
{
|
{
|
||||||
var parameter = GetParameter(objects[i]);
|
var parameter = GetParameter(objects[i]);
|
||||||
@@ -156,5 +161,18 @@ namespace FlaxEditor.Surface
|
|||||||
groupId = 6;
|
groupId = 6;
|
||||||
return Archetypes.Parameters.Nodes[0];
|
return Archetypes.Parameters.Nodes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tries to get the parameter setter node archetype to use.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="groupId">The group ID.</param>
|
||||||
|
/// <param name="archetype">The node archetype.</param>
|
||||||
|
/// <returns>True if a setter node exists.</returns>
|
||||||
|
protected virtual bool TryGetParameterSetterNodeArchetype(out ushort groupId, out NodeArchetype archetype)
|
||||||
|
{
|
||||||
|
groupId = 0;
|
||||||
|
archetype = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,6 +187,14 @@ namespace FlaxEditor.Surface
|
|||||||
return Archetypes.Parameters.Nodes[2];
|
return Archetypes.Parameters.Nodes[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override bool TryGetParameterSetterNodeArchetype(out ushort groupId, out NodeArchetype archetype)
|
||||||
|
{
|
||||||
|
groupId = 6;
|
||||||
|
archetype = Archetypes.Parameters.Nodes[3];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void OnShowPrimaryMenu(VisjectCM activeCM, Float2 location, Box startBox)
|
protected override void OnShowPrimaryMenu(VisjectCM activeCM, Float2 location, Box startBox)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user