[Bf-python] Support for a primitive progress bar is available

Gaia gaia.clary at machinimatrix.org
Fri Apr 19 22:05:30 CEST 2013


the current implementation uses what we have.
it is neither meant as the ultimate solution for a
fancy progress bar, nor is it meant as the final
implementation of it.

Here are 3 approaches how you can give it a
bit more of sense:

1.) percentage with 2 digit fraction:

min=0
max=9999
...
value = 100*current_percentage
progress_update(int(100*value))

This would give you the percentage count in the upper row
and the percentage fraction in the lower row


2.) percentage as integer value:

min=0
max=9999
....
value = int(current_pecentage)
progress_update(value)

This would give you an indicator that runs from 0 up to 99


3.) prepare for full progressbar

min= 0
max= vertexcount (or whatever you like)
...
value= vertexcount
progress_update(value)

This will just count up from 0 to
9999 regardless how many vertices
you have. this will look odd now, but fully
correct as soon as the final progressbar is available,
whenever that will happen.

cheers,
Gaia

On 19.04.2013 21:02, Dan Eicher wrote:
> HI,
>
> It seems odd it's mapped [0, 9999] instead of something that's a 
> direct representation of a percentage -- either [0.0, 1.0] or [0, 99] 
> -- since you most likely have to do a percentage calculation to figure 
> out the progress anyway.
>
> progress_update(items_finished/total_items)
>
> vs.
>
> progress_update((items_finished/total_items)*1000)
>
> Dan
>
> On Fri, Apr 19, 2013 at 8:14 AM, Gaia <gaia.clary at machinimatrix.org 
> <mailto:gaia.clary at machinimatrix.org>> wrote:
>
>     Hi;
>
>     We now (revision 56169) have a minimal progress bar.
>     Currently the progress is indicated by a number in the
>     range [0,9999]. This number is displayed instead of the
>     mouse cursor and it will show up as a 2*2 matrix
>     with 2 digits on each row.
>
>     The minimal progress bar even works when the user interface
>     is blocked during a long running script. The python interface
>     has been setup for future support of a true progress bar.
>
>
>     The python interface consists of 3 functions:
>
>     1.) bpy.context.window_manager.progress_begin(min,max)
>
>          This function must be called to initialise the propertybar.
>          If it is not called, then the propertybar will not show up!
>
>          min,max (float) is the number range for the property bar
>          This range is currently mapped to a range [0,9999]
>          to match the constraints of the cursor change function.
>
>          Note: The range must be > 0. otherwise the progressbar
>          will not be displayed.
>
>     2.) bpy.context.window_manager.progress_update(val)
>
>          Only when this function is called the cursor changes
>          its appearance.
>
>          val (float) must be a number in the range [min, max]
>          it is not checked if the number is in the correct range.
>
>     3.) bpy.context.window_manager.progress_end()
>
>          You call this function to change the cursor back to its
>          default appearance before your script terminates.
>
>     Here is a demo blend file with a minimal script that
>     shows how you can use the property bar:
>
>     http://www.pasteall.org/blend/20832
>
>     Thanks for Ideasman_42 and kaito for suggestions and help!
>
>     cheers,
>     Gaia
>     _______________________________________________
>     Bf-python mailing list
>     Bf-python at blender.org <mailto:Bf-python at blender.org>
>     http://lists.blender.org/mailman/listinfo/bf-python
>
>
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20130419/ffdb2351/attachment.html>


More information about the Bf-python mailing list