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

    How to Set UserData Group fold/unfold

    Cinema 4D SDK
    python s26
    4
    9
    1.1k
    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.
    • chuanzhenC
      chuanzhen
      last edited by

      Hi,
      in c4d manager UserData dialog can set group Default Open,but i dont how to set fold/unfold in python .
      my code:

      bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_GROUP)
      bc[c4d.DESC_NAME] = "group_test"
      group_did = obj.AddUserData(bc)
      
      bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_STRING)
      bc[c4d.DESC_NAME] = "test"
      bc[c4d.DESC_PARENTGROUP] = group_did
      did = obj.AddUserData(bc)
      

      Thanks for any help!

      相信我,可以的!

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

        Hi @chuanzhen, while there is DESC_GUIOPEN this one is more to be used with CustomGUI like Color that can be extended, in your case you want to use DESC_DEFAULT, so this give us:

        import c4d
        
        def main() -> None:
            obj = op
            bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_GROUP)
            bc[c4d.DESC_NAME] = "group_test1"
            bc[c4d.DESC_SHORT_NAME] = "group_test1"
            bc[c4d.DESC_DEFAULT] = True
            bc[c4d.DESC_TITLEBAR] = True
            group_did = obj.AddUserData(bc)
            
            bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_STRING)
            bc[c4d.DESC_NAME] = "test"
            bc[c4d.DESC_PARENTGROUP] = group_did
            did = obj.AddUserData(bc)
            
            c4d.EventAdd()
        
        if __name__ == '__main__':
            main()
        

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        chuanzhenC 1 Reply Last reply Reply Quote 0
        • chuanzhenC
          chuanzhen @m_adam
          last edited by chuanzhen

          @m_adam Setup succeeded, but the group GUI did not unfold

          use python
          group.gif

          c4d Use Default Open ,group unfold
          group1.gif

          c4d not Use Default Open ,but group not fold
          group2.gif

          相信我,可以的!

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

            Can you try using bc.SetInt32(c4d.DESC_DEFAULT, True) instead.

            Cheers,
            Maxime.

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            chuanzhenC 1 Reply Last reply Reply Quote 0
            • chuanzhenC
              chuanzhen @m_adam
              last edited by chuanzhen

              @m_adam Still can't succeed
              In the same Attribute Manager window, for multiple objects with the same UserData, it seems that it is impossible to control the opening or closing of a group alone. If I open (or close) the group of one object, the group corresponding to other objects will also be opened (or closed)

              相信我,可以的!

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

                Sadly we are not able to reproduce your issue, 3 dev tested and we all not able to reproduce.
                SO being not reproducible on our end, it's pretty hard to find a solution.
                Would it be possible for you to re-install Cinema 4D in a new empty directory, and try to reproduce your issue and report here every steps if you still can reproduce your issue with this fresh install.

                Regarding your last message, right for multiple object this is not possible to Open/Close only for a subset of the initial selection.

                Cheers,
                Maxime.

                MAXON SDK Specialist

                Development Blog, MAXON Registered Developer

                1 Reply Last reply Reply Quote 0
                • a_blockA
                  a_block
                  last edited by

                  Maybe the misunderstanding here comes from the normal behavior of the Attribute Manager.
                  One can not force a group open with this flag. The flag does only influence the open state, when the group for a given entity type (be it an object, tag or material of a certain type) gets shown first. As soon as the user touches the group (either opening or closing it), the Attribute Manager will use user's choice instead for all entities of this type.

                  1 Reply Last reply Reply Quote 0
                  • chuanzhenC
                    chuanzhen
                    last edited by chuanzhen

                    Thanks for help @a_block , @m_adam . I think the answer to this question is that we can't control the open/close of the group

                    相信我,可以的!

                    1 Reply Last reply Reply Quote 0
                    • ferdinandF
                      ferdinand
                      last edited by

                      Hello @chuanzhen,

                      without any further questions or other postings, we will consider this topic as solved and flag it as such by Friday, 17/06/2022.

                      Thank you for your understanding,
                      Ferdinand

                      MAXON SDK Specialist
                      developers.maxon.net

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