[Bf-taskforce25] data api proposal

Martin Poirier theeth at yahoo.com
Sun Sep 28 17:16:53 CEST 2008


Hi,

--- On Sat, 9/27/08, Brecht Van Lommel <brecht at blender.org> wrote:

> I've made a proposal on a Blender Data API design:
> 
> http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataAPI
> 

"""
If lists are accessible with keys, then is the term 'list' correct? It is more an map/dictionary/associative array in that case. But of course even if a key is available for every item, that does not mean a lookup is actually efficient, so what would be right name?
"""

Collection could be used in both cases (indexed or key access).

"""
Is notify() part of set()?
"""

No. I suggest having it like that (names are suggestions):

Set(): Does type and bounds checks, assign new value
Notify(): called after data change
Modify(): Calls set() then notify() if set was successful.

Set is an internal method when we need to bypass notifiers. Modify is the external method.


"""
BDP_prop_describe defines the UI name and tooltip. There should be some rules about capitalization, ending tooltips with a "." or not, ..
"""

We could easily make a script to parse all those and standardize.

"""
How can we generate nice header files that are a mix of auto generated code and manually written code? 
"""

We could have comment tags, picked up by the generator.

Something like:
-------------------
/* THIS IS GENERATED CODE */

some generated code here

/* END GENERATED CODE */

hand written code here
-------------------

On generation, the generator would read the previous result and only replace stuff between tags.

"""
How should a string get func be defined? It would be preferable to avoid memory allocations, but on the other hand direct pointers to data are technically not allowed since according to the decoupling with DNA structs, there does not have to be an actual string in the DNA struct.
"""

Getters will have to take a pointer as argument, the getter function will copy data in there. The same problem/solution applies to matrix, quat, color getters.

"""
The property name used for the python API and auto generated C API should have a consistent naming scheme. Do we use underscores, camel case, .. ? 
"""

I usually prefer camel case for functions and data types, underscores for variables/struct members.



Martin


      


More information about the Bf-taskforce25 mailing list