f3rry
07-18-2012, 01:27 AM
Hi all, Can anyone help me to solve this problem please? I got this python script:
import maya.cmds as mc
def testA () :
result = ''
while result == '':
result = testB()
print result
def testB () :
sel = mc.ls(sl=1)
if sel :
if sel[0] == 'pCube1' :
return sel[0]
else :
mc.select(cl=1)
mc.scriptJob(runOnce=1,ct=['SomethingSelected', testB])
else :
mc.select(cl=1)
mc.scriptJob(runOnce=1,ct=['SomethingSelected', testB])
What I need to do is for testA to wait until a valid string variable is returned, and then print it. testB will keep running itself until my first object selection is 'pCube1' and 'pCube1' is returned. I need something like a "wait" function in python.... or in maya term... a scriptjob in python.
the while statement block everything i can no longer make any selection in the scene. And if I put
result = testB()
It doesnt seem to wait until it received a return, it simply gives me this line :
# Result: <function testA at 0x0000000039167898> #
Anyone? Thanks in advance
import maya.cmds as mc
def testA () :
result = ''
while result == '':
result = testB()
print result
def testB () :
sel = mc.ls(sl=1)
if sel :
if sel[0] == 'pCube1' :
return sel[0]
else :
mc.select(cl=1)
mc.scriptJob(runOnce=1,ct=['SomethingSelected', testB])
else :
mc.select(cl=1)
mc.scriptJob(runOnce=1,ct=['SomethingSelected', testB])
What I need to do is for testA to wait until a valid string variable is returned, and then print it. testB will keep running itself until my first object selection is 'pCube1' and 'pCube1' is returned. I need something like a "wait" function in python.... or in maya term... a scriptjob in python.
the while statement block everything i can no longer make any selection in the scene. And if I put
result = testB()
It doesnt seem to wait until it received a return, it simply gives me this line :
# Result: <function testA at 0x0000000039167898> #
Anyone? Thanks in advance
