[Closed] Nexus sneak preview
Some of you might remember this from some time ago, recently I found some time to spend on my pet project and it is getting somewhere This is a preview showing some basic features that can be done using the Nexus framework.
Basically it can send XML between multiple running max instances via TCP/IP sockets. So ti will work on a local workstation as shown as well as over the LAN or WAN. The Nexus framework provides the communication channels, XML wrapping, events and callbacks an so on.
(btw this is not limited to max, any software that can speak XML over TCP/IP can join in.)
This looks very interesting, I was wondering what happened to it
Great job!
Awesome! This could be VERY useful in teaching, among other things. Very very cool. Going to pass this video around work.
Very cool indeed! Was it difficult to keep from corrupting 3ds’s main UI thread? Dispatcher in dotNet? Can you manipulate the timeline as well? set time context?
It was indeed a bit of a puzzle to solve, the sockets are read in a blocking mode in a seperate backgroundWorkerThread which in turn spawn the events for receiving, callbacks, errors etc. This being in a separate thread means it can indeed only read scene data safely. So to avoid this all together all the to be executed scripts are put in a script_queue array.
This array is available in the main thread as well, in there is a System.Windows.Forms.Timer running at a 100ms interval that processes this queue directly in the main thread. This means full and safe access to everything. You can send entire macroscripts over for evaluation, even shell commands are executed, so there is really no difference in local or remote scripting including timeline control and time contexts:
b=box height:10
at time 5 animate on b.height=50
at time 10 animate on b.height=100
Will generate XML like this
<transmission target="BA" from="BA">
<action type="mxs">
<script><![CDATA[b=box height:10
at time 5 animate on b.height=50
at time 10 animate on b.height=100]]></script>
</action>
</transmission>
Which will transmit and execute fine on the other end. A transmission can hold multiple actions, and the action parts inturn can contain an arbitray amount of data which in defined as a nested array data=#( #(var1, val1) , #(var2, val3), #(varN, valN) ) which is fed in to the XML generator function. more on that later