[Bf-taskforce25] data api proposal

Brecht Van Lommel brecht at blender.org
Mon Sep 29 19:27:28 CEST 2008


Hi Campbell,

On Mon, 2008-09-29 at 17:05 +1000, Campbell Barton wrote:
> No mention has been made of warnings/exceptions,
> could be good to be able to set an exception in the context, this can
> be parsed to the python api or displayed as an error in the user
> interface.
> eg. Set an image path -> warning this path dosnt exist.  Setting a
> bone size -> warning zero length bone will be removed,  Add a material
> -> warning over 16..... etc

I mentioned it briefly in the Validation, Context and Notifiers
section. This needs a nice API independent of the data API, also for
operators, to make those error() and notice() functions to be
non-blocking. Pretty simple system probably but good to put on
the todo for 2.5.

> Another thing that crossed my mind was that it could be good to have a
> way to delay updates (from the python api too), The context would
> accumulate flags of update types and then you could manually update,
> this should be off by default but in some cases where your setting
> many object transformation settings, you wouldnt want it to
> recalculate the worldspace location and constraints every time.

Notifiers in 2.5 in fact do get delayed until all events are handled.
The main event loop there is:

while(1) {
        wm_window_process_events(1);
        wm_event_do_handlers(C);
        wm_event_do_notifiers(C);
        wm_draw_update(C);
}

So actually if python wants to conform to the C code it should expect
notifiers to be delayed anyway. How well this will work in practice and
if there need to be exceptions where things need to be updated
immediately, we'll have to find out I guess.

> My approach to start this would be...
> * to write the C auto generated api
> * Generate a python api too.
> * generate a user interface automatically. (using min/max tooltips, groups etc)
> * implement notifiers, so changing values updates blender correctly.

> Then I think we'd be in a better position to deciede on the trickier
> stuff. experement getting IPO's using the api and make decisions as to
> how this works.

OK, makes sense.

> Brecht, let us know if you start this yourself, if you could use some
> help. I have a bit of free time now were in bcon4 :-/ so would not
> mind writing up a c api as you have documented.

If you want to start an implementation of this, please go ahead.

Cheers,
Brecht.



More information about the Bf-taskforce25 mailing list