~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to doc/python_api/examples/bpy.data.py

  • Committer: Bazaar Package Importer
  • Author(s): Kevin Roy
  • Date: 2011-02-08 22:20:54 UTC
  • mfrom: (1.4.2 upstream)
  • mto: (14.2.6 sid) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 27.
  • Revision ID: james.westby@ubuntu.com-20110208222054-kk0gwa4bu8h5lyq4
Tags: upstream-2.56.1-beta-svn34076
ImportĀ upstreamĀ versionĀ 2.56.1-beta-svn34076

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import bpy
 
2
 
 
3
 
 
4
# print all objects
 
5
for obj in bpy.data.objects:
 
6
    print(obj.name)
 
7
 
 
8
 
 
9
# print all scene names in a list
 
10
print(bpy.data.scenes.keys())
 
11
 
 
12
 
 
13
# remove mesh Cube
 
14
if "Cube" in bpy.data.meshes:
 
15
    mesh = bpy.data.meshes["Cube"]
 
16
    print("removing mesh", mesh)
 
17
    bpy.data.meshes.unlink(mesh)
 
18
 
 
19
 
 
20
# write images into a file next to the blend
 
21
import os
 
22
file = open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w')
 
23
 
 
24
for image in bpy.data.images:
 
25
    file.write("%s %dx%d\n" % (image.filepath, image.size[0], image.size[1]))
 
26
 
 
27
file.close()
 
28
 
 
29