[Bf-python] Proposal for getting identifier names for datablocks that require links to objects
Ken Hughes
khughes at pacific.edu
Fri Sep 12 23:42:38 CEST 2008
Ok, implementing a names attributes for the libdata sequences is pretty
easy and would do what I'm looking for, plus can be done for any libdata
type.
But what about the idea of not being able to iterate over
bpy.data.particles, i.e., it does not return a wrapped particle system
since we don't have an object to go with it? It's either that or check
within the API to see if the BPy_Particle object does or does point to
its associated object?
Ken
Campbell Barton wrote:
> my preference would be to do
>
> list = bpy.data.particles.names()
>
> where particles are a wrapped linked list like bpy.data.meshes,
> .scenes etc and have the names() function generic for all datablock
> iterators.
>
> getting a list of object, mesh names is something some scripts need to
> do anyway.
>
> the .new() functon for particles could just not be implemented, or
> could later be implemented and take an object as its argument.
>
> On Thu, Sep 11, 2008 at 7:27 PM, Theo de Ridder
> <theo.de.ridder at planet.nl> wrote:
>
>> On 11 sep 2008, at 00:57, Ken Hughes wrote:
>>
>>
>>> The proposal:
>>>
>>> We implement a
>>> datatype/attribute/function/constructor/whatever-you-want-to-call-it
>>> for
>>> particles which contains all the names of existing particle
>>> datablocks.
>>> This can then be used as an argument to link an existing datablock
>>> to a
>>> object:
>>>
>>> names = bpy.data.particles # returns a list of strings, not BPy
>>> particles
>>> if len(names) > 0: ob.newParticleSystem(names[0])
>>>
>>> You could also add a system by name, assuming it exists (otherwise an
>>> exception is thrown):
>>> ob.newParticleSystem("PSys")
>>>
>> it would be cleaner and more general to replace this proposal by:
>> names = bpy.names.particles
>>
>> with the obvious semantics of 'names' that you get names and not data
>>
>>
>> Theo
>>
>> _______________________________________________
>> Bf-python mailing list
>> Bf-python at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-python
>>
>>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
>
More information about the Bf-python
mailing list