[Bf-python] duplicate name entries in D.objects

Bastien Montagne montagne29 at wanadoo.fr
Fri Jun 24 09:59:31 CEST 2016


Hi James,

Name uniqueness of IDs (by types) is only ensured inside a given .blend 
file. It means that if you link datablocks from libraries, you can 
easily end up with several ones of the same type and the same name.

To access those, you must use the tuple (ID_name, lib_path) (lib_path 
being None for current .blend data) - same to uniquely identify them in 
a dict e.g.:

bpy.data.objects["Cube", "/my/path/to/library.blend"]

Cheers,
Bastien

Le 24/06/2016 à 02:47, James Crowther a écrit :
> Hi, just trying to understand why there are sometimes more than one 
> entry in D.objects with the same name? This behaviour was a little 
> unexpected for me since I had assumed that these collection types 
> behaved similarly to python dictionaries since they resemble them 
> closely in that they have a name, value pattern.
> However, in a python dictionary it is not valid to have two entries 
> with the same name. This is certainly not the case for D.objects which 
> clearly can support more than one entry with the same name.
>
> I have experimented with renaming objects from the properties panel. 
> Lets say there is an object named 'Cube', if I add another object and 
> rename it to 'Cube', the object that had originally held the name 
> 'Cube' is renamed to 'Cube.001'
>
> So I was surprised to find that in D.objects, there are duplicates and 
> would like to understand why this happens, how to reproduce this 
> behaviour and whether this is useful behaviour or a byproduct of some 
> other feature?
>
> Kind Regards
>
> James
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> https://lists.blender.org/mailman/listinfo/bf-python

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20160624/e52e264b/attachment.html>


More information about the Bf-python mailing list