UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

33 lines (32 loc) 838 B
"use strict"; import { BaseMethod } from "./_Base"; export class OpnameExpression extends BaseMethod { static requiredArguments() { return [["string", "path to node"]]; } findDependency(args) { const { indexOrPath } = args; if (indexOrPath == null) { return null; } const graphNode = this.findReferencedGraphNode(indexOrPath); if (graphNode) { const node = graphNode; if (node.nameController) { const nameNode = node.nameController.graphNode(); return this.createDependency(nameNode, { indexOrPath }); } } return null; } async processArguments(args) { if (args.length == 1) { const index_or_path = args[0]; const node = this.getReferencedNode(index_or_path); if (node) { return node.name(); } } return ""; } }