Discussion:
[Maya-Python] progressWindow to tie in for bakeResults
kiteh
2018-10-01 22:19:39 UTC
Permalink
I am trying to make use of `cmds.progressWindow` during my animation baking
function.
However, while doing so, it seems that my `cmds.progressWindow` only
effects after my `cmds.bakeResults`... There is a window popup however, I
am not seeing any gauge...

Or if there is a way that I can still make use of the progressWindow and
have it populate by per function?

This is my current code:
def do_bake(self, selections):
...
...
cmds.bakeResults(
(sel_attrs if attr_names else selections),
hierarchy="both",
preserveOutsideKeys=True,
simulation=True,
time=(init_start, frame_range[1])
)

# I tried to do the following
amount = 0
for sel in selections:
if cmds.progressWindow( query=True, isCancelled=True ) :
break
# Check if end condition has been reached
if cmds.progressWindow( query=True, progress=True ) >= 100 :
break

amount = amount + 1
status_msg = "Processing: {0}".format(amount)
cmds.progressWindow(edit=True, progress=amount, status=status_msg)

cmds.progressWindow(endProgress=1)


def main():
cmds.progressWindow(
title='My Test Window',
progress=amount,
status='Processing: 0%',
isInterruptable=True
)

selections = self.check_current_selections()
parent_constrains = self.do_parent_constrain(selections)
animation_bake = self.do_bake(selections)
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/6e15b594-198d-443b-b1de-384dd8621be6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Justin Israel
2018-10-01 22:43:10 UTC
Permalink
The problem is that your cmds.bakeResults() is a blocking call. It won't
return until the operation is complete. After that, your progressWindow
logic is simply to loop over a list of selections and advance the progress,
which is effectively going to be instant, so that isn't a great way to
advance the progress.
The way to use progressWindow is when you have operations that can happen
during each loop, or at least some observable state that can change while
you are looping. It won't work to check progress after the thing you ran
has already finished.

Maybe there is some way to bake in time chunks, as part of your progress
loop?
Post by kiteh
I am trying to make use of `cmds.progressWindow` during my animation
baking function.
However, while doing so, it seems that my `cmds.progressWindow` only
effects after my `cmds.bakeResults`... There is a window popup however, I
am not seeing any gauge...
Or if there is a way that I can still make use of the progressWindow and
have it populate by per function?
...
...
cmds.bakeResults(
(sel_attrs if attr_names else selections),
hierarchy="both",
preserveOutsideKeys=True,
simulation=True,
time=(init_start, frame_range[1])
)
# I tried to do the following
amount = 0
break
# Check if end condition has been reached
break
amount = amount + 1
status_msg = "Processing: {0}".format(amount)
cmds.progressWindow(edit=True, progress=amount, status=status_msg)
cmds.progressWindow(endProgress=1)
cmds.progressWindow(
title='My Test Window',
progress=amount,
status='Processing: 0%',
isInterruptable=True
)
selections = self.check_current_selections()
parent_constrains = self.do_parent_constrain(selections)
animation_bake = self.do_bake(selections)
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/6e15b594-198d-443b-b1de-384dd8621be6%40googlegroups.com
<https://groups.google.com/d/msgid/python_inside_maya/6e15b594-198d-443b-b1de-384dd8621be6%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 python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2ZY%2BvrXvYXYKq60a6VT55hnA3ZUXLOJxMCZ05tXYkndg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...