I have modified Michael's CenterAtOrigin script to make a node.
If I use it as an output it works but it applies as well thus if positional sliders & rotations are altered
it produces another set of objects. I'm not sure what to do to overcome this.
Any pointers would be great.
Barry (JavaScript beginner)
// ############ Centre ############
function Centre()
{
this.addInput("In","objectlist");
this.addOutput("Out","objectlist");
this.properties = { capend:true };
}
Centre.title = "Centre";
Centre.desc = "Centre";
Centre.prototype.onExecute = function()
{
//var objects = moi.geometryDatabase.getSelectedObject();
var objects = this.getInputData(0, moi.geometryDatabase.createObjectList());
var bbox = objects.getHighAccuracyBoundingBox();
var factory = moi.command.createFactory( 'move' );
factory.setInput( 0, objects );
factory.setInput( 1, bbox.center );
factory.setInput( 2, moi.view.getCPlane().origin );
factory.commit();
}
LiteGraph.registerNodeType("Transformations/Centre", Centre);
// ############ End Centre ############
|