[Bf-python] Proposed BPyAPI Additions.
Martin Poirier
theeth at yahoo.com
Thu Aug 31 21:07:19 CEST 2006
Hi Willian and all
> 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.
The poweriterator can implement the basic iteration
methods on ListBase, the manipulation methods that
aren't part of the set protocol will most likely have
to be costum though.
> 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.
This would be the only source of possible problems,
all the other obdata have only one BPy counterpart.
> > 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
from Blender import Lamp
scn.lamps.new(Lamp.SUN)
not too bad if you ask me
> 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.
I disagree, externalising constant values is one of
the first rule of proper programming.
Martin
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Bf-python
mailing list