[Bf-python] modifier api
Toni Alatalo
antont at kyperjokki.fi
Fri Oct 28 15:42:35 CEST 2005
there's been some talk on irc about the modifier api - pidhash/Joilnen was
drawfting something like this:
m = Modifier.New ('Subsurf')
o = Object.getSelected ()
o.addModifier (m)
which might be acceptable, given that the current API has many things like
that so it is at least a little consistent..
however, i'd greatly prefer:
m = SubsurfModifier()
but can we go there now 'cause it is different from the current API code which
still has the horrible .New()s?
we debated a bit and there were further suggestions, but i think this was
really going in the wrongest direction:
15:41 < pidhash> I thing Modifier.New ()
15:41 < pidhash> m= Modifier.New ()
15:41 < pidhash> m.setType ('Subsurf')
the different modifiers have close to nothing implementationwise. i dont think
it makes sense to be enable things like:
m = Modifier();
m.type = LATTICE;
o.modifiers += m;
m.type = WAVE
-- because a wave modifier and a lattice modifiers are different modifiers.
the attributes the various modifiers have are not the same. so it makes sense
to have different classes for them, and not a generic one. what attributes
would the generic one have and not have? and then when you change the type
the attributes it has would totally change - no good.
http://www.blender.org/~antont/green/modifier.py shows approximately what
they have (read the sdna modifier_types to avoid seeing the mistakes i did in
the interpretatation :)
so i figure that rare(?) occasion of changing a modifier type would be:
latm = LatticeModifier()
o.modifiers.append(latm)
(...)
wavem = WaveModifier()
o.modifiers.remove(lm)
o.modifiers.append(wavem)
and more usual usage would be:
#coolest windmeter ever
wm = WaveModifier()
o.modifiers.append(wm)
(..)
wm.speed = wind_speed(place='keizersgracht')
~Toni
More information about the Bf-python
mailing list