Using a expression is a hacky way to run a function every time the frame change. Maya will evaluate the expression at every frame change and you can call your mel or python function from the expression.
2015-08-21 15:37 GMT+01:00 Alex Rideout <[email protected]>: > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/76bca305-f8ec-4caf-9ddf-9d56ed9db822%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/76bca305-f8ec-4caf-9ddf-9d56ed9db822%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CABwp0vMDNmCUO2jPtPYqU4Rkox3hJWKbgHyPHGgM0PQdeKaBJw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
