[Bf-python] Some Recent Patches to BPython

Campbell Barton cbarton at metavr.com
Fri May 6 14:58:11 CEST 2005



Martin Poirier wrote:
> --- Stephen Swaney <sswaney at centurytel.net> wrote:
> 
>>On Fri, May 06, 2005 at 07:01:07PM +1000, Campbell
>>Barton wrote:
>>
>>>Hi, Recently  have added some small usefull
>>
>>patches to the patch tracker.
>>
>>>Heres a list
>>>
>>>
>>>*** NMesh.GetNames()
>>>
>>
> https://projects.blender.org/tracker/index.php?func=detail&aid=2523&group_id=9&atid=127
> 
>>>- Solves the problem where it is impossible to get
>>
>>mesh objects with a 
>>
>>>fake user/no users. Unless you alredy knew the
>>
>>name.
>>
>>>- Provides a much faster and simpler method the
>>
>>the current Python
>>
>>># Gets a list of unique nmesh names
>>>nmesh_names = []
>>>for ob in Objects.Get():
>>>____if ob.getType() == 'Mesh':
>>>________if ob.getData(name_only=1) not in
>>
>>nmesh_names:
>>
>>>____________nmesh_names.append(
>>
>>ob.getData(name_only=1) )
>>
>>># Now we have a list.
>>
>>I was not aware this was a problem.
>>
>>Based on the rest of the Bpy API, I would expect
>>NMesh to have
>>a Get() method that either returns the named object
>>or a list
>>of all the Nmeshes.
> 
> 
> Legacy fun again. NMesh.GetRaw() with no parameter
> returns a new NMesh object (we have the New() method
> to do that too now) while GetRaw(name) with a name
> that doesn't exists returns None.
> 
> Martin

GetRaw(1) would be fine since BPython can know that an int is delt with 
differently to a string. though I thing GetNames() is more a more 
obvious choice (namespace considered).
Cam



More information about the Bf-python mailing list