diff options
author | Arystanbek Dyussenov <arystan.d@gmail.com> | 2010-09-04 22:49:07 +0400 |
---|---|---|
committer | Arystanbek Dyussenov <arystan.d@gmail.com> | 2010-09-04 22:49:07 +0400 |
commit | 90b464d3728d9ed8ec26fdf59058d236b99dbcd9 (patch) | |
tree | e88cab4fb1358e962b19f658064ca8c9f8d29f5b /source/blender/python/doc/examples/bpy.data.py | |
parent | 08d02dd04d836976b25793bb1d4c6a86b3f924c7 (diff) | |
parent | b0b787ef38f9947b3176642556f5282eb3518f69 (diff) |
COLLADA branch: merge from trunk -r 28015:31610.soc-2009-chingachgook
Diffstat (limited to 'source/blender/python/doc/examples/bpy.data.py')
-rw-r--r-- | source/blender/python/doc/examples/bpy.data.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/python/doc/examples/bpy.data.py b/source/blender/python/doc/examples/bpy.data.py new file mode 100644 index 00000000000..fc1145a523f --- /dev/null +++ b/source/blender/python/doc/examples/bpy.data.py @@ -0,0 +1,29 @@ +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() + + |