[Bf-python] some suggestions for bpy

Theo de Ridder theo.de.ridder at planet.nl
Wed Oct 17 12:02:55 CEST 2007


Inspired by many discussions during the Blender conference I thougth  
a little
about what would make bpy a lot closer to what I prefer without  
changing its
basic concepts. So here some first ideas.

- bpy.data
	'data' is a word that is very overloaded in Blender, I would suggest  
to use 'blocks' instead,
	its a plural, close to LibBlockSeq, and much less confusing than  
'data'.

- bpy.data.scenes, bpy.data.meshes, ...
	all deliver the same type (reflecting C), but why not have subtypes  
of LibBlockSeq ?

- bpy.data.<seqname>.new(...)
	'add' would be less confusing than 'new' (or else 'addnew')

- bpy.data.<seqname>[<str>]
	why not accept also a regular expr as index selecting a subsequence?
	which combined with previous subtype remark enables: bpy.blocks[<re>]
	(grouping different types by common parts in names)

- bpy.blocks.<seqname>.attrs[<attrname>]
	creates an efficient iterator for a specific attribute like 'loc'

- bpy.blocks.<seqname>.attrs[<attrname>] = <value_sequence>
	efficient assignment of a certain attribute of each element in a seq  
in 1 assigment
	(without looping in Python)

I will experiment with wrapping these last 2 techniques in numpy, if  
that works
indeed efficiently than what I did now specifically with keyblocks  
can be applied very generic
for any collection.

Theo




More information about the Bf-python mailing list