On Sat, Oct 19, 2019, 7:56 AM kiteh <kiteh.0...@gmail.com> wrote:

> Is it possible to have all the maya commands within a method to be
> integrated into cmds.progressBar?
> I am trying to denote the process rather than just using the waitCursor
> icon (as it may be deem as the application hanging)
>
> However I am having issues in incrementing the process.
>
> import maya.mel
>
> def anim_baking(startFrame, endFrame):
>     gMainProgressBar = maya.mel.eval('$tmp = $gMainProgressBar')
>     cmds.progressBar(
>         gMainProgressBar,
>         edit=True,
>         beginProgress=True,
>         isInterruptable=True,
>         status='Creating the helpers...',
>         maxValue=(endFrame-startFrame))
>
>     selections = cmds.ls(sl=True, l=True)
>
>     for sel in selections:
>         cmds.progressBar(main_progress_bar, edit=True, step=1)
>
>         # create locators
>         ...
>         # do the constraints
>         ...
>         # iterate channels and set some attributes
>         ...
>         # bake out the locators
>         cmds.bakeResults(...)
>         # remove the constraints
>         ...
>
>     cmds.progressBar(gMainProgressBar, edit=True, endProgress=True)
>
> The progress bar and text does shows up in the bottom left hand but the
> progress seemingly only starts at 1-3% (no increments thereafter) and the
> whole bar ends shortly after.
>
> I was hoping something along the line such as, when it creates the
> locators, it will be 5%, when it went to the constraints, it will be 10%
> etc.
>

There needs to be a correlation between your min/max progress bar setting,
and the step value. But it looks like you set up the range based on an
input start/end frame and then base the progress bar step on the number of
selections. That will make your progress bar hang around at a low value if
you have a large frame range input and only a few selections.
Since Maya is not doing anything magical with your method calls to know
when to increment your progress, that means you need to come up with a
better fitting min/max and an appropriate time to step.

I would suggest first getting your selection. Let's say there are 10 items.
Then you can take the number if steps that you have to do in each loop and
multiply your selection.

Max = len(sel) * 5

Now you can call step=1 after each of those 5 operations in your loop. The
progress bar will increment based on your real work.


>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/149cbf92-a2a3-42b9-b581-055fe25bfa49%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/149cbf92-a2a3-42b9-b581-055fe25bfa49%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2cQ4Hu%3Dn3tm%2B2RHpxMKj2eBKL%3D9XDtP3cYKzuJZwr%2B5g%40mail.gmail.com.

Reply via email to