[Bf-python] Some Recent Patches to BPython
Campbell Barton
cbarton at metavr.com
Fri May 6 15:25:01 CEST 2005
Stephen Swaney 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. 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() ?
Hi, the resion not to get the nmesh data is that this can be very
CPU/Memory Intensive. Keep in mind that some people use Meshes that just
about fill there entire system Ram, so making a copy of ALL NMesh data
at once could even crash blender- and is not very efficient.
- Cam
More information about the Bf-python
mailing list