Message 1 of 2
Maya 2022 Python 3 shelfButton code error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm updating some code to run with Maya 2022 and noticed that these lines:
names = cmds.shelfLayout(current_shelf, query=True, childArray=True) or []
labels = [cmds.shelfButton(n, query=True, label=True) for n in names]
for getting shelfbutton names and then labels is giving me the following error:
# labels = [cmds.shelfButton(n, query=True, label=True) for n in names]
# RuntimeError: Object 'separator21' not found. #
Is there a modified way to do this in Python 3?
I also tried creating a new shelf:
# Create shelf if needed
if not (cmds.shelfLayout(shelf_name, ex=1)):
cmds.shelfLayout(shelf_name, p='ShelfLayout')
This works, but the shelf is not visible anywhere.
Thank you,
Adnan Hussain