Last active
March 19, 2018 09:00
-
-
Save nrtkbb/ebb75dd715f37d0d248ff86b87c02b4c to your computer and use it in GitHub Desktop.
Mayaのヘルプラインにプログレスバーを出す時の便利クラス
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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