[Bf-python] Some short questions
Jordi Rovira i Bonet
jordi.rovira at ima.udg.es
Tue May 20 12:33:32 CEST 2003
Hello,
I'm working a little bit more on the armatures module now that the
mesh is available, and i have some questions:
Take alook at the following:
import Blender
lamp1 = Blender.Lamp.Get("Lamp1")
lamp2 = Blender.Lamp.Get("Lamp1")
print lamp1
print lamp2
print (lamp1==lamp1)
print (lamp1==lamp2)
Result of execution:
[Lamp "Lamp1"]
[Lamp "Lamp1"]
1
0
Is that what we want? Actually, the two python objects are wrapping the
same C Lamp, so modifying properties on one will modify the properties
of the other, and the objects are not recognized to be the same at
python level.
In aramtures this is specially conflictive as bones are obtained from
very different functions: root bones of the armature, children of a bone
and parent of a bone (apart of the same case above), and they are likely
to be compared in lots of scripts (for example a simple export script i
was writting for NeoEngine).
The solution i've adopted redefines the comparison function of the
python objects at C level and compares the pointer. Another side benefit
of this is the capability to establish a strong ordering criteria... but
this is secondary.
A small standarization issue... we have:
static PyTypeObject object_type = ...
and
static PyTypeObject Lamp_Type =
A decission ON UPPER/LOWER cASe ShOUlD bE MADE HeRe...
Another issue, is that i don't allow to modify the hierarchy of bones,
only to read it and change the properties of the bones (no reparenting).
Mainly, because i still don't know if blender has standard functions to
deal with the lists it uses or if it has functins to made this
modifications with the hierarchy at C level but maintaing the
consistency (when a parent point to a children, the children must point
to the parent...). Is it ok if the first version of the armature module
is restricted this way?
That's all right now... i'll try to post a proposal this week...
(bandoler)
More information about the Bf-python
mailing list