Skip to content

Instantly share code, notes, and snippets.

@nrtkbb
Last active March 19, 2018 09:00
Show Gist options
  • Save nrtkbb/ebb75dd715f37d0d248ff86b87c02b4c to your computer and use it in GitHub Desktop.
Save nrtkbb/ebb75dd715f37d0d248ff86b87c02b4c to your computer and use it in GitHub Desktop.
Mayaのヘルプラインにプログレスバーを出す時の便利クラス
from progress import Progress
from maya import cmds
sels = cmds.ls(sl=True)
progress = Progress(len(sels))
try:
for sel in sels:
progress.count()
print(sel)
finally:
progress.end()
from maya import cmds
from maya import mel
class Progress(object):
def __init__(self, max_count):
bar = mel.eval('$tmp = $gMainProgressBar')
self.bar = cmds.progressBar(
bar,
edit=True,
beginProgress=True,
status=u'Progress ...',
minValue=0,
maxValue=max_count,
isInterruptable=False,
)
def count(self):
cmds.progressBar(
self.bar,
edit=True,
step=1,
)
def end(self):
cmds.progressBar(
self.bar,
edit=True,
endProgress=True
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment