[Bf-python] new python development path

Gilbert, Joseph T. jgilbert at tigr.ORG
Thu Feb 9 20:12:01 CET 2006


It's a nice idea but it conflicts with the 'new' model of the api
redesign.

Currently we wrap unlinked data as python objects. The 'new' model that
Willian is talking about will only wrap Object+data objects. Unlinked
data cannot be modified or accessed.

Having a dictionary'esqe method of wrapping G.main supposes that we are
giving access to datablocks; which in the 'new' model we are not.


-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Joe Eagar
Sent: Thursday, February 09, 2006 1:36 PM
To: Blender Foundation Python list
Subject: Re: [Bf-python] new python development path

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
_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python



More information about the Bf-python mailing list