Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.tool.add(node.properties, property.name, property.enums).name(property.name).onChange(r => {
if (property.enumsTarget)
node.properties[property.name] = property.enumsTarget[r];
});
continue;
}
// Variable
if (property.name === 'Variable') {
const variables = node.graph.variables.map(v => v.name);
this.tool.add(node.properties, property.name, variables).name(property.name);
continue;
}
// Other
const ctor = Tools.GetConstructorName(value).toLowerCase();
switch (ctor) {
// Primitives
case 'number':
case 'string':
case 'boolean':
this.tool.add(node.properties, property.name).name(property.name);
break;
// Vectors
case 'array':
switch (value.length) {
case 2:
case 3:
case 4:
const names = ['x', 'y', 'z', 'w'];
private _setupNodeType (node: GraphTypeNode): void {
const value = node.properties.value;
const ctor = Tools.GetConstructorName(value).toLowerCase();
switch (ctor) {
// Primitives
case 'number':
case 'string':
case 'boolean':
this.tool.add(node.properties, 'value').name('Value');
break;
// Vectors
case 'array':
switch (value.length) {
case 2:
case 3:
case 4:
const names = ['x', 'y', 'z', 'w'];
protected add (): void {
let ctor = Tools.GetConstructorName(this.node).toLowerCase();
if (this.node instanceof DirectionalLight)
ctor = "dirlight";
else if (this.node instanceof HemisphericLight)
ctor = "hemlight";
const data: BehaviorCode = {
name: 'New Script',
active: true,
code: this.template.replace(/{{type}}/g, ctor)
};
this.datas.metadatas.push(data);
this.grid.addRow({
recid: this.datas.metadatas.length - 1,
name: data.name
});
private _getType (value: any): string {
const ctor = Tools.GetConstructorName(value).toLowerCase();
switch (ctor) {
case 'string': return 'String';
case 'number': return 'Number';
case 'boolean': return 'Boolean';
case 'array':
switch (value.length) {
case 2: return 'Vector 2D';
case 3: return 'Vector 3D';
case 4: return 'Vector 4D';
default: debugger; return null;
}
default: debugger; return null;
}
}
}