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 ListGroups(this GraphView view); static bool HasAnyElement( this GraphView view, Func predicate ); static List Nodes< T >(this Group group); static bool IsChildOfInclusive(this VisualElement self, VisualElement test); static Edge[] FindEdgesBetweenNodes( this GraphView view, IActionImplementor node, IActionImplementor otherNode ); static void TryRemove< T >(this List list, T item); 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 ListGroups(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 Group 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 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 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 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.