Experimental: this API is experimental and might be changed or removed in the future.

GraphView

class in UnityEditor.Experimental.UIElements.GraphView

/

继承自:Experimental.UIElements.VisualElement


实现接口:IEventHandler, ISelection, IStyle, ITransform, IUIElementDataWatch, IVisualElementScheduler

切换到手册

描述

主 GraphView 类。

变量

canPasteSerializedData询问序列化数据是否可以粘贴。
contentViewContainer主内容容器。
deleteSelection删除所选项回调。
edges图中的所有边缘。
elementResized元素调整大小回调。
elementsAddedToGroupCallback for when GraphElements are added to the group.
elementsInsertedToStackNodeCallback for when GraphElements are inserted into a StackNode.
elementsRemovedFromGroupCallback for when GraphElements are removed from the group.
elementsRemovedFromStackNodeCallback for when GraphElements are removed from a StackNode.
graphElements图中的所有 GraphElements。
graphViewChanged在图中发生特定更改时使用的回调。请参阅 GraphViewChange。
groupTitleChangedCallback for when a group title is changed.
isReframable所选项是否可以重新构造。
maxScale最大缩放级别。
minScale最小缩放级别。
nodeCreationRequest在用户请求显示节点创建窗口时使用的回调。
nodes当前图中的所有节点。
ports当前图中的所有端口。
referenceScale参考缩放级别。
scale当前图的缩放级别。
scaleStep缩放步骤。详情请参阅 ContentZoomer.scaleStep。
selection图中所有当前已选择的元素。
serializeGraphElements用于序列化图形元素以便实现复制/粘贴和其他操作的回调。
unserializeAndPaste用于取消序列化图形元素并将其添加到图中的回调。
viewport图形视口。这就是目前的情况。
viewTransform图形的视图变换。
viewTransformChanged视图变换更改回调。
zoomerMaxElementCountWithPixelCacheRegen图中的元素数量。若超过该数量,缩放操控器将在您每次勾选时关闭像素缓存再生功能,以免性能下降。

公共函数

AddElement添加新的 GraphElement。应使用这个而非 Add() 来添加 GraphElement。
AddLayer为 GraphView 添加一个新层。
AddToSelection向所选项添加元素。
BuildContextualMenu向上下文菜单添加菜单项。
CalculateRectToFitAll计算矩形大小和位置以适应图中的所有元素。
ClearSelection清除所选项。
DeleteElements从图形视图中删除元素。
DeleteSelection删除选择的元素。
FrameAll聚焦查看图中所有元素。
FrameNext当前选择一个元素后,聚焦查看下一个元素。
FrameOrigin聚焦查看图形原点。
FramePrev聚焦查看当前所选元素之前的上一个元素。
FrameSelection聚焦查看当前所选元素。
GetCompatiblePorts获取与给定端口兼容的所有端口。
GetEdgeByGuid根据边缘 GUID 获取边缘。
GetElementByGuid获取任何带有给定 GUID 的元素。
GetNodeByGuid获取带有给定 GUID 的节点。
GetPortByGuid根据端口 GUID 获取端口。
OnPersistentDataReady在持久性数据(例如缩放级别和所选项)准备好进行检索和恢复时调用。
RemoveElement从图中删除元素。
RemoveFromSelection从所选项中删除元素。
SetupZoom设置缩放属性。
UpdateViewTransform更新视口变换。

受保护的函数

CanPasteSerializedData用于查看序列化数据是否可以粘贴的默认方法。
DeleteSelectionOperation删除所选项的默认方法。
SerializeGraphElements序列化图形元素的默认方法。
UnserializeAndPasteOperation取消序列化并粘贴元素的默认方法。
ValidateTransform验证视图变换。

静态函数

CalculateFrameTransform根据缩放级别和窗口或父对象的大小计算视图变换。

委托

CanPasteSerializedDataDelegate用于查看序列化数据是否可以粘贴的委托。
DeleteSelectionDelegate删除所选项的委托。
ElementResized元素调整大小委托。
GraphViewChanged用于指示 GraphView 中的更改(通常由操控器执行)的委托。
SerializeGraphElementsDelegate用于序列化图形元素的委托。
UnserializeAndPasteDelegate用于取消序列化并粘贴元素的委托。
ViewTransformChanged视图变换更改(缩放)委托。

继承的成员

静态变量

defaultFocusIndexThe default focus index for newly created elements.

变量

canGrabFocus如果元素可以获得焦点,则返回 true。
focusController返回此元素的焦点控制器。
focusIndex用于对焦点环中可获得焦点的元素排序的整数。负值表示元素不能获得焦点。
childCount 此对象的 contentContainer 中的子元素数
clippingOptions是否应将此元素裁剪为绘制到其边界。
contentContainer 子元素通常添加到此元素中
dataWatch对此元素 DataWatch 接口的访问。
enabledInHierarchy如果 VisualElement 是在它自己的层级视图中启用,则返回 true。
enabledSelf如果 VisualElement 是本地启用,则返回 true。
persistenceKey用于查看数据持久性(即树展开状态、滚动位置、缩放级别)。
schedule检索此 VisualElement 的 IVisualElementScheduler
shadow 访问此元素物理层级视图
style引用此元素的样式对象。
this[int] 访问此元素物理层级视图
tooltipText to display inside an information box after the user hovers the element for a small amount of time.
userData此属性可用于将特定于应用程序的用户数据与此 VisualElement 关联。

公共函数

HandleEvent处理事件,通常是通过执行与事件关联的回调处理事件。
HasBubbleUpHandlersReturn true if event handlers for the event propagation BubbleUp phase have been attached on this object.
HasTrickleDownHandlersReturns true if event handlers, for the event propagation TrickleDown phase, are attached to this object.
RegisterCallbackAdds an event handler to the instance. If the event handler has already been registered for the same phase (either TrickleDown or BubbleUp) then this method has no effect.
SendEventSends an event to the event handler.
UnregisterCallback从此实例删除回调。
Blur通知元素释放焦点。
Focus尝试让此元素获得焦点。
Add向此元素的 contentContainer 添加一个元素
AddStyleSheetPath将此样式表文件添加到此元素的应用样式列表中
BringToFront将此元素放到其父子列表的末尾。此元素将显示在所有重叠的同级元素前方。
Children从元素的 contentContainer 返回元素
Clear从此元素的 contentContainer 中删除所有子元素
Contains如果元素是此 VisualElement 的直接子级,则返回 true
ElementAt检索相应位置的子元素
EnableInClassListEnables or disables the class with the given name.
FindAncestorUserData向上搜索此 VisualElement 的层级视图并检索存储的 userData(如果找到)。
FindCommonAncestor查找 VisualTree 层级视图中两个 VisualElement 之间的最低共同上级
GetEnumerator允许循环访问此元素的子级
GetFirstAncestorOfType从此元素的父级开始向上访问层级视图,返回第一个此类型的 VisualElement
GetFirstOfType从此元素开始向上访问层级视图,返回第一个此类型的 VisualElement
GetFullHierarchicalPersistenceKey将此 VisualElement 与其父级的 VisualElement.persistenceKey 进行组合,从而创建更具唯一性的键以供 VisualElement.GetOrCreatePersistentData 使用。
GetOrCreatePersistentData引用现有的持久化对象和键,返回以保持的状态填充的对象或原样返回对象。
HasStyleSheetPath检查此样式表文件是否位于此元素的应用样式列表中
IndexOfRetrieves the child index of the specified VisualElement.
Insert向此元素的 contentContainer 插入一个元素
MarkDirtyRepaintTriggers a repaint of the VisualElement on the next frame.
OverwriteFromPersistedData从持久性数据存储覆盖对象。
PlaceBehind将此元素放在其父子列表中同级元素之前紧邻的位置。如果此元素和同级元素位置重叠,此元素将显示在其同级元素之后。
PlaceInFront将此元素放在其父子列表中同级元素之后紧邻的位置。如果此元素和同级元素位置重叠,此元素将显示在其同级元素之前。
Remove从层级视图中删除此子级
RemoveAt从此元素的 contentContainer 中删除位于此位置的子元素
RemoveFromHierarchy将此元素从其父层级视图中删除
RemoveStyleSheetPath从此元素的应用样式列表中删除此样式表文件
SavePersistentData将持久性数据写入文件。
SendEventSends an event to the event handler.
SendToBack将此元素发送到其父子列表的开始处。此元素将显示在所有重叠的同级元素之后。
SetEnabledChanges whether the current VisualElement is enabled or not. When disabled, a VisualElement does not receive most events.
Sort重新排序来自此 VisualElement contentContainer 的子元素。
ToggleInClassListToggles between adding and removing the given class name from the class list.

受保护的函数

OnStyleResolved当对象样式发生更改时回调。