SOLVED Detect tool button pressed - outside tool plugin

Hi again,
I know this is quite a strange request, but is there a way to detect the press of a tool's description button, outside of the Message() of that tool plugin?

Let's say I am wanting to add a button to the Modeling Axis tab of the Live Selection tool. For this I edited the toolmodelingaxis.h, .res, .str files.
Since I cannot add functionality to the original Modeling Axis tool, I am looking for a way to detect the press of the additional button.
Can this be detected via a c4d.plugins.MessageData's CoreMessage() ? Or do I need a C++ SceneHook for this?

An alternative solution would be to implement a CommandData, with dialog containing the button, and dock the dialog somewhere in the layout.
But I would prefer to have that button inside of the original tool's description, next to the other attributes.

Hello @c4ds,

thank you for reaching out to us. What you could technically do, is use AddEventNotification which usually must be used in tandem with BaseList2D::FindEventNotification and ::RemoveEventNotification to handle the attached notifications. This would then cause MSG_NOTIFY_EVENT to be broadcasted to whatever node you attached the notifications.

But these methods are marked as private intentionally, so we cannot provide any support on them. We also must point out that we do not condone modifying the resources of Cinema 4D. While extending the resource of some entity will be likely without consequence for Cinema 4D or your plugin at the moment, there is no guarantee that this will hold true in the future. You cannot modify the resources of Cinema 4D.

The closest you could get in a conformant manner to do what you want to do, is to wrap around the modelling axis tool. I.e., provide a button to execute the tool and set the tool data container before to the values which are fitting for your usage. And then do something after that.

We understand that this might not be the answer you wanted but modifying the resources of Cinema 4D is really off limits.



I had searched the forums earlier and found quite some references to AddEventNotification used over the years.
However, using that technique requires a "host" to be available.
In my case I don't see a scenario with a mandatory BaseList2D always available, except for the active document.
But still worth a shot ...

The reason I was experimenting with the Cinema4D resources was because this is for personal use only (exclusively within R20), and not meant as a plugin to be made public. As such, I would be future-safe, since no further development will be released for R20.

Hello @C4DS,

unless I am overlooking something here, you cannot use a BaseDocument since you need access to the Message implementation of the node you are adding to the message stream of the 'other' node. Which you should not have for BaseDocument.

So, the implication of my last posting was that you have some kind of NodeData derived plugin to which the tool data message would be rerouted. And the reason why we deem AddEventNotification public is that you can easily crash Cinema 4D with it when you are not careful. Again, I am sorry, but I cannot go any further here, because AddEventNotification is private and we cannot condone what you are trying to do in the first place.


As I won't be spending more time on this project there is no need for delving further into the subject. As such I am setting the status of the topic to "solved".