Class Node
- Namespace
- Lime
- Assembly
- Lime.dll
Scene tree element.
public abstract class Node : IDisposable, IAnimatorHost, IRenderChainBuilder, IAnimable, ICloneable
- Inheritance
-
Node
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
Node()
Initializes a new instance of node.
protected Node()
Fields
CreatedCount
public static int CreatedCount
Field Value
DirtyMask
TODO: Add summary
protected Node.DirtyFlags DirtyMask
Field Value
FinalizedCount
public static int FinalizedCount
Field Value
HitTestTarget
Gets or sets the value that's indicating if the node responds the mouse/touch events.
public bool HitTestTarget
Field Value
SceneLoaded
public static ThreadLocal<Node.SceneLoadedDelegate> SceneLoaded
Field Value
SceneLoading
public static ThreadLocal<Node.SceneLoadingDelegate> SceneLoading
Field Value
globallyFrozen
protected bool globallyFrozen
Field Value
Properties
Ancestors
Enumerate all node's ancestors.
public IEnumerable<Node> Ancestors { get; }
Property Value
AnimationFrame
Get or sets the current animation frame.
[Obsolete("Use AnimationUtils.SecondsToFrames(DefaultAnimation.Time)")]
public int AnimationFrame { get; set; }
Property Value
AnimationSpeed
Animation speed multiplier.
public float AnimationSpeed { get; set; }
Property Value
AnimationTime
Gets or sets time of current frame of default animation (in milliseconds).
[Obsolete("Use DefaultAnimation.Time")]
public double AnimationTime { get; set; }
Property Value
Animations
Gets the animations.
[YuzuMember]
[YuzuSerializeIf("NeedSerializeAnimations")]
public AnimationCollection Animations { get; }
Property Value
Animators
Collection of Animators.
[YuzuMember]
public AnimatorList Animators { get; }
Property Value
AsNode3D
Cached result of cast to Node3D.
public Node3D AsNode3D { get; }
Property Value
AsWidget
Cached result of cast to widget.
public Widget AsWidget { get; }
Property Value
Components
Gets collection of node Components. If a node component of certain type shouldn't be serialized mark the type with NodeComponentDontSerializeAttribute. In case a node component of certain type should be removed when cooking assets use RemoveOnAssetCookAttribute.
[YuzuMember]
public NodeComponentCollection Components { get; }
Property Value
CompoundPostPresenter
Makes the post presenter compound and returns it.
public CompoundPresenter CompoundPostPresenter { get; }
Property Value
CompoundPresenter
Makes the presenter compound and returns it.
public CompoundPresenter CompoundPresenter { get; }
Property Value
ContentsPath
Denotes the path to the external scene. If this path isn't null during node loading, the node children are replaced by the external scene nodes.
[YuzuMember]
[Validation.DefaultCharset]
public string ContentsPath { get; set; }
Property Value
CurrentAnimation
Name of last started marker of default animation. Is set to null by default.
public string CurrentAnimation { get; set; }
Property Value
DefaultAnimation
Returns the first animation in the animation collection or creates an animation if the collection is empty.
public Animation DefaultAnimation { get; }
Property Value
Descendants
Gets a DFS-enumeration of all descendant nodes not including itself.
public IEnumerable<Node> Descendants { get; }
Property Value
EffectiveAnimationSpeed
Gets absolute animation speed that's product of self animation speed multiplied by parent absolute animation speed. EffectiveAnimationSpeed = AnimationSpeed * Parent.EffectiveAnimationSpeed.
public float EffectiveAnimationSpeed { get; }
Property Value
FirstChild
Gets the cached reference to the first children node. Use it for fast iteration through nodes collection in a performance-critical code.
public Node FirstChild { get; }
Property Value
Folders
Gets the folder descriptors.
[YuzuMember]
public FolderList Folders { get; }
Property Value
Frozen
public bool Frozen { get; set; }
Property Value
Gestures
Gets the gesture recognizers.
public GestureList Gestures { get; }
Property Value
GloballyFrozen
public bool GloballyFrozen { get; }
Property Value
Id
A node identifier. May be non-unique.
[YuzuMember]
[Validation.DefaultCharset]
public string Id { get; set; }
Property Value
IsRunning
Returns true if this node is running animation.
[Obsolete("Use DefaultAnimation.IsRunning")]
public bool IsRunning { get; set; }
Property Value
IsStopped
Returns true if this node isn't running animation.
[Obsolete("Use !DefaultAnimation.IsRunning")]
public bool IsStopped { get; set; }
Property Value
LateTasks
Tasks that are called after Update.
public TaskList LateTasks { get; }
Property Value
Layer
Gets or sets Z-order (the rendering order). 0 - inherit Z-order from the parent node. 1 - the lowest, (RenderChain.LayerCount - 1) - the topmost.
public int Layer { get; set; }
Property Value
Manager
Gets a manager of this node.
public NodeManager Manager { get; }
Property Value
Markers
Markers of default animation.
[Obsolete("Use DefaultAnimation.Markers")]
public MarkerList Markers { get; }
Property Value
NextSibling
Gets the cached reference to the next node in the NodeList. Use it for fast iteration through nodes collection in a performance-critical code.
public Node NextSibling { get; }
Property Value
Nodes
Child nodes. For enumerating all descendants use Descendants.
[YuzuMember]
[YuzuSerializeIf("ShouldSerializeNodes")]
public NodeList Nodes { get; }
Property Value
Parent
Gets the parent node.
public Node Parent { get; }
Property Value
PostPresenter
The presenter used for rendering the node after rendering its children.
public IPresenter PostPresenter { get; set; }
Property Value
Presenter
The presenter used for rendering and hit-testing the node. TODO: Add Add/RemovePresenter methods. Remove CompoundPresenter property and Presenter setter.
public IPresenter Presenter { get; set; }
Property Value
RenderChainBuilder
Gets the render chain builder.
public IRenderChainBuilder RenderChainBuilder { get; set; }
Property Value
SelfAndDescendants
Gets a DFS-enumeration of all descendant nodes starting with itself.
public IEnumerable<Node> SelfAndDescendants { get; }
Property Value
Tag
Custom data. Can be set via Tangerine (this way it will contain path to external scene). Can't use obsolete attribute because of Yuzu Generated Binary Deserializers. But its obsolete, don't use it. Use Node Components instead.
[YuzuMember]
public string Tag { get; set; }
Property Value
TangerineFlags
Flags that are used by Tangerine.
[YuzuMember]
public TangerineFlags TangerineFlags { get; set; }
Property Value
Tasks
Tasks that are called before Update.
public TaskList Tasks { get; }
Property Value
Trigger
May contain the marker id of the default animation. When an animation hits a trigger keyframe, it automatically runs the child animation from the given marker id.
public string Trigger { get; set; }
Property Value
Updated
Called after Update.
public UpdateHandler Updated { get; set; }
Property Value
Updating
Called before Update.
public UpdateHandler Updating { get; set; }
Property Value
UserData
Custom data. Can only be set programmatically.
public object UserData { get; set; }
Property Value
Methods
AddNode(Node)
Adds provided node to the lowermost layer of this node (i.e. it will be covered by other nodes). Provided node shouldn't belong to any node (check for Parent == null and use Unlink if needed).
public void AddNode(Node node)
Parameters
node
NodeA child node.
AddSelfAndChildrenToRenderChain(RenderChain, int)
Add this node and it children to the render chain.
public void AddSelfAndChildrenToRenderChain(RenderChain chain, int layer)
Parameters
chain
RenderChainA render chain into which should be added.
layer
intA node layer.
AddSelfToRenderChain(RenderChain, int)
Add this node to the render chain.
protected void AddSelfToRenderChain(RenderChain chain, int layer)
Parameters
chain
RenderChainA render chain into which should be added.
layer
intA node layer.
AddToNode(Node)
Adds this node to the lowermost layer of provided node (i.e. it will be covered by other nodes). This node shouldn't belong to any node (check for Parent == null and use Unlink if needed).
public void AddToNode(Node node)
Parameters
node
NodeA parent node.
AddToRenderChain(RenderChain)
Decides what descendant nodes should be added to render chain and under which conditions. This includes children Nodes as well as this Node itself. i.e. if you want Render() of this node to be called you should invoke AddSelfToRenderChain in AddToRenderChain override.
public abstract void AddToRenderChain(RenderChain chain)
Parameters
chain
RenderChain
CleanDirtyFlags(DirtyFlags)
protected bool CleanDirtyFlags(Node.DirtyFlags mask)
Parameters
mask
Node.DirtyFlags
Returns
Clone()
public virtual Node Clone()
Returns
CloneRaw()
protected Node CloneRaw()
Returns
DescendantOf(Node)
Checks if this node is a descendant of the specified node.
public bool DescendantOf(Node node)
Parameters
node
NodeA parent node.
Returns
- bool
True if this node is a descendant of the specified node, otherwise false.
Dispose()
Disposes the node and all of it components, animations, tasks, etc...
public virtual void Dispose()
FindNode(string)
Searches for node with provided path or id in this node's descendants. Throws an exception if sought-for node doesn't exist.
This function is thread safe.
public Node FindNode(string path)
Parameters
path
stringId or path of Node. Path can be incomplete (i.e. for path Root/Human/Head/Eye Human or Head can be ommited).
Returns
Find<T>(string)
Searches for node with provided path or id in this node's descendants. Throws an exception if sought-for node doesn't exist.
This function is thread safe.
public T Find<T>(string path) where T : Node
Parameters
path
stringId or path of Node. Path can be incomplete (i.e. for path Root/Human/Head/Eye Human or Head can be ommited).
Returns
- T
Type Parameters
T
Type of sought-for node.
Find<T>(string, params object[])
Searches for node with provided path or id in this node's descendants. Returns null if sought-for node doesn't exist.
This function is thread safe.
public T Find<T>(string format, params object[] args) where T : Node
Parameters
format
stringId or path of Node. Path can be incomplete (i.e. for path Root/Human/Head/Eye Human or Head can be ommited).
args
object[]
Returns
- T
Type Parameters
T
Type of sought-for node.
ForceFilterNodes()
[Obsolete("Do not use.")]
protected void ForceFilterNodes()
GetRenderObject()
TODO: Add summary.
protected virtual RenderObject GetRenderObject()
Returns
GetRoot()
Gets the root node.
public Node GetRoot()
Returns
- Node
The root node.
GetTangerineFlag(TangerineFlags)
Retrieves the value of the specified Tangerine flag.
public bool GetTangerineFlag(TangerineFlags flag)
Parameters
flag
TangerineFlags
Returns
HasGestures()
Checks if the node has at least one gesture recognizer.
public bool HasGestures()
Returns
- bool
True is the node has at least one gesture recognizer, otherwise false.
IsDirty(DirtyFlags)
TODO: Add summary
protected bool IsDirty(Node.DirtyFlags mask)
Parameters
mask
Node.DirtyFlags
Returns
IsMouseOver()
public bool IsMouseOver()
Returns
IsMouseOverThisOrDescendant()
public bool IsMouseOverThisOrDescendant()
Returns
IsNotDecorated()
public virtual bool IsNotDecorated()
Returns
Load(Stream, string, Node, bool)
Loads node from given stream
under Current
public static Node Load(Stream stream, string path, Node instance = null, bool ignoreExternals = false)
Parameters
stream
StreamStream with serialized Node.
path
stringPath in asset bundle.
instance
NodeExisting instance of node. If set to
new instance is created.null
ignoreExternals
boolDo not load prefabs.
Returns
- Node
Instance of Node loaded from given path.
Load(string, Node, bool)
Loads node by given path
under Current
public static Node Load(string path, Node instance = null, bool ignoreExternals = false)
Parameters
path
stringPath in asset bundle.
instance
NodeExisting instance of node. If set to
new instance is created.null
ignoreExternals
boolDo not load prefabs.
Returns
- Node
Instance of Node loaded from given path.
LoadExternalScenes()
public virtual void LoadExternalScenes()
Load<T>(string, T, bool)
Loads node by given path
under Current
public static T Load<T>(string path, T instance = null, bool ignoreExternals = false) where T : Node
Parameters
path
stringPath in asset bundle.
instance
TExisting instance of node. If set to
new instance is created.null
ignoreExternals
boolDo not load prefabs.
Returns
- T
Instance of Node loaded from given path.
Type Parameters
T
Expected concrete type of Node.
NeedSerializeAnimations()
public bool NeedSerializeAnimations()
Returns
NotifyOnBuilt()
public void NotifyOnBuilt()
NotifyOnBuiltSuperficial()
public void NotifyOnBuiltSuperficial()
OnAfterSerialization()
public void OnAfterSerialization()
OnBeforeSerialization()
public void OnBeforeSerialization()
OnBuilt()
protected virtual void OnBuilt()
OnParentChanged(Node)
Occurs when Parent property changes.
protected virtual void OnParentChanged(Node oldParent)
Parameters
oldParent
Node
OnTrigger(string, object, double)
Invokes when the trigger property has been changed by animation.
public virtual void OnTrigger(string property, object value, double animationTimeCorrection = 0)
Parameters
property
stringA property name.
value
objectA new property value.
animationTimeCorrection
doubleAn animation time correction.
PartialHitTest(ref HitTestArgs)
protected virtual bool PartialHitTest(ref HitTestArgs args)
Parameters
args
HitTestArgs
Returns
PreloadAssets()
Loads all textures, fonts and animators for this node and for all its descendants. Forces reloading of textures if they are null.
public void PreloadAssets()
PropagateDirtyFlags(DirtyFlags)
Propagates dirty flags to all descendants by provided mask.
protected void PropagateDirtyFlags(Node.DirtyFlags mask = (Node.DirtyFlags)-1)
Parameters
mask
Node.DirtyFlags
PropagateParentBoundsChanged()
protected void PropagateParentBoundsChanged()
PropagateParentBoundsChangedHelper()
protected void PropagateParentBoundsChangedHelper()
PushNode(Node)
Adds provided node to the topmost layer of this node (i.e. it will cover other nodes). Provided node shouldn't belong to any node (check for Parent == null and use Unlink if needed).
public void PushNode(Node node)
Parameters
node
NodeA child node.
PushToNode(Node)
Adds this node to the topmost layer of provided node (i.e. it will cover other nodes). This node shouldn't belong to any node (check for Parent == null and use Unlink if needed).
public void PushToNode(Node node)
Parameters
node
NodeA parent node.
RecalcGloballyFrozen()
protected virtual void RecalcGloballyFrozen()
RemoveAnimatorsForExternalAnimations()
public void RemoveAnimatorsForExternalAnimations()
ReplaceContent(Node)
public void ReplaceContent(Node content)
Parameters
content
Node
ResolveScenePath(string)
Returns path to scene if it exists in bundle. Returns null otherwise. Throws exception if there is more than one scene file with such path.
public static string ResolveScenePath(string path)
Parameters
path
string
Returns
RunAnimation(string, string)
Runs animation with provided Id and provided marker. Throws an exception if sought-for animation or marker doesn't exist. Returns this (to use with yield return)
public Animation RunAnimation(string markerId, string animationId = null)
Parameters
Returns
SameOrDescendantOf(Node)
Checks if this node is the specified node or a descendant of.
public bool SameOrDescendantOf(Node node)
Parameters
node
NodeA parent node.
Returns
- bool
if this node is the specified node or a descendant of, otherwise false.
Save(string, Format)
Saves node to a file.
public void Save(string path, Persistence.Format format)
Parameters
path
stringPath to the file.
format
Persistence.Format
Save(string, Stream, Format)
Saves node to a stream.
public void Save(string path, Stream stream, Persistence.Format format)
Parameters
path
stringPath to the file. Required for correct asset path shrink or expand for relative assets.
stream
StreamThe stream.
format
Persistence.Format
SetTangerineFlag(TangerineFlags, bool)
Sets the value for the specified Tangerine flag.
public void SetTangerineFlag(TangerineFlags flag, bool value)
Parameters
flag
TangerineFlagsA Tangerine flag
value
boolA value to set.
ShouldSerializeNodes()
public bool ShouldSerializeNodes()
Returns
StaticScale(float, bool)
TODO: Translate Этот метод масштабирует позицию и размер данного нода и всех его потомков. Метод полезен для адаптирования сцены под экраны с нестандартным DPI. Если позиция или размер виджета анинимированы, то ключи анимации также подвергаются соответствующему преобразованию. Для текстовых виджетов, размер шрифта масштабируется.
public virtual void StaticScale(float ratio, bool roundCoordinates)
Parameters
ratio
floatroundCoordinates
boolЕсли true, то после масштабирования виджета, его размер округляется, а сам виджет сдвигается таким образом, чтобы его левый верхний угол (точка (0,0) в локальных координатах виджета) перешел в целочисленную позицию.
ToString()
public override string ToString()
Returns
TriggerMultipleAnimations(string, double)
TODO: Add summary.
protected void TriggerMultipleAnimations(string trigger, double animationTimeCorrection = 0)
Parameters
TryFindNode(string)
Searches for node with provided path or id in this node's descendants. Returns null if sought-for node doesn't exist.
This function is thread safe.
public Node TryFindNode(string path)
Parameters
path
stringId or path of Node. Path can be incomplete (i.e. for path Root/Human/Head/Eye Human or Head can be ommited).
Returns
TryFind<T>(string)
Searches for node with provided path or id in this node's descendants. Returns null if sought-for node doesn't exist.
This function is thread safe.
public T TryFind<T>(string path) where T : Node
Parameters
path
stringId or path of Node. Path can be incomplete (i.e. for path Root/Human/Head/Eye Human or Head can be ommited).
Returns
- T
Type Parameters
T
Type of sought-for node.
TryFind<T>(string, params object[])
Searches for node with provided path or id in this node's descendants. Returns null if sought-for node doesn't exist.
This function is thread safe.
public T TryFind<T>(string format, params object[] args) where T : Node
Parameters
format
stringId or path of Node. Path can be incomplete (i.e. for path Root/Human/Head/Eye Human or Head can be ommited).
args
object[]
Returns
- T
Type Parameters
T
Type of sought-for node.
TryFind<T>(string, out T)
Searches for node with provided path or id in this node's descendants. Returns null if sought-for node doesn't exist.
This function is thread safe.
public bool TryFind<T>(string path, out T node) where T : Node
Parameters
path
stringId or path of Node. Path can be incomplete (i.e. for path Root/Human/Head/Eye Human or Head can be ommited).
node
T
Returns
Type Parameters
T
Type of sought-for node.
TryRunAnimation(string, string, double)
Runs animation with provided Id and provided marker. Returns false if sought-for animation or marker doesn't exist.
public bool TryRunAnimation(string markerId, string animationId = null, double animationTimeCorrection = 0)
Parameters
Returns
Unlink()
Removes this node from children of the parent node.
public void Unlink()
UnlinkAndDispose()
Removes this node from children of the parent node and disposes it.
public void UnlinkAndDispose()
UpdateAncestorBoundingRect(Widget)
public virtual void UpdateAncestorBoundingRect(Widget ancestor)
Parameters
ancestor
Widget
Events
AnimationStopped
Is invoked after default animation has been stopped (e.g. hit "Stop" marker). Note: DefaultAnimation.Stopped will be set to null after invocation or after RunAnimation call. The correct usage is to call RunAnimation first and then apply any required AnimationStopped handlers.
public event Action AnimationStopped
Event Type
Awoke
Occurs at node first update.
public event Action<Node> Awoke