I am making a Command plugin and would like to listen to C4D's selection events to find the new active objects. Is this possible? I have seen examples of plugins that listen to C4D events, but they are MessageData plugins. I don't see an object selection event in GeDialog:CoreMessage.
The events I am seeing from CoreMessage on selection are c4d.EVMSG_CHANGE and c4d.EVMSG_DOCUMENTRECALCULATED, but these are happening with every mouse click.
May I please ask how would this be done?
In case of an object selection change, you can simply call GetActiveObjects() in every EVMSG_CHANGE call.
Or, read in selection bits for all objects.
@mp5gosu That worked, thank you very much! Would one way be faster than the other?
Since it is python, I'm not entirely sure. But I'd say getting the bits is faster, since no allocation is made (like a list in GetActiveObjects()).
But this can probably answer the SDK team.
To retrieve the active object you have to iteration trough the hierarchy. (even GetActiveObject)
In Python, GetActiveObjects is calling a c++ function so with lots of object it will be faster than iterating the hierarchy with python functions.
We don't know what the limit is. To mesure that you have to make a bunch of tests with different scenarios and get the mean.