Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Is that possible to get current active subwindow of C4D?

    Cinema 4D SDK
    windows python 2024
    2
    3
    669
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gheyretG
      gheyret
      last edited by

      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?

      www.boghma.com

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by m_adam

        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.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        gheyretG 1 Reply Last reply Reply Quote 0
        • gheyretG
          gheyret @m_adam
          last edited by

          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.

          www.boghma.com

          1 Reply Last reply Reply Quote 0
          • First post
            Last post