On 17/07/2018 at 06:48, xxxxxxxx wrote:
Not sure if this is the right branch of forum, but I think that problem is in my python code..
I'm trying to learn C4D CPP API and I've stucked. I can't figure out how to read the data that i sent from python node to my c++ TagData plugin with Message().
My plugin code(part of it) :
Bool MyTestPlugin::Message(GeListNode *node, Int32 type, void *data)
if (type == 322)
GePrint(String::IntToString( (Int32)data ));
GePrint(String::IntToString( *(Int32* )data ));
And my python code(XPresso node) looks like:
def main() :
If I'm not mistaken the problem is that python sends message with < Int32> data inside and cpp waits for < Int32*>. But I just can't figure out what to do.(((
On 18/07/2018 at 06:42, xxxxxxxx wrote:
Actually, the problem is that you are sending a python object to a C++.
So the best way to do it is to use a BaseContainer to send your data, and use MSG_BASECONTAINER.
So your C++ code will looks like
if (type == MSG_BASECONTAINER)
BaseContainer* bc = (BaseContainer* )data;
if (bc == nullptr)
Int32 value = bc->GetInt32(0, 10);
and your python code
bc = c4d.BaseContainer()
bc = 100
Please note Message function is executed immediately when you call it, that means you get the same limitation as you get in a threaded context (Xpresso Node), which is to not change the scene structure within this call, for more information please read the C++ Manual about threading.
If you have any question, please let me know,
On 04/08/2018 at 03:54, xxxxxxxx wrote:
Sorry for late reply.
Thanks for your answer - it helped me a lot.
Actually, it's strange that you have to use BaseContainer wrap for every piece of primitive data. I think sometimes it must be seriously hurting perfomance.
Anyway, thanks again, Maxime. Best wishes.