NodeParent

public abstract class NodeParent
Known Direct Subclasses
Node A Node represents a transformation within the scene graph's hierarchy. 
Scene The Sceneform Scene maintains the scene graph, a hierarchical organization of a scene's content. 
Known Indirect Subclasses
AnchorNode Node that is automatically positioned in world space based on an ARCore Anchor. 
AugmentedFaceNode Node used to render visual effects on a face with ARCore's AugmentedFace feature. 
BaseTransformableNode Base class for nodes that can be transformed using gestures from TransformationSystem
Camera Represents a virtual camera, which determines the perspective through which the scene is viewed. 
SkeletonNode A Node that provides mappings between the bones of a skinned ModelRenderable and a set of Node s. 
Sun Represents the "sun" - the default directional light in the scene. 
TransformableNode Node that can be selected, translated, rotated, and scaled using gestures from TransformationSystem

Base class for all classes that can contain a set of nodes as children.

The classes Node and Scene are both NodeParents. To make a Node the child of another Node or a Scene , use setParent(NodeParent) .

Public Constructors

Public Methods

final void
addChild ( Node child)
Adds a node as a child of this NodeParent.
void
callOnHierarchy (Consumer< Node > consumer)
Traverse the hierarchy and call a method on each node.
Node
findByName ( String name)
Traverse the hierarchy to find the first node with a given name.
Node
findInHierarchy (Predicate< Node > condition)
Traverse the hierarchy to find the first node that meets a condition.
final List < Node >
getChildren ()
Returns an immutable list of this parent's children.
final void
removeChild ( Node child)
Removes a node from the children of this NodeParent.

Protected Methods

boolean
canAddChild ( Node child, StringBuilder failureReason)
void
onAddChild ( Node child)
void

Inherited Methods

Public Constructors

public NodeParent ()

Public Methods

public final void addChild ( Node child)

Adds a node as a child of this NodeParent. If the node already has a parent, it is removed from its old parent. If the node is already a direct child of this NodeParent, no change is made.

Parameters
child
the node to add as a child
Throws
if the child is the same object as the parent, or if the parent is a descendant of the child

public void callOnHierarchy (Consumer< Node > consumer)

Traverse the hierarchy and call a method on each node. Traversal is depth first. If this NodeParent is a Node, traversal starts with this NodeParent, otherwise traversal starts with its children.

Parameters
consumer
The method to call on each node.

public Node findByName ( String name)

Traverse the hierarchy to find the first node with a given name. Traversal is depth first. If this NodeParent is a Node, traversal starts with this NodeParent, otherwise traversal starts with its children.

Parameters
name
The name of the node to find
Returns
  • the node if it's found, otherwise null

public Node findInHierarchy (Predicate< Node > condition)

Traverse the hierarchy to find the first node that meets a condition. Traversal is depth first. If this NodeParent is a Node, traversal starts with this NodeParent, otherwise traversal starts with its children.

Parameters
condition
predicate the defines the conditions of the node to search for.
Returns
  • the first node that matches the conditions of the predicate, otherwise null is returned

public final List < Node > getChildren ()

Returns an immutable list of this parent's children.

public final void removeChild ( Node child)

Removes a node from the children of this NodeParent. If the node is not a direct child of this NodeParent, no change is made.

Parameters
child
the node to remove from the children

Protected Methods

protected boolean canAddChild ( Node child, StringBuilder failureReason)

Parameters
child
failureReason

protected void onAddChild ( Node child)

Parameters
child

protected void onRemoveChild ( Node child)

Parameters
child
Create a Mobile Website
View Site in Mobile | Classic
Share by: