Hi Karsten,
check this manual
http://moi.maxsm.net/api/#_CoordinateFrame
If you want to use frames as input data you can use this code:
code: function Line()
{
this.addInput("Start","frame");
this.addInput("End","frame");
this.addOutput("Out","objectlist");
}
Line.title = "Line";
Line.desc = "Line";
Line.prototype.onExecute = function()
{
var start = this.getInputData(0, moi.VectorMath.createFrame());
var end = this.getInputData(1, moi.VectorMath.createFrame());
var factory = moi.command.createFactory( 'line' );
factory.setInput(0, start.origin);
factory.setInput(1, end.origin);
var output = factory.calculate();
this.setOutputData(0, output);
factory.cancel();
}
LiteGraph.registerNodeType("Factories/Line", Line);
but it will be better if you use points instead of frames
code: function Line()
{
this.addInput("Start","point");
this.addInput("End","point");
this.addOutput("Out","objectlist");
}
Line.title = "Line";
Line.desc = "Line";
Line.prototype.onExecute = function()
{
var start = this.getInputData(0, moi.VectorMath.createPoint());
var end = this.getInputData(1, moi.VectorMath.createPoint());
var factory = moi.command.createFactory( 'line' );
factory.setInput(0, start);
factory.setInput(1, end);
var output = factory.calculate();
this.setOutputData(0, output);
factory.cancel();
}
LiteGraph.registerNodeType("Factories/Line", Line);
|