[Bf-python] object.getDataName() - Implimented

Campbell Barton cbarton at metavr.com
Sun Jan 30 11:32:00 CET 2005


Stephen Swaney wrote:

>On Sat, Jan 29, 2005 at 10:51:15AM +0000, Campbell Barton wrote:
>
>  
>
>> I was perplexed that There was no way to get the name of all the 
>>meshs without doing a getData- Which can be slow with large mesh's.
>>    
>>
>
>This brings up an interesting point about the design of bpy types.
>Most of our types were designed as thin python wrappers around blender
>data.  This makes something like obj.getData().getName() a fairly
>lightweight operation.
>
>Our NMesh type is an exception, in that it creates quite a few useful
>but relatively expensive lists.  Just a random thought, but one way to
>get around the overhead of bpy type creation is to use lazy
>initialization.
>
>With lazy initialization, creating expensive data structures is not
>done at object creation time, but is put off until the data is
>actually accessed.  A flag or even the raw pointer is used to keep
>track of the object's initialization state.
>
>For our NMesh, this would mean we could get at the underlying blender
>data without having to suffer through the work of creating all the
>vert, edge and face data.  Operations like this would then be cheap:
>
>objs = Object.Get()
>for o in objs:
>	print o.getData().getName()
>
>  
>

I thaught of that but my coging is no where near good enougbh to 
impliment it,
by the way, its
o.getDataName()
not - o.getData().getName()
...Otherwise it would be calling getData anyway, this skips the detdata 
call and only gets the name.

Weather lazy initialization is added or not I still think this could be 
usefull-
eg
to make a name based on ObName + dataName///
now
  ob.name + '_' + ob.gatData().name
would be...
  ob.name + '_' + ob.gatDataName()

And would not load a whole mesh with 100,000s verts into memory.

- Cam


-- 
Campbell J Barton

Sierra Suites Hotel
32 Fourth Av Waltham, Room 103
phone: 781 622 1900
mobile: 617 935 6773

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241




More information about the Bf-python mailing list