--Alex
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/6062e220-eed6-488f-8916-488e25d5ab5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1yXfMySPLDzbkWPbm9hEGeUdKgzf8c93TFCHGANu663Q%40mail.gmail.com.
--
For every function? I don’t think so, as it depends on what the function is doing.
For example, consider this.
def cache():
count = 10
while True:
count -= 1
if count < 0:
break
This would run until done, and there’s no way to determine how long it will take unless you knew the source.
For some functions, such as Maya’s geometry caching? Maybe, if it got implemented that way. I’d think that if it visually moves the timeline, there must be a way, however hacky. Otherwise you’re at the mercy of whatever notification mechanism got built into the function to start with.
subscribers = []
def cache():
count = 10
while True:
for func in subscribers:
func("%i loops left" % count)
count -= 1
if count < 0:
break
def update_my_widget(status):
# widget.setText(status)
print(status)
subscribers.append(update_my_widget)
cache()
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CABwp0vP6qtU1p1c_c3ayaZDoO2qR-bSc0neyneTUxcYFp-AKnw%40mail.gmail.com.
def centerPivots():
sel=pm.ls(sl=1)
count=0
for obj in sel:
pm.makeIdentity(obj,apply=True,t=1,r=0,s=0,n=0,pn=1)
count+=1
print str(count)+' of '+str(len(sel))def printWindow(message):
mayaOut=sys.stdout
sys.stdout=sys.__stdout__
print message
sys.stdout=mayaOut
For some functions, as they operate on large numbers of objects can be wrapped in another iterative function to give you the ability to provide progress.
def centerPivots():
sel=pm.ls(sl=1)
count=0
for obj in sel:
pm.makeIdentity(s,apply=True,t=1,r=0,s=0,n=0,pn=1)
count+=1
print str(count)+' of '+str(len(sel))
Though unfortunately in the instance of a cache function, it only operates usually on one object and doesn't have any discernible way of catching how far along the progress is. When watching a cache happen in GUI instances, you can see the timeline update as the function goes through. So as Marcus said, I am looking for a kind of hacky way of perhaps utilizing this fact to call functions.Another hacky way of automatically checking cache progress might be to have a function that checks the cache directory for output files and uses that to show progress.I have also built a function for printing out to the output window opposed to maya's internal script editor output in hopes to use that for writing out messages (for purposes of seeing progress during command line operation and as a result, farm job reporting).def printWindow(message):
mayaOut=sys.stdout
sys.stdout=sys.__stdout__
print message
sys.stdout=mayaOut
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/76bca305-f8ec-4caf-9ddf-9d56ed9db822%40googlegroups.com.