[Bf-python] new python development path
Joe Eagar
joeedh at gmail.com
Thu Feb 9 19:35:33 CET 2006
Willian Padovani Germano wrote:
> Toni Alatalo wrote:
>> so is the object model modification to be done in which side?
>
> Each coder seems to prefer a different approach.
>
> Some like the current way:
>
> ob = Object.Get('obname')
> me = Mesh.Get('mename') # or me = ob.data
>
> The problem with OBDATA.Get() functions is that they give direct
> access to obdata w/o setting a clear link to some object. Ton even
> asked us to access via object, you remember.
>
> Not letting direct access to obdata (aka removing Camera.Get('cam'),
> Mesh.Get, NMesh.GetRaw, etc.) seems to be a good way to follow Ton's
> request and also save us from problems we've found here and there.
> It's not a whole step toward oop, but may be close enough and means
> minimal changes for users to adapt to.
>
> To access obdata, we can simply use ob.data fields:
>
> ob = Object.Get('obname')
> me = ob.data
>
> To access unlinked obdata, we can have something like
> OBDATA.GetUnlinked(), which returns a list of obdata *names*. With
> these names we can link to an ob and only then be able to edit this
> obdata, like in Blender itself.
>
>> we dont use python much anymore, just keep Render, Mesh, Object,
>> Actions etc. intact and the addition of an NLA api, basically just
>> the Strip type, would be nice :)
>> i have drafted tests, in py, for the new object model that we
>> discussed in that one meeting. simple stuff like:
>>
>> sourcearm = Blender.armatures['armature']
>
> for this we'd need our own special dict type that only accesses data
> on demand, right? Consider a scene with hundreds of objects, it'd be a
> little expensive to create and keep Blender.armatures, .meshes, etc.
> dicts.
There'd be no need to maintain an actual dictionary. Just imagine it's
a function; when the get item function is called in armature, it loops
through the armature linked-list and find the armature with the correct
name.
This way it'd be more like a thin wrapper around Blender's ID struct
then anything else.
joeedh
More information about the Bf-python
mailing list