Designing asynchronous communication with external application

Designing asynchronous communication with external application

graphics_rat
Participant Participant
209 Views
0 Replies
Message 1 of 1

Designing asynchronous communication with external application

graphics_rat
Participant
Participant

I am designing a plugin that should allow a user to attach a custom locator to an object. This locator is a proxy to an external simulator that does some computationally intensive calculations and asynchronously returns some data that deforms the mesh to which the locator is bound. The difficult part of this design is mostly the communication; specifically how apply the result of the external application to Maya. The first part is sort of easy:

 

  1. A command or callback fires off the request to some persistent entity that handles the asynchronous communication. Off the top of my head I'd say this should be a multithreaded object, but I am not sure if this choice is ideal. (Should it be a node?) The command or callback does not wait for the result but instantly returns.
  2. When the external application has completed the request it sends a response to Maya/the communication object.
  3. Upon receipt of the response the communication object will create, update or delete (CUD) an entity in the scene, corresponding to the response it received.

On the communications object; Boost asio seems like the natural library to reach for but I see Maya now has an MThreadAsync class. Also I see Maya now has `MGlobal::executeCommandOnIdle` and `MGlobal::executePythonCommandOnIdle` but these involve rendering the server response into a string for Maya to parse and execute. Is is safe for the communication objects to perform the create/updated/deletes via function sets (MFns)? Are there any pitfalls to be aware of?

 

 

0 Likes
210 Views
0 Replies
Replies (0)