[Bf-committers] Re: [Bf-blender-cvs] CVS commit: blender/source/blender/python/api2_2x Mesh.c blender/source/blender/python/api2_2x/doc Mesh.py

Campbell Barton cbarton at metavr.com
Sun Dec 17 16:22:05 CET 2006


Martin Poirier wrote:
> --- Campbell Barton <cbarton at metavr.com> wrote:
>
>   
>> Martin Poirier wrote:
>>     
>>> --- Campbell Barton <cbarton at metavr.com> wrote:
>>>
>>>   
>>>       
>>>> A the moment edges have a hash function that
>>>>         
>> returns
>>     
>>>> the edge index,
>>>>
>>>> edge.key is the same as  (min(ed.v1.index,
>>>> ed.v2.index), 
>>>> max(ed.v1.index, ed.v2.index))
>>>>
>>>> Maybe they can be merged, any thaughts?
>>>>     
>>>>         
>>> What's wrong with using the edge index as hash
>>>       
>> that
>>     
>>> you had to create an artificial key instead?
>>>
>>> Martin
>>>   
>>>       
>> if you want to find the edge that a face is using,
>> you can get the 2 verts, order the pair of indicies
>> and use them as a 
>> key to get the edge.
>> I was doing this in quite a few scripts, and while
>> not dificuled its 
>> fluff that can be better done this way.
>> Heres an example of how connectivity data can be
>> done with the new values.
>>
>>        edge_faces = dict([(ed.key, []) for ed in
>> me.edges])
>>        for f in me.faces:
>>            for key in f.edge_keys:
>>                edge_faces[key].append(f) # add this
>> face to the edge as 
>> a user
>>     
>
> I see. You need artificial keys because faces don't
> contain information about their edges.
>
> Wouldn't that be better fixed at the API level than
> letting the scripters take care of it individually by
> building edge lookups?
>
> Martin
>   
Iv thaught about it, A lot of people would probably like it but theres 
cases where face.edges isnt enough. sometimes you want to store extra 
data in there, or only build some edge data.

an example is in 2 uv mapping scripts I only build edge data for 
selected faces. then pass through and remove edges with seams.

It still might not hurt to have some me.buildFaceEdges(faces=[...]) 
function. so you could access face.edges




More information about the Bf-committers mailing list