On 19/12/2016 at 18:11, xxxxxxxx wrote:
My first intuition was to deal with c4d.SpecialEventAdd().
The uggly methold but that will work ! Trust me it's very dirty :p
First you need to register 5 unique id for the SpecialEventAdd. ( I will explain it later why)
Ask for a unique Call ID(all current in use CallID are stored into a container in worldcontainer)
Take any kind of python data. Do a bits representation of if and then convert it in a list of integer.
And at each time you call the SpecialEventAdd() with this bit in argument 1. And the second arguments is an Unique call ID(unique to each script you will understand the use of it after)
In your PluginMessage plugin you catch this message and check if this unique call ID existst if not it initialize new dic with the unique call ID. And after each call data are happend to the current data.
In your script after each byte are passed, you call another specialEventAdd with a new id to tell it's finish for this call ID, and arg2 with a int checksum representing the byte (like that we can confirm we got everything ok in the main thread)
For the variable idea are the same but just a litlle change
You loop into each variable to 2 SpecialEventAdd
first SpecialEventAdd with arg1 = data, arg2=call ID
second arg1=int corresponding of an enum of the datatype, arg2= callID
After the execution MessagePlugin return value overide the container stored in the worldcontainer at ID(callID) with a container contening return value.
Then finaly our script read back the return value and then free the CallID into the container
Pro: easy to setup
Pro: accept any kind of data
Con: Not optimized at all
My second approch is to use the same namespace. In this nothing fancing.
Just create an empty class put values into this class
Then do a c4d.SpecialEventAdd()
Register any plugin who is in the mainThread.
Catch this call.
Read data from the class and that's it !
Pro: Clean way
Con: Is not portable
Con: Is not easy to use for other developper
Maybe I will talk about some other way ! :)
Got some others idea but still got some stuff to test before. (one usin HyperFile other are using some 3rd-party solution like memcache)