Hey there,
For an export tool, I need to create a maya window.
The window creates a button for each successfull export to copy the output path.
Problem is, after the window is copied, all the buttons point to the same path.
When printing the output path at button creation, they are correct: the args seem to become wrong once the window is actually created.
Does anyone have a solution?
Thanks
targets = { 'A':{'abc_export_path':'L:/A.abc', 'namespace':'abc_A'},
'B':{'abc_export_path':'L:/B.abc', 'namespace':'abc_B'},}
import clipboard
from maya import cmds
# create window
myWin = cmds.window(title='Abc Export', widthHeight=(150, 100), resizeToFitChildren=True, toolbox=True)
cmds.columnLayout( adjustableColumn=True )
# logg frame range
for root, data in targets.items():
# logg success
print ('creating UI button: ' + data.get('abc_export_path'))
cmds.text(label = root )
cmds.button( label='Copy Path' + root, align='center',
command= lambda x: clipboard.copy( data.get('abc_export_path') ) )
# show window
cmds.showWindow(myWin)