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

StackNode

class in UnityEditor.Experimental.UIElements.GraphView

/

继承自:Experimental.UIElements.GraphView.Node


实现接口:IDropTarget, IEventHandler, ISelectable, IStyle, ITransform, IUIElementDataWatch, IVisualElementScheduler

切换到手册

描述

Use this class to customize StackNodes and to manage dragging GraphElements over StackNodes.

变量

contentContainerThe content container of this StackNode.
dragEnteredIndicates if items from this stack are currently being dragged.
dropPreviewTemplateUse this property to customize the preview that appears when GraphElements are dragged over the StackNode.
hasMultipleSelectionSupportReturns true if the StackNode supports multiselection.
headerContainerUse this property to customize the header for this StackNode.

构造函数

StackNodeStackNode constructor.

公共函数

AddElementAdds the specified GraphElement to the StackNode.
CanAcceptDropIndicates whether this StackNode accepts the current drop event.
DragEnterThis method is automatically called when a drag leave event occurs.
DragExitedThis method is automatically called when a drag exit event occurs.
DragLeaveThis method is automatically called when a drag leave event occurs.
DragPerformThis method is automatically called when a drop event occurs.
DragUpdatedThis method is automatically called when a drag updated event occurs.
GetInsertionIndexRetrieves the insertion index in the StackNode if an item is dropped at the specified world position.
InsertElementInserts the specified GraphElement at the specified index in this StackNode.
OnStartDraggingThis method is automatically called when an element of the stack is about to be dragged out of it.
RemoveElementRemoves the specified GraphElement from this StackNode.

受保护的函数

AcceptsElementChecks whether the specified GraphElement can be added to this StackNode.
OnSeparatorContextualMenuEventThis method is automatically called when a contextual menu is about to appear on a StackNode separator.
OnStyleResolvedThis method is automatically called when the style is updated.

继承的成员

静态变量

defaultFocusIndexThe default focus index for newly created elements.

变量

canGrabFocus如果元素可以获得焦点,则返回 true。
focusController返回此元素的焦点控制器。
focusIndex用于对焦点环中可获得焦点的元素排序的整数。负值表示元素不能获得焦点。
capabilitiesThe GraphElement's capabilities.
elementTypeColorThe color used for the MiniMap view.
layerThe GraphElement's layer in the graph.
selectedTrue if the GraphElement is currently selected.
titleThe GraphElement's title.
expanded节点是否已扩展。
extensionContainer用于显示自定义元素的空容器。添加元素后,调用 RefreshExpandedState 以切换该容器的可见性。
inputContainer用于输入端口的输入容器。
mainContainer包含所有其他容器的主容器。
outputContainer用于输出端口的输出容器。
title节点的标题元素。
titleButtonContainerTitle bar button container. Contains the top right buttons.
titleContainer标题栏容器。
topContainer包含输入和输出容器的整个顶部区域。
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尝试让此元素获得焦点。
GetGlobalCenterGet the GraphElement's center point.
GetPositionGet the GraphElement position.
HitTestSee if point is over the GraphElement.
IsAscendableChecks if the GraphElement is automatically brought to front when selected.
IsDroppableThe GraphElement is drag&droppable.
IsMovableThe GraphElement is movable.
IsResizableThe GraphElement is resizable.
IsSelectableThe GraphElement is selectable.
IsSelectedThe GraphElement is currently selected in specific container.
OnSelectedCalled when the GraphElement is selected.
OnUnselectedCalled when the GraphElement is unselected.
ResetLayerReset the GraphElement to its original layer.
SelectSelect the GraphElement.
SetPositionSet the GraphElement position.
UnselectDeselect the GraphElement.
BuildContextualMenu向节点上下文菜单添加菜单项。
InstantiatePort创建一个特定于此节点的新端口。
RefreshExpandedState将自定义元素添加到 extensionContainer 后,调用此方法以使这些元素变得可见。
RefreshPorts刷新端口布局。
SetPosition设置节点位置。
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.
OnPersistentDataReady当持久数据可访问和/或当数据或持久键发生更改时调用(VisualElement 有正确的父子关系)。
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.

受保护的函数

OnPortRemoved删除端口时调用。
ToggleCollapse切换节点的折叠状态。
UseDefaultStylingApplies the default styling of Node. This must be explicitly called by Node subclasses that use their own uxml files.