[Bf-python] Proposed BPyAPI Additions.

Willian Padovani Germano wgermano at superig.com.br
Thu Aug 31 19:58:37 CEST 2006


Hey theeth,

Martin Poirier wrote:
> Just a couple of comments on the proposed additions:

This is very early material, the actual API, etc. is up to be discussed.

> scn.objects.new(Types.Mesh)

I dislike this, too. Had thought about:

1) scn.objects.addMesh(name = 'Mesh', dataname = 'Mesh', data = None)
(or scn.addMesh())
equiv. for other ob types.

The issue with this is that .addMesh(), etc. would be specific to 
.objects iterator, so we can't have a single "poweriterator" type for 
all our needs. Important / minor issue? To be decided, like the rest here.

2) separate by object type: have scn.meshes, scn.lamps, etc.:
scn.meshes.add(name = 'Mesh', dataname = 'Mesh', data = None)

scn.meshes holds objects, not obdata, which could be confusing since we 
have Mesh / NMesh modules that relate to obdata.

> For the rest, I don't quite like the DataBase name,
> that thing is far from being a database implementation
> and calling it that I think is might be a bit
> confusing. I'd propose just calling it Data.

I don't either, but I don't have a good suggestion. When I thought about 
this (and yesterday, talking to Campbell), I used Blender.Base, but 
yours, Blender.Data doesn't sound bad.

> On the Constants topic

Agree with your concerns, we do have a problem here if we want a less 
verbose, simple alternative API for basic operations.

Ex:

scn.lamps.new(<sun type>)

where <sun type> can be:

Blender.Lamp.Types.Sun
Blender.Constants.LAMP_TYPE_SUN
Blender.Constants.Lamp.Type.Sun
Blender.LAMP_TYPE_SUN
Blender.LampTypes.Sun
and other variations

Neither of these look nice. I'm even considering that the decision to 
favor constants instead of strings may not have been the best: 
scn.lamps.new(type = 'Sun') looks good enough.

-- 
Willian



More information about the Bf-python mailing list