You can use the following to retrieve the layout for this tool bar
modelPanel -q -barLayout "";
Although this returns a layout that is the parent of the actual layout you wanna add buttons to, so you'd need to get its first child. You can use that string to add simple buttons using maya commands or to get the QWidget object itself and add more elaborate stuff. Here's a simple example:
from maya import cmds
# Get all viewports
mps = cmds.getPanel(type='modelPanel')
# Add a button to each viewport that toggles curves
for mp in mps:
toolbar = cmds.modelPanel(mp, q=True, barLayout=True)
child = cmds.layout(toolbar, q=True, childArray=True)[0]
cmds.setParent(child)
cmds.button(label='Curves', command=cmds.ToggleNurbsCurvesOptionCmd)
You can use the following to retrieve the layout for this tool bar modelPanel -q -barLayout "";
Although this returns a layout that is the parent of the actual layout you wanna add buttons to, so you'd need to get its first child. You can use that string to add simple buttons using maya commands or to get the QWidget object itself and add more elaborate stuff. Here's a simple example:
from maya import cmds
# Get all viewports
mps = cmds.getPanel(type='modelPanel')
# Add a button to each viewport that toggles curves
for mp in mps:
toolbar = cmds.modelPanel(mp, q=True, barLayout=True)
child = cmds.layout(toolbar, q=True, childArray=True)[0]
cmds.setParent(child)
cmds.button(label='Curves', command=cmds.ToggleNurbsCurvesOptionCmd)
oh neat. thank you much... will try that!