Hi. There you go. It's working for me.

MEL:

global proc toggleCB()
{
     workspaceControl -e -clp (!`workspaceControl -q -clp
ChannelBoxLayerEditor`) ChannelBoxLayerEditor;
}

Python:

import maya.cmds as cmds
def toggleCB():
    state = cmds.workspaceControl("ChannelBoxLayerEditor", q=True, clp=True)
    cmds.workspaceControl("ChannelBoxLayerEditor", e=True, clp=not state)

Carlos Rico Adega

<http://www.vimeo.com/16765581> LinkedIn
<https://www.linkedin.com/in/carlosricoadega/>
carlos.rico...@gmail.com

O luns, 5 de xul. de 2021 ás 14:26, João Victor (<joaovictor...@gmail.com>)
escribiu:

> Hey Justin, thanks for replying.
>
> I just turned on Echo, but the returned code doesn't work,, this is what
> is returned when I collapse the tab, which there is no Channel Box
> specified:
>
>
>
> *evalDeferred("updateEditorToggleCheckboxes()");updateEditorToggleCheckboxes();*
>
> This suggestion you sent, works fine:
>
> *toggleUIComponentVisibility("Channel Box / Layer Editor");*
>
> But it closes the tab instead of collapsing in the right (just like you
> RMB + collapse tab group)
>
> Maybe there is some way to collapse instead of close?
>
> I am asking because when I *close* and open again, it comes with a very
> big width, which makes me adjust the width every time.
> When I *collapse* it comes back with the previous width.
>
> Thanks a lot.
>
>
> Em dom., 4 de jul. de 2021 às 20:24, Justin Israel <justinisr...@gmail.com>
> escreveu:
>
>>
>>
>> On Sun, Jul 4, 2021 at 11:12 AM João Victor <joaovictor...@gmail.com>
>> wrote:
>>
>>> Hey guys, would somebody know how I could toggle colapse Channel Box
>>> (not close)?
>>> I could use mel or python.
>>>
>>> thanks a lot!
>>>
>>
>> Is this what you are after?
>>
>> 1. Open script editor and enable "History"-> "Echo All Commands"
>> 2. Hit the "Toggle the Channel Box button on the top right"
>> 3. Take note of the mel command used to toggle the visibility of the
>> Channel Box
>> 4. Disable "Echo All Commands"
>>
>> So then this snippet should toggle it the same way as the button:
>>
>>
>> *MEL*
>> 'toggleUIComponentVisibility("Channel Box / Layer Editor");
>>
>> *PYTHON*
>> import maya.mel as mm
>> mm.eval('toggleUIComponentVisibility("Channel Box / Layer Editor");')
>>
>>
>>
>>> Joao
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Python Programming for Autodesk Maya" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to python_inside_maya+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/78f29055-d459-4f96-86be-64c7e60724fcn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/78f29055-d459-4f96-86be-64c7e60724fcn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to python_inside_maya+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1Me8F5OCeb_BcXjEbgA4rjofd0rEAxoQMJdaJVHZ63UA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1Me8F5OCeb_BcXjEbgA4rjofd0rEAxoQMJdaJVHZ63UA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAJZGTKXLeFTiJF5cJAv1dQ8aOOirBt%2B6Z5taeFY84dWnXuWGAA%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAJZGTKXLeFTiJF5cJAv1dQ8aOOirBt%2B6Z5taeFY84dWnXuWGAA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFzJ14XcYKxNJpG9CFcNKELAXMLtBWAeT8DkZv4%3DA-W%2Bj0Y2Yw%40mail.gmail.com.

Reply via email to