Hi everyone,
Iโm still working on a simple sanity check for Maya, and I have a noob question. Everything was going great until I added a menu in Maya to launch my script, and I put my UI creation in a function.
Here is my simplified script to explain my problem
import pymel.core as pm
###################### GLOBAL VARIABLES #####################
projectVersion = 20180600
###################### CHECK FUNCTIONS ############################
def checkMaya():
version = pm.about(api=True)
if version != projectVersion:
log.insertText(โERROR* file is not created with MAYA 2018 service pack 6\nโ)
else:
log.insertText("OK maya version is " + str(projectVersion) + โ\nโ)
########################### UI ###########################
def baguetteUI():
with pm.window('win', title="Sanity Check", width=400, height=700, sizeable=0):
with pm.frameLayout(lv=False):
pm.text(label="SCENE MANAGMENT", fn="boldLabelFont", ebg=True, bgc=(0.2,0.2,0.2), h=20)
with pm.rowLayout(numberOfColumns=2, cw=(1,350)):
versionCheckbox = pm.checkBox(label="Maya version Check", value=1)
pm.button(label="Check", command = pm.Callback( checkMaya ) )
with pm.autoLayout():
log = pm.scrollField(ed=False)
baguetteUI()
So now that my UI is in a function I canโt access โlogโ, which is the scrollfield instance ( I have the same problem with the checkboxes actually ). I have no idea how to deal with this. I tried to return a string from my functions,also tried to switch to a class, but I always face the same problem at some point when I want to update the ScrollField. Any suggestion?
Thanks !!!