Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Bonavita <mindrones@gmail.com>2010-10-13 14:42:33 +0400
committerLuca Bonavita <mindrones@gmail.com>2010-10-13 14:42:33 +0400
commit996efebbe36a06ba45b9a79328a0dadc87ea2ff9 (patch)
treedd5a64d001a8e482d538effd94f60a593e6ef56e /doc/python_api/examples/bpy.data.py
parentd058a9c8c3d5481fa0c82c8118d207fda6b56830 (diff)
== python api doc ==
First commit to make some structure in doc/ directory. - moved source/blender/python/doc -> doc/python_api - moved source/gameengine/PyDoc/*.rst -> doc/python_api/rst - modified accordingly sphinx_doc_gen.py and sphinx_doc_gen.sh (later on I'll try alternative/ scripts by neXyon as promised :) - source/gameengine/PyDoc/ is still there because contains epydoc stuff for the bge, will ask more and look into it later
Diffstat (limited to 'doc/python_api/examples/bpy.data.py')
-rw-r--r--doc/python_api/examples/bpy.data.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/python_api/examples/bpy.data.py b/doc/python_api/examples/bpy.data.py
new file mode 100644
index 00000000000..fc1145a523f
--- /dev/null
+++ b/doc/python_api/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()
+
+