[Bf-python] memo + new MetaBall

Willian Padovani Germano wgermano at ig.com.br
Wed May 21 04:03:03 CEST 2003


On Tue, 2003-05-20 at 22:07, guignot wrote:
> This short memo concerns the homogeneity of the interface.
(...)
> cam_id->getClipStart()
> and cam_id->setClipStart(value)

or (in Python) cs = cam.clipstart, cam.clipstart = value, using the
getAttr, setAttr way.
 
> (for vectors or coordinates, we can use (Python point of view) set(list) 
> or set(val1,val2,val3). Or both. I choosed the latter but it can be 
> easily changed.

Or added.  When you test PyObject *args with Py_ArgParse, you can do it
twice and check once for "fff" and then for a single list with three
elements.  But don't worry now, these are new features that we'll take
care of after the debut of exppython.  What you did is fine for now.
 
> The access to the field 'x' of the third metaelem of the metaball mb can 
> be granted with
> mb->getMetaElemx(2)   (2 because begins at 0)
> or by mb->getMetaElem('x',2)
(...)
> What's your opinion :
> a) implement both
> b) implement first only
> c) implement second only ?
> d) implement another one ?

b) or c): Choose one of them, no need to implement both or another one.

Mm... it's that choice between many small repetitive functions OR one
big function with many "if's" and string compares.  The first case is
faster, but it increases greatly the number of methods.

All the 2.25 API could have been done this way, with e.g.
cam.getAttr('len')
cam.setAttr('len', value)

it's good for code in python, since you can do things like

list = ['len', 'clipStart', 'clipEnd', 'drawSize']
for var in list:
  print cam.getAttr(var)

But they chose the cam.getLen(), cam.setLen(value) approach.  Actually
there are less get/set methods in 2.25, we have been implementing them
for all variables, as the original programmer(s) probably would.

Both are good, I guess you can keep the one you chose, this module is
slightly different from others and is new.  But one minor thing with
method names:  we use uppercase to separate words:

getMetaElemx would be more readable as getMetaElemX.  Same for other
functions in the files you sent.

> -->Willian : tried to follow nan cod. guidelines! but 80cols is WAY TOO 
> SHORT!!!!!!!!!!!!!!!!!!

Not my convention -- it was there before I could get my hands on a
computer : ).  But those days some had to buy 80-column adapters to get
that much ...

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list