The Ziva-VFX plugin breaks shelves in Maya

The Ziva-VFX plugin, when launched, will always delete and re-create the Ziva shelf.
This leads to a known issue in Maya (problem over 10 years old!):

Shelf buttons disappear upon restarting Maya

Solution from @monoteba - fix_empty_shelves.py

But, in the case of the Ziva-VFX plugin, this method will not solve the problem.
First you need to fix the source of the problem.
To do this, we need to fix the script (zivaShelf.py) that creates the Ziva shelf.
Namely, fix the build_shelf() function

For example (in Windows):
C:\Program Files\Ziva\VFX\Ziva-VFX-Maya-Module\ZivaVFX-Maya-2_2\scripts\zivaShelf.py

Original version:

def build_shelf():
    """Build the Ziva shelf.
    """
    root = _shelf_root()
    shelves = cmds.layout(root, q=True, ca=True)

    desc = _shelf_dict()

    if _SHELFNAME_ in shelves:
        cmds.deleteUI(root + '|' + _SHELFNAME_, layout=True)
        shelves.remove(_SHELFNAME_)

    shelf = mel.eval('addNewShelfTab("{0}")'.format(_SHELFNAME_))
    lyt = cmds.layout(shelf, q=True, ca=True)
    if lyt:
        for item in lyt:
            cmds.deleteUI(item)
    _add_buttons(shelf, desc)

Revised version:

def build_shelf():
    """Creation/modification the Ziva shelf.
    """
    root_shelf_layout = _shelf_root()
    all_shelves = cmds.layout(root_shelf_layout, query = True, childArray = True)
    current_shelf_tab_name = cmds.tabLayout(root_shelf_layout, query = True, selectTab = True)

    if _SHELFNAME_ in all_shelves:
        ziva_shelf_path = '{}|{}'.format(root_shelf_layout, _SHELFNAME_)
        ziva_shelf_childs = cmds.layout(ziva_shelf_path, query = True, childArray = True)
        if ziva_shelf_childs:
            for item in ziva_shelf_childs:
                cmds.deleteUI('{}|{}'.format(ziva_shelf_path, item))
    else:
        ziva_shelf_name = mel.eval('addNewShelfTab("{0}")'.format(_SHELFNAME_))
        ziva_shelf_path = '{}|{}'.format(root_shelf_layout, ziva_shelf_name)
    desc = _shelf_dict()
    _add_buttons(ziva_shelf_path, desc)
    cmds.tabLayout(root_shelf_layout, edit = True, selectTab = current_shelf_tab_name)
    cmds.saveAllShelves(root_shelf_layout)

In addition, in the _ad_buttons(parent, desc) function, in the cmds.shelfButton() command, you can comment out or remove the noDefaultPopup(ndp)=True flag (Disable the default popup menus.).

Correct and save the zivaShelf.py script.
Launch Maya.
Execute the script fix_empty_shelves.py
Restart Maya.

All shelves in Maya should now function correctly.
:slight_smile:

1 Like