My goal is to get the names and types of every object in a extern file. I made two attempts:
scn = bpy.data.scenes.active lib = bpy.libraries.load(filename) kandidaten = [ob for ob in lib.objects] for i in range(0,len(kandidaten)): pseudoOb = lib.objects.append(kandidaten[i]) ob = scn.objects.link(pseudoOb) if ob.type != 'Lamp' and ob.type != 'Camera': potentielle.append(ob.name) scn.objects.unlink(ob)
With this, I get the type and name correctly, but unlinking the objects is not enough. For example if there is a “Cube” in the file and I run this script, the object “Cube” still exists. If I add another Cube, its name is “Cube.001”. Additionaly I don’t want to load the whole object only for knowing the name and the type.
lib = bpy.libraries.load(filename) potentielle = [ob for ob in lib.objects]
Well, this script is nice, if I only want to know the names. But after the script, I have no way to get the type, beacuse only the names were saved.
Please tell me a better way