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

    Select custom tab with python

    Cinema 4D SDK
    4
    8
    1.3k
    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.
    • K
      karpique
      last edited by

      I create Python Tag with custom group (tab), Tag has selected by default tab "Tag".
      How to set selected my newly created tab?

      1 Reply Last reply Reply Quote 0
      • fwilleke80F
        fwilleke80
        last edited by

        In a .res file?

        Just add DEFAULT 1; to the group's properties:

        GROUP MY_GROUP
        {
            DEFAULT 1;
        
            REAL SOME_PARAMETER { }
            LONG SOME_OTHER_PARAMETER  { }
            // and so on...
        }
        

        www.frankwilleke.de
        Only asking personal code questions here.

        K 1 Reply Last reply Reply Quote 0
        • K
          karpique @fwilleke80
          last edited by

          @fwilleke80 Thanks for answer! Unfortunately I'm dealing with python tag, not plugin

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

            Hello @karpique,

            thank you for reaching out to us. For user data, which is what I assume to be your use case, you can use the flag/field "Default Open" for a group which equates to DEFAULT 1 in a GROUP element in a description resource. This however will only work for group elements that are parented to the User Data tab of a node. For groups that have been dragged outside of that tab, forming their own tab, this will not work.

            Cheers,
            Ferdinand

            MAXON SDK Specialist
            developers.maxon.net

            K 1 Reply Last reply Reply Quote 0
            • K
              karpique @ferdinand
              last edited by

              @ferdinand thanks!
              My goal is to:

              1. Rename "User Data" tab of my tag
              2. Keep it opened by default (or make that tab opened with python) after tag placing in scene

              I tried to change DESC_NAME property of default user data group but didn't succeed, thats why I created parentless group with name needed, but as I see it cant be selected by default. Is there some other way of reaching my goal?

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

                Hello @karpique,

                You cannot change the description of non-user data parameters in a Python scripting tag. You need full ownership of the node to do that.

                Rename "User Data" tab of my tag

                So, this is impossible to do. But you can add your own tab and simply not use the default one provided by Cinema 4D. To do that, simply drag a group created with Add Group button in the User Data Manger. By default, it will be inserted somewhere as a (grand)-child of the User Data (Default) group. Drag the group element in the User Data manger hierarchy gadget on the left towards the bottom of the gadget. The group will then become unparented from the default group and you can name it however you like. If User Data (Default) is then also not being populated, it will not show up. See screen below for clarification.

                e6d943f7-5111-4808-a92b-98613bfed069-image.png

                Keep it opened by default (or make that tab opened with python) after tag placing in scene.

                As already said, you can use the option Default Open in the User Data Manger group element settings. Which effectively is equal to GROUP MY_GROUP { DEFAULT 1; }. But as also already stated, there will be scenarios where it does not behave exactly like the flag DEFAULT. There is nothing else what you can do.

                Cheers,
                Ferdinand

                MAXON SDK Specialist
                developers.maxon.net

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

                  Hello @karpique,

                  without further questions or postings, we will consider this topic as solved by Wednesday and flag it accordingly.

                  Thank you for your understanding,
                  Ferdinand

                  MAXON SDK Specialist
                  developers.maxon.net

                  1 Reply Last reply Reply Quote 0
                  • jochemdkJ
                    jochemdk
                    last edited by

                    Below gets the focus back on the first tab of the pyTag (after other objects have been selected), but it only works with/after a button click..
                    Perhaps this might be of use.

                    def message(id, data):
                        if id == c4d.MSG_DESCRIPTION_COMMAND:
                            id2 = data['id'][0].id
                            if id2 == c4d.ID_USERDATA:
                                userDataId = data['id'][1].id
                                if userDataId == 1: # << just a button on the pyTag with ID 1
                                    ### do some function...
                                    # GET FOCUS BACK on the pyTags's 1st Tab:
                                    op.GetObject().SetBit(c4d.BIT_ACTIVE)
                                    op.SetBit(c4d.BIT_ACTIVE)
                                    c4d.gui.ActiveObjectManager_SetObject(c4d.ACTIVEOBJECTMODE_TAG, op.GetObject(), c4d.ACTIVEOBJECTMANAGER_SETOBJECTS_OPEN, c4d.DescID(c4d.DescLevel(1)))
                                    op.GetObject().DelBit(c4d.BIT_ACTIVE)
                                    c4d.EventAdd()
                    
                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post