Nodebundle for playing with nodes

 From:  Karsten (KMRQUS)
7777.1269 In reply to 7777.1267 
Hello James,

Have a look to this:
code:
    // SetStyle
 function SetStyle()
 {
 this.addInput("obj","objectlist");
 this.addInput("idx","numarray");

 this.addOutput("Out","objectlist");
	  this.properties = {Style: [0]};
 }

 SetStyle.title = "SetStyle";
 SetStyle.desc = "SetStyle";

 SetStyle.prototype.onExecute = function()
 {
 var objects = this.getInputData(0, moi.geometryDatabase.createObjectList());
        this.properties.Style = this.getInputData(1, this.properties.Style);
//for(var i=0; i<objects.length; i++)objects.item(i).styleIndex = this.properties.Style[0];
objects.setProperty('styleIndex', this.properties.Style[0]);
 var output = objects;
 this.setOutputData(0, output);
 }
 LiteGraph.registerNodeType("Objects2/SetStyle", SetStyle);


Have a nice day
Karsten

p.s.: Don't forget - you are working with Arrays!!! It's not like arays in C, where the adress/name points to the first element;-)

EDITED: 12 Nov 2018 by KMRQUS