Hi Pilou, it is possible to modify it to work with v3 - v3 needs to have temporary objects like the planes that are created to be added to the geometry database for async factories (like Flow) to be able to use them. V4 does not require that anymore, in v4 async factories can use "loose" objects (objects not in the geometry database) for input into async factories.
If you replace the Update() function with this below code then it should work on v3 too:
code:
function Update( objects, factories )
{
while ( factories.length != 0 )
factories.pop().cancel();
var base_plane = CreatePlane( 0, 0, 1, 1 ).item(0).getFaces().item(0);
for ( var i = 0; i < objects.length; ++i )
{
var obj = objects.item(i);
var umin = moi.ui.commandUI.umin.value;
var umax = moi.ui.commandUI.umax.value;
var vmin = moi.ui.commandUI.vmin.value;
var vmax = moi.ui.commandUI.vmax.value;
var extended_plane = CreatePlane( -umin, -vmin, 1 + umin + umax, 1 + vmin + vmax );
moi.geometryDatabase.addObject( base_plane.getParentBRep() );
moi.geometryDatabase.addObjects( extended_plane );
var factory = moi.command.createFactory( 'flow' );
factory.setInput( 0, extended_plane ); // objects to deform
factory.setInput( 1, base_plane ); // base object
factory.setInput( 2, obj ); // target object
factory.setInput( 3, false ); // delete inputs
factory.setInput( 7, false ); // swap uv
factory.setInput( 8, false ); // Flip U
factory.setInput( 9, false ); // Flip V
factory.setInput( 10, false ); // Flip normal
factory.setInput( 11, false ); // Projective
factory.setInput( 12, false ); // Straight for projective
factory.update();
factories.push( factory );
moi.geometryDatabase.removeObject( base_plane.getParentBRep() );
moi.geometryDatabase.removeObjects( extended_plane );
}
}
- Michael
|