api reference docs: include bpy.data in the main page since its used everywhere.
since this isnt a module its self its a little odd to do this but toctree cant make arbitrary cross-references. Also added some usage examples: http://www.blender.org/documentation/250PythonDoc/bpy.data.html
This commit is contained in:
28
source/blender/python/doc/examples/bpy.data.py
Normal file
28
source/blender/python/doc/examples/bpy.data.py
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
file = open(bpy.data.filepath.replace(".blend", ".txt"), 'w')
|
||||
|
||||
for image in bpy.data.images:
|
||||
file.write("%s %dx%d\n" % (image.filepath, image.size[0], image.size[1]))
|
||||
|
||||
file.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user