[Bf-python] Some Recent Patches to BPython

Stephen Swaney sswaney at centurytel.net
Fri May 6 13:50:53 CEST 2005


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.  To just get the names and not the entire
object, we could apply the name_only=1 metaphor we used in
Object.getData().

> *** Scene.getActive()
> https://projects.blender.org/tracker/index.php?func=detail&aid=2521&group_id=9&atid=127
> - Solves the problem where Object.GetSelected()[0] was assumed to be the 
> active object, which is not always true since the active object for a 
> scene does not have to be selected.

Is this different than Scene.GetCurrent() ?

-- 
Stephen Swaney			
sswaney at centurytel.net




More information about the Bf-python mailing list