Skip to content

Is there a way to access / override the USD Layer editor buttons from python ? #3666

Closed Answered by voidreamer
voidreamer asked this question in General
Discussion options

You must be logged in to vote
import maya.OpenMayaUI as omui
from shiboken2 import wrapInstance
from PySide2 import QtWidgets, QtCore

usdLayerEditorView = omui.MQtUtil.findControl('mayaUsdLayerEditor')
usdLayerEditorViewPtr = wrapInstance(int(usdLayerEditorView), QtWidgets.QWidget)

def customFunction():
    print('test')

for buttonn in usdLayerEditorViewPtr.findChildren(QtWidgets.QPushButton):
    if buttonn.toolTip().lower() == "save all edits in the layer stack":
        buttonn.clicked.disconnect()     
        buttonn.clicked.connect(customFunction)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by voidreamer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant