Capítulo 477 de 859

Chapter 477: SplitNode

Core Idea

This module is part of the TSL core and usually not used in app level code. SplitNode represents a property access operation which means it is used to implement any .xyzw, .rgba and stpq usage on node objects. For example:

Key Concepts

  • components : string: The components that should be accessed.
  • isSplitNode : boolean (readonly): This flag can be used for type testing.
  • node : Node: The node that should be accessed.

Code Examples

const redValue = color.r;
  • What it demonstrates: Typical usage of SplitNode.

Reference Tables

Constructor

Signature
new SplitNode( node : Node, components : string )

Properties

PropertyDescription
.components : stringThe components that should be accessed.
.isSplitNode : boolean (readonly)This flag can be used for type testing.
.node : NodeThe node that should be accessed.

Methods

MethodDescription
.generateNodeType( builder : NodeBuilder ) : stringThis method is overwritten since the node type is inferred from requested components.
.getComponentType( builder : NodeBuilder ) : stringReturns the component type of the node's type.
.getScope() : NodeReturns the scope of the node.
.getVectorLength() : numberReturns the vector length which is computed based on the requested components.

Key Takeaways

  1. SplitNode extends: EventDispatcher → Node
  2. Most relevant properties: components, isSplitNode, node.
  3. Key methods: generateNodeType, getComponentType, getScope, getVectorLength.

Connects To