constructors (Re: [Bf-python] More Proposed API changes.)
Toni Alatalo
antont at kyperjokki.fi
Mon Mar 12 13:57:12 CET 2007
Campbell Barton kirjoitti:
letting this sink more, this feels like the greatest thing for bpy :)
but another thing.. i dont want to start a huge endless debate, like we
have had many on irc around these things, but i still want to voice this
out:
> http://members.optusnet.com.au/cjbarton/BPY_API/Bpy-module.html
i'd prefer constructors over dataiterator.new s.
the problem that scene members can not live alone could be nicely
overcome by requiring a scene instance as an argument for the
constructor. so instead of:
scn = bpy.scenes.active
me = bpy.meshes['mymesh']
ob = scn.objects.new(me)
i'd like:
scn = bpy.scenes.active
me = bpy.meshes['mymesh']
ob = bpy.Mesh(scn, me)
creating by passing the context to a constructor is for me the
equivalent of having a scene open in the UI and creating.
especially because not all things even are in a scene like that!
this is awkward:
snd = bpy.sounds.load(sound_dir + filename)
why would you create something via the iterator for those things?
this i think would be better:
snd = bpy.Sound(sound_dir + filename)
the fact that that snd is then also in bpy.sounds is ok, i think a good
side effect - but the iterator is not what you are concerned about when
creating, just the type! these are of course not mutually exclusive, if
you want to keep .new and .load too, but i hope you seriously consider
having constructors (too).
~Toni
More information about the Bf-python
mailing list