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

Bassam Kurdali bassam at urchn.org
Fri Apr 19 22:28:39 CEST 2013


This will only work if I have not 'surrendered' control, right?
I've got currently a script that tries to ease some of the changing of
settings for open gl previews, and it calls the actual operator after
changing some settings.
The problem is, unlike a normal preview, I lose the ability to hit esc
(and I would like at least a progressbar)
Do you know if I can do this?
On Fri, 2013-04-19 at 22:05 +0200, Gaia wrote:
> 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>
> > 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
> >         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
> 
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python





More information about the Bf-python mailing list