📄 UserDataNode.js
¶
📊 Analysis Summary¶
Metric | Count |
---|---|
🔧 Functions | 2 |
🧱 Classes | 1 |
📦 Imports | 2 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 src/nodes/accessors/UserDataNode.js
📦 Imports¶
Name | Source |
---|---|
ReferenceNode |
./ReferenceNode.js |
nodeObject |
../tsl/TSLBase.js |
Functions¶
UserDataNode.updateReference(state: any): any
¶
JSDoc:
/**
* Overwritten to make sure {@link ReferenceNode#reference} points to the correct
* `userData` field.
*
* @param {(NodeFrame|NodeBuilder)} state - The current state to evaluate.
* @return {Object} A reference to the `userData` field.
*/
Parameters:
state
any
Returns: any
Code
userData(name: string, inputType: string, userData: any): UserDataNode
¶
Parameters:
name
string
inputType
string
userData
any
Returns: UserDataNode
Calls:
nodeObject (from ../tsl/TSLBase.js)
Classes¶
UserDataNode
¶
Class Code
class UserDataNode extends ReferenceNode {
static get type() {
return 'UserDataNode';
}
/**
* Constructs a new user data node.
*
* @param {string} property - The property name that should be referenced by the node.
* @param {string} inputType - The node data type of the reference.
* @param {?Object} [userData=null] - A reference to the `userData` object. If not provided, the `userData` property of the 3D object that uses the node material is evaluated.
*/
constructor( property, inputType, userData = null ) {
super( property, inputType, userData );
/**
* A reference to the `userData` object. If not provided, the `userData`
* property of the 3D object that uses the node material is evaluated.
*
* @type {?Object}
* @default null
*/
this.userData = userData;
}
/**
* Overwritten to make sure {@link ReferenceNode#reference} points to the correct
* `userData` field.
*
* @param {(NodeFrame|NodeBuilder)} state - The current state to evaluate.
* @return {Object} A reference to the `userData` field.
*/
updateReference( state ) {
this.reference = this.userData !== null ? this.userData : state.object.userData;
return this.reference;
}
}