Class ScriptGraphView
The ScriptGraphView allows for the visual editing of a script graph.
Inheritance
CallbackEventHandler
Focusable
VisualElement
GraphView
ScriptGraphView
Implements
IEventHandler
ITransform
ITransitionAnimations
IExperimentalFeatures
IVisualElementScheduler
IResolvedStyle
ISelection
Inherited Members
GraphView.ports
GraphView.UpdateViewTransform(Vector3, Vector3)
GraphView.ValidateTransform()
GraphView.AddToSelection(ISelectable)
GraphView.RemoveFromSelection(ISelectable)
GraphView.ClearSelection()
GraphView.ExecuteDefaultActionAtTarget(EventBase)
GraphView.ExecuteDefaultAction(EventBase)
GraphView.CopySelectionCallback()
GraphView.CutSelectionCallback()
GraphView.PasteCallback()
GraphView.DuplicateSelectionCallback()
GraphView.DeleteSelectionCallback(GraphView.AskUser)
GraphView.AddElement(GraphElement)
GraphView.RemoveElement(GraphElement)
GraphView.DeleteSelection()
GraphView.FrameAll()
GraphView.FrameSelection()
GraphView.FrameOrigin()
GraphView.FramePrev()
GraphView.FrameNext()
GraphView.CalculateRectToFitAll(VisualElement)
GraphView.GetBlackboard()
GraphView.ReleaseBlackboard(Blackboard)
GraphView.nodeCreationRequest
GraphView.graphViewChanged
GraphView.groupTitleChanged
GraphView.elementsAddedToGroup
GraphView.elementsRemovedFromGroup
GraphView.elementsInsertedToStackNode
GraphView.elementsRemovedFromStackNode
GraphView.elementResized
GraphView.viewTransformChanged
GraphView.supportsWindowedBlackboard
GraphView.contentViewContainer
GraphView.viewport
GraphView.viewTransform
GraphView.isReframable
GraphView.contentContainer
GraphView.graphElements
GraphView.nodes
GraphView.edges
GraphView.minScale
GraphView.maxScale
GraphView.scaleStep
GraphView.referenceScale
GraphView.scale
GraphView.zoomerMaxElementCountWithPixelCacheRegen
GraphView.selection
GraphView.canCopySelection
GraphView.canCutSelection
GraphView.canPaste
GraphView.canDuplicateSelection
GraphView.canDeleteSelection
GraphView.serializeGraphElements
GraphView.canPasteSerializedData
GraphView.unserializeAndPaste
GraphView.deleteSelection
VisualElement.disabledUssClassName
VisualElement.Focus()
VisualElement.SendEvent(EventBase)
VisualElement.MarkDirtyRepaint()
VisualElement.ContainsPoint(Vector2)
VisualElement.Overlaps(Rect)
VisualElement.ToString()
VisualElement.GetClasses()
VisualElement.ClearClassList()
VisualElement.FindAncestorUserData()
VisualElement.Add(VisualElement)
VisualElement.Remove(VisualElement)
VisualElement.Clear()
VisualElement.IndexOf(VisualElement)
VisualElement.Children()
VisualElement.BringToFront()
VisualElement.SendToBack()
VisualElement.PlaceBehind(VisualElement)
VisualElement.PlaceInFront(VisualElement)
VisualElement.RemoveFromHierarchy()
VisualElement.GetFirstOfType<T>()
VisualElement.GetFirstAncestorOfType<T>()
VisualElement.Contains(VisualElement)
VisualElement.FindCommonAncestor(VisualElement)
VisualElement.viewDataKey
VisualElement.userData
VisualElement.canGrabFocus
VisualElement.focusController
VisualElement.usageHints
VisualElement.transform
VisualElement.layout
VisualElement.contentRect
VisualElement.paddingRect
VisualElement.worldBound
VisualElement.localBound
VisualElement.worldTransform
VisualElement.pickingMode
VisualElement.name
VisualElement.enabledInHierarchy
VisualElement.enabledSelf
VisualElement.visible
VisualElement.generateVisualContent
VisualElement.experimental
VisualElement.hierarchy
VisualElement.cacheAsBitmap
VisualElement.parent
VisualElement.panel
VisualElement.childCount
VisualElement.schedule
VisualElement.style
VisualElement.customStyle
VisualElement.resolvedStyle
VisualElement.styleSheets
VisualElement.tooltip
Focusable.Blur()
Focusable.focusable
Focusable.tabIndex
Focusable.delegatesFocus
CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
CallbackEventHandler.HandleEvent(EventBase)
CallbackEventHandler.HasTrickleDownHandlers()
CallbackEventHandler.HasBubbleUpHandlers()
Syntax
public class ScriptGraphView : GraphView, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, ISelection
Constructors
ScriptGraphView(string, bool)
Creates a new graph view.
Declaration
public ScriptGraphView(string title, bool showDebugInfo)
Parameters
Type |
Name |
Description |
string |
title |
The title to display.
|
bool |
showDebugInfo |
Whether or not to display the debug info on node views.
|
Properties
Graph
Gets the graph that's currently being displayed/edited.
Declaration
public ScriptGraphGraph Graph { get; }
Property Value
IsClearing
Declaration
public bool IsClearing { get; }
Property Value
MaxZoom
Declaration
public static float MaxZoom { get; set; }
Property Value
MinZoom
Declaration
public static float MinZoom { get; set; }
Property Value
NodeViewTypesRegistry
Gets the registry that contains all the node view types for each node type.
Declaration
protected ScriptNodeViewTypesRegistry NodeViewTypesRegistry { get; }
Property Value
ReferenceNodeTypes
Declaration
public HashSet<Type> ReferenceNodeTypes { get; }
Property Value
Selection
Declaration
public ScriptGraphViewSelection Selection { get; }
Property Value
ShowDebugInfo
Gets/sets whether to show debug info on the node views.
Declaration
public bool ShowDebugInfo { get; set; }
Property Value
ZoomStep
Declaration
public static float ZoomStep { get; set; }
Property Value
Methods
AddNewGroupNode(GroupNode, Vector2)
Declaration
public void AddNewGroupNode(GroupNode newGroupNode, Vector2 position)
Parameters
Type |
Name |
Description |
GroupNode |
newGroupNode |
|
Vector2 |
position |
|
AddNewNode(IScriptNode, Vector2, bool)
Adds the given node to the graph and graph view at the given position.
Declaration
public void AddNewNode(IScriptNode newNode, Vector2 position, bool autoAddToGroup = true)
Parameters
Type |
Name |
Description |
IScriptNode |
newNode |
The node to add.
|
Vector2 |
position |
The position in the graph view.
|
bool |
autoAddToGroup |
If set to true, nodes will be automatically added to any group node they are on top of.
|
AddNewReferenceNode(ReferenceNode, Vector2)
Adds a reference node to the graph.
Declaration
public void AddNewReferenceNode(ReferenceNode referenceNode, Vector2 position)
Parameters
Type |
Name |
Description |
ReferenceNode |
referenceNode |
The reference node to add.
|
Vector2 |
position |
The position where the reference node should be placed in the graph.
|
Add menu items to the contextual menu.
Declaration
public override void BuildContextualMenu(ContextualMenuPopulateEvent e)
Parameters
Type |
Name |
Description |
ContextualMenuPopulateEvent |
e |
|
Overrides
UnityEditor.Experimental.GraphView.GraphView.BuildContextualMenu(UnityEngine.UIElements.ContextualMenuPopulateEvent)
ClearHighlights()
Removes all the highlight colors from nodes.
Declaration
public void ClearHighlights()
Connect(InPort, OutPort, ReferenceNode)
Declaration
public Edge Connect(InPort inPort, OutPort outPort, ReferenceNode referenceNode = null)
Parameters
Returns
CreateReferenceNodes(ScriptNodeView[])
Declaration
public void CreateReferenceNodes(ScriptNodeView[] referenceCandidateNodeViews)
Parameters
Dispose()
Declaration
FrameNode(INode)
Focus view on the node's view.
Declaration
public void FrameNode(INode node)
Parameters
Type |
Name |
Description |
INode |
node |
The node.
|
FrameNodes(IEnumerable<INode>)
Focus view on the nodes' view.
Declaration
public void FrameNodes(IEnumerable<INode> frameNodes)
Parameters
GetCompatiblePorts(Port, NodeAdapter)
Declaration
public override List<Port> GetCompatiblePorts(Port startPort, NodeAdapter nodeAdapter)
Parameters
Type |
Name |
Description |
Port |
startPort |
|
NodeAdapter |
nodeAdapter |
|
Returns
Type |
Description |
List<Port> |
|
Overrides
UnityEditor.Experimental.GraphView.GraphView.GetCompatiblePorts(UnityEditor.Experimental.GraphView.Port, UnityEditor.Experimental.GraphView.NodeAdapter)
GetConstField(Port)
Declaration
public VisualElement GetConstField(Port edgeInput)
Parameters
Type |
Name |
Description |
Port |
edgeInput |
|
Returns
Type |
Description |
VisualElement |
|
GetGroupView(GroupNode)
Declaration
public GroupNodeView GetGroupView(GroupNode groupNode)
Parameters
Returns
GetReferenceNodeView(ReferenceNode)
Declaration
public ScriptNodeView GetReferenceNodeView(ReferenceNode referenceNode)
Parameters
Returns
GetView(IScriptNode)
Declaration
public ScriptNodeView GetView(IScriptNode node)
Parameters
Returns
HighlightFailedNode(IScriptNode, bool)
Colors the node's view red in the script graph view, to indicate that it failed.
Declaration
public void HighlightFailedNode(IScriptNode node, bool warning = false)
Parameters
Type |
Name |
Description |
IScriptNode |
node |
The node to mark.
|
bool |
warning |
If true, it's just a warning, color orange instead of red.
|
HighlightFailedNodes(IEnumerable<IScriptNode>, bool)
Colors the node's view red in the script graph view, to indicate that it failed.
Declaration
public void HighlightFailedNodes(IEnumerable<IScriptNode> markNodes, bool warning = false)
Parameters
Type |
Name |
Description |
IEnumerable<IScriptNode> |
markNodes |
The nodes to mark.
|
bool |
warning |
If true, it's just a warning, color orange instead of red.
|
HighlightSearchedNode(INode)
Declaration
public void HighlightSearchedNode(INode node)
Parameters
Type |
Name |
Description |
INode |
node |
|
Initialize()
Initializes the script graph view.
Declaration
InitializePort(Port, VisualElement)
Declaration
public void InitializePort(Port port, VisualElement constFieldContainer = null)
Parameters
Type |
Name |
Description |
Port |
port |
|
VisualElement |
constFieldContainer |
|
Load(ScriptGraphGraph)
Loads the given script graph into the graph view.
Declaration
public void Load(ScriptGraphGraph graphToLoad)
Parameters
Reload()
Declaration
RemoveFromGroup(GroupNode, IScriptNode)
Declaration
public void RemoveFromGroup(GroupNode groupNode, IScriptNode node)
Parameters
RemoveFromGroup(GroupNode, ReferenceNode)
Declaration
public void RemoveFromGroup(GroupNode groupNode, ReferenceNode referenceNode)
Parameters
ToggleDisabled(IProcessorNode[])
Declaration
public void ToggleDisabled(IProcessorNode[] processorNodes)
Parameters
TriggerKeyDown(KeyCode, EventModifiers, Vector2)
Declaration
public void TriggerKeyDown(KeyCode keyCode, EventModifiers modifiers, Vector2 originalMousePosition)
Parameters
Type |
Name |
Description |
KeyCode |
keyCode |
|
EventModifiers |
modifiers |
|
Vector2 |
originalMousePosition |
|
Events
OnInitialized
Event triggers whenever the script graph view has been initialized.
Declaration
public event Action OnInitialized
Event Type
OnShowDebugInfoChanged
Event triggers when the debug info has been updated.
Declaration
public event Action<bool> OnShowDebugInfoChanged
Event Type
Implements
UnityEngine.UIElements.IEventHandler
UnityEngine.UIElements.ITransform
UnityEngine.UIElements.Experimental.ITransitionAnimations
UnityEngine.UIElements.IExperimentalFeatures
UnityEngine.UIElements.IVisualElementScheduler
UnityEngine.UIElements.IResolvedStyle
UnityEditor.Experimental.GraphView.ISelection