Sorath
06-12-2012, 02:38 PM
hi,
this is strange!!!
or maybe I am missing something, but as soon as the user interrupts the progressbar with pressing esc and sources the script again, it only works on the first selected object and not anymore on all objects.
Can anyone tell me what I am missing here?
once you run through the whole progress bar you can source the script again and it will not stop after the first object.
first create some objects to have a mass of objects generating a long progress bar - long enough for us to cancel:
import maya.cmds as mc spheres = []
for i in range (0, 2000):
obj = mc.sphere()
spheres.append (obj[0])
mc.select (spheres)
and now the progress bar script:
import maya.cmds as mc selection = mc.ls (sl=1)
counterMaxLength = len (selection)
gMainProgressBar = maya.mel.eval('$tmp = $gMainProgressBar');
mc.progressBar( gMainProgressBar,
edit=True,
beginProgress=True,
isInterruptable=True,
status='"loading user selection ..."',
maxValue=counterMaxLength )
currentCount = 0
for sel in selection:
print sel
currentCount += 1
mc.progressBar(gMainProgressBar, edit=True, step=1)
if mc.progressBar(gMainProgressBar, query=True, isCancelled=True):
break
mc.progressBar(gMainProgressBar, edit=True, endProgress=True)
any Input very appreciated!!
I'm kinda stuck here.
this is strange!!!
or maybe I am missing something, but as soon as the user interrupts the progressbar with pressing esc and sources the script again, it only works on the first selected object and not anymore on all objects.
Can anyone tell me what I am missing here?
once you run through the whole progress bar you can source the script again and it will not stop after the first object.
first create some objects to have a mass of objects generating a long progress bar - long enough for us to cancel:
import maya.cmds as mc spheres = []
for i in range (0, 2000):
obj = mc.sphere()
spheres.append (obj[0])
mc.select (spheres)
and now the progress bar script:
import maya.cmds as mc selection = mc.ls (sl=1)
counterMaxLength = len (selection)
gMainProgressBar = maya.mel.eval('$tmp = $gMainProgressBar');
mc.progressBar( gMainProgressBar,
edit=True,
beginProgress=True,
isInterruptable=True,
status='"loading user selection ..."',
maxValue=counterMaxLength )
currentCount = 0
for sel in selection:
print sel
currentCount += 1
mc.progressBar(gMainProgressBar, edit=True, step=1)
if mc.progressBar(gMainProgressBar, query=True, isCancelled=True):
break
mc.progressBar(gMainProgressBar, edit=True, endProgress=True)
any Input very appreciated!!
I'm kinda stuck here.
