Asynchronous factories (scripting)

 From:  Michael Gibson
11087.6 In reply to 11087.5 
Hi Peer,

re:
> It sounds like there are "async factories" that are processed remotely by default when doing
> factory.update(), like ArrayGem and Twist, and that it's necessary to do factory.waitForAsyncUpdate()
> after doing factory.update() and before using the results from the update of an async factory.

Correct.


> But, if an async factory is run with factory.calculate() then it will run on the main process rather than remotely.

Yes, this is because factory.calculate() returns an object list to the caller.


> However, any factory, including async factories, can be processed remotely by doing factory.calculate( 'async' )
> and in that case factory.waitForAsyncUpdate() shouldn't be used as the next line in JavaScript, because
> factory.calculate( 'async' ) is already waiting internally for the remote process to finish.

Yes, for a while I had this turned on automatically for async factories but it caused some compatibility problems with some of Max's more complex scripts that had timers that can get reentrantly called during the internal waitForAsyncUpdate(). So it's opt-in now.

- Michael