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

    Access Object Manager Fold and Unfold?

    Cinema 4D SDK
    r20 python
    4
    6
    2.5k
    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.
    • B
      bentraje
      last edited by

      Hi,

      I'm trying to create a shortcut for folding and unfolding the object manager. Is this possible in the API?

      You can check the post here for reference. The first post will do.
      https://www.cineversity.com/forums/viewthread/3436/

      Thank you

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

        Hi depending what you really want to do there is multiple ways for doing it.

        import c4d
        
        def Unfold(obj):
            obj.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_SET)
            obj.ChangeNBit(c4d.NBIT_OM2_FOLD, c4d.NBITCONTROL_SET)
            obj.ChangeNBit(c4d.NBIT_OM3_FOLD, c4d.NBITCONTROL_SET)
            obj.ChangeNBit(c4d.NBIT_OM4_FOLD, c4d.NBITCONTROL_SET)
        
        def Fold(obj):
            obj.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_CLEAR)
            obj.ChangeNBit(c4d.NBIT_OM2_FOLD, c4d.NBITCONTROL_CLEAR)
            obj.ChangeNBit(c4d.NBIT_OM3_FOLD, c4d.NBITCONTROL_CLEAR)
            obj.ChangeNBit(c4d.NBIT_OM4_FOLD, c4d.NBITCONTROL_CLEAR)
            
        def FoldSelected():
            c4d.CallCommand(100004803) # Fold Selected
            
        def UnfoldSelected():
            c4d.CallCommand(100004802) # Unfold Selected
        
        def FoldAll():
            c4d.CallCommand(100004749) # Fold All
            
        def UnfoldAll():
            c4d.CallCommand(100004748) # Unfold All
        
        # Main function
        def main():
            FoldAll()
            c4d.EventAdd()
            
        # Execute main()
        if __name__=='__main__':
            main()
        

        Note: That Un/Fold Selected/All are commands already available.

        If you have any question, let me know.
        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 1
        • B
          bentraje
          last edited by

          @m_adam said in Access Object Manager Fold and Unfold?:

          c4d.CallCommand(100004803)

          Thanks for the response. Sorry for the confusion, but I'm not after the folding/unfolding of an object but the whole manager.

          Here is a video posted in the link above for illustration:
          https://www.dropbox.com/s/kt0oeez7q6kfwjr/c4d101_toggle_panels_manager.mp4?dl=0

          As stated in the link above,

          "The software is in Maya. It allows me to hide and unhide the outliner (object manager in C4D).
          It’s helpful since I can hide panel/manager that occupies space."The software is in Maya. It allows me to hide and unhide the outliner (object manager in C4D). It’s helpful since I can hide panel/manager that occupies space.

          The alternative is layouts. The problem is when I have to update the buttons (add or remove), I have to adjust it to other layouts. It’s a bit cumbersome by then.

          I’d prefer the toggle/collapse panels instead.

          Is this possible?"

          Thank you

          1 Reply Last reply Reply Quote 0
          • CairynC
            Cairyn
            last edited by

            You don't need a script for that. When in the Object Manager, look at the menu (File/Edit/View...). There is this point pattern to the left of it that contains the window menu.

            Ctrl-leftclick on it, and it folds into a neat bar. Click the point pattern of this bar to unfold the OM again.

            I am not aware of a keyboard shortcut for that functionality - and I doubt it would make sense since you need to specify the window to fold anyway, which is done by clicking in this case (thereby pointing the mouse at the desired window).

            (You also don't have any window functions in the API, so you couldn't write a script even if you would be content with having as many keyboard shortcuts as possible Object Managers, which IMHO is awkward.)

            1 Reply Last reply Reply Quote 1
            • r_giganteR
              r_gigante
              last edited by

              Hi Bentraje, thanks for reaching out us.

              With regard to your request, I confirm that it's not possible to programmatically fold/unfold a generic manager being the API involved in controlling the managers' behavior not exposed. In addition, being possible to open multiple managers (of the same or of a different type) at the same time it's currently impossible to identify on which windows to execute the fold/unfold task.

              Best, Riccardo

              1 Reply Last reply Reply Quote 2
              • B
                bentraje
                last edited by

                Thanks for confirmation @Cairyn and @r_gigante

                Sorry for being picky. Just had some muscle memory from other softwares that wanted to port to C4D.
                Anyhow, will settle for the Ctrl+LMB as specified by @Cairyn

                Thanks again have a great day ahead!

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