Is that possible to get current active subwindow of C4D?
-
Hi everyone!
I want my plugin to do different things on different Windows, similar to Commander in Cinema 4D.
So I try to get the current active window, such as; Object Manager, Material Manager, Node Editor, etc.
But I didn't find anything about this in the SDK documentation.
So is that possible to do that? -
Hi @gheyret it depends of your context what is "your plugin" is it a CommandData? An ObjectData?
If you want from your command to know the current active context, this is not possible.The only way so far is to create a command and then in your Message implementation listen to the MSG_COMMANDINFORMATION which is sent by Cinema 4D to your command plugin to retrieve the active context. Then the various data that you need to fill has been explained in Restricting a Command to a GeDialog, this is in C++ but it should be the same things, except that in Python you receive a dictionary. Finally even if this is not really your initial question but if you want to retrieve this information for any commands it is not possible in Python since you can't send MSG_COMMANDINFORMATION to an arbitrary command in Python.
So if you want different behavior then you need multiple commands each one restricted to different manager. Then you need to iterate hover all your commands and find the one that enabled or disabled with c4d.IsCommandEnabled, this way you can guess if a context is active.
Cheers,
Maxime. -
Thanks for your explanation @m_adam , Yes it's a CommandData plguin but no GeDialog.
Because of some limitations, I had to use PySide to create my plugin's special user interface.