class MAGES::SceneGraph::Editor::Utilities¶
Overview¶
Utilities for the graph view. More…
class Utilities { public: // methods static Vector2 MouseToGraphViewPosition( this GraphView graphView, Vector2 mousePosition ); static void FrameNode(this GraphView view, GraphElement node); static List<GroupNode> Groups(this GraphView view); static bool HasAnyElement( this GraphView view, Funcpredicate ); static List Nodes< T >(this GroupNode group); static bool IsChildOfInclusive(this VisualElement self, VisualElement test); static string ValueToHumanReadableString(this SerializedProperty property); static Edge[] FindEdgesBetweenNodes( this GraphView view, IActionImplementor node, IActionImplementor otherNode ); static bool IsConnectedTo(this Port port, Port otherPort); static void TryRemove< T >(this List list, T item); static void AddObjectReferenceValue( this SerializedProperty list, UnityEngine.Object objectReferenceValue ); static int LookupObjectReferenceValue( this SerializedProperty list, UnityEngine.Object objectReferenceValue ); static void RemoveAt(this SerializedProperty list, int index); static void RemoveObjectReferenceValue( this SerializedProperty list, UnityEngine.Object objectReferenceValue ); static void CleanupObjectReferenceValues(this SerializedProperty list); static void RemoveDuplicateObjectReferenceValues(this SerializedProperty list); static IActionImplementor GetPortImplementor(this Port port); };
Detailed Documentation¶
Utilities for the graph view.
Methods¶
static Vector2 MouseToGraphViewPosition( this GraphView graphView, Vector2 mousePosition )
Converts mouse relative position to graph position.
Useful for creating nodes at the mouse position.
Parameters:
graphView |
The view. |
mousePosition |
The mouse position; usually obtained via action.eventInfo.localMousePosition. |
Returns:
The position in the graph’s transformation space.
static void FrameNode(this GraphView view, GraphElement node)
Frames a specific node in the graph.
Parameters:
view |
The graph view. |
node |
The node to frame. |
static List<GroupNode> Groups(this GraphView view)
Gets all groups in a graph.
Parameters:
view |
The graph view. |
Returns:
List of groups.
static bool HasAnyElement( this GraphView view, Funcpredicate )
Returns true if the graph has any nodes.
Parameters:
view |
The view. |
predicate |
The predicate. |
Returns:
True if it has nodes.
static ListNodes< T >(this GroupNode group)
Gets all nodes of a specific type in a group.
Parameters:
T |
The type of node. |
group |
The group instance. |
Returns:
List of nodes that belong in group.
static bool IsChildOfInclusive(this VisualElement self, VisualElement test)
Returns true if the element is a child of the test element.
Parameters:
self |
The element. |
test |
The test element. |
Returns:
Value indicating whether or not test is an ancestor of self, or the same element.
static string ValueToHumanReadableString(this SerializedProperty property)
Converts a property value to a human-readable string.
Parameters:
property |
The property. |
Returns:
The assumed value.
static Edge[] FindEdgesBetweenNodes( this GraphView view, IActionImplementor node, IActionImplementor otherNode )
Find all the direct edges between two nodes, regardless of direction.
Parameters:
view |
The view. |
node |
The first node. |
otherNode |
The second node. |
Returns:
An array of all the edges that connect those two nodes.
static bool IsConnectedTo(this Port port, Port otherPort)
Get a value indicating whether a port is connected to another port.
Parameters:
port |
The first port. |
otherPort |
The second port. |
Returns:
True if the connection already exists.
static void TryRemove< T >(this Listlist, T item)
Attempt to remove an item from a list, by index.
Parameters:
T |
The type of the contained list element(s). |
list |
The list. |
item |
The instance of the item to be removed. |
static void AddObjectReferenceValue( this SerializedProperty list, UnityEngine.Object objectReferenceValue )
Adds an item to a serialized list.
Parameters:
list |
The list. |
objectReferenceValue |
The item to add as objectReferenceValue. |
static int LookupObjectReferenceValue( this SerializedProperty list, UnityEngine.Object objectReferenceValue )
Looks up an object reference value in a serialized list.
Parameters:
list |
The list. |
objectReferenceValue |
The object to look for. |
Returns:
Index of the object, if found, otherwise -1.
static void RemoveAt(this SerializedProperty list, int index)
Removes an item from a serialized list.
Parameters:
list |
The list. |
index |
The index of the item to remove. |
static void RemoveObjectReferenceValue( this SerializedProperty list, UnityEngine.Object objectReferenceValue )
Removes an object reference value from a serialized list.
Parameters:
list |
The list. |
objectReferenceValue |
The value to remove. |
static void CleanupObjectReferenceValues(this SerializedProperty list)
Cleans up a serialized list by removing null elements.
Parameters:
list |
The list. |
static void RemoveDuplicateObjectReferenceValues(this SerializedProperty list)
Removes duplicate object reference values from a serialized list.
Parameters:
list |
The list. |
static IActionImplementor GetPortImplementor(this Port port)
Gets the parent node (either BaseNode or ScopeNode) of a port.
Parameters:
port |
The port. |
Returns:
The parent of the port.