blender/doc/python_api/examples/bpy.data.py
Campbell Barton fee5363912 bugfix [#26094] Going to Bone Roll menu brings up python error
also correct for pep8 warnings.
2011-02-16 02:25:03 +00:00

28 lines
546 B
Python

import bpy
# print all objects
for obj in bpy.data.objects:
print(obj.name)
# print all scene names in a list
print(bpy.data.scenes.keys())
# remove mesh Cube
if "Cube" in bpy.data.meshes:
mesh = bpy.data.meshes["Cube"]
print("removing mesh", mesh)
bpy.data.meshes.unlink(mesh)
# write images into a file next to the blend
import os
file = open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w')
for image in bpy.data.images:
file.write("%s %dx%d\n" % (image.filepath, image.size[0], image.size[1]))
file.close()