Select custom tab with python
-
I create
Python Tag
with custom group (tab), Tag has selected by default tab "Tag".
How to set selected my newly created tab? -
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... }
-
@fwilleke80 Thanks for answer! Unfortunately I'm dealing with python tag, not plugin
-
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 aGROUP
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 -
@ferdinand thanks!
My goal is to:- Rename "User Data" tab of my tag
- 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? -
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.
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 flagDEFAULT
. There is nothing else what you can do.Cheers,
Ferdinand -
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 -
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()