[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29742] trunk/blender/source/blender/ python/doc: api reference docs: include bpy. data in the main page since its used everywhere.
Campbell Barton
ideasman42 at gmail.com
Sun Jun 27 20:34:27 CEST 2010
Revision: 29742
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29742
Author: campbellbarton
Date: 2010-06-27 20:34:27 +0200 (Sun, 27 Jun 2010)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/blender/source/blender/python/doc/sphinx_doc_gen.py
trunk/blender/source/blender/python/doc/sphinx_doc_gen.sh
Added Paths:
-----------
trunk/blender/source/blender/python/doc/examples/bpy.data.py
Added: trunk/blender/source/blender/python/doc/examples/bpy.data.py
===================================================================
--- trunk/blender/source/blender/python/doc/examples/bpy.data.py (rev 0)
+++ trunk/blender/source/blender/python/doc/examples/bpy.data.py 2010-06-27 18:34:27 UTC (rev 29742)
@@ -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()
+
+
Modified: trunk/blender/source/blender/python/doc/sphinx_doc_gen.py
===================================================================
--- trunk/blender/source/blender/python/doc/sphinx_doc_gen.py 2010-06-27 18:05:29 UTC (rev 29741)
+++ trunk/blender/source/blender/python/doc/sphinx_doc_gen.py 2010-06-27 18:34:27 UTC (rev 29742)
@@ -296,7 +296,7 @@
if bpy.app.build_revision != "Unknown":
version_string = version_string + " r" + bpy.app.build_revision
- fw("project = 'Blender 3D'\n")
+ fw("project = 'Blender'\n")
# fw("master_doc = 'index'\n")
fw("copyright = u'Blender Foundation'\n")
fw("version = '%s - UNSTABLE API'\n" % version_string)
@@ -323,7 +323,7 @@
fw("\n")
fw("This document is an API reference for Blender %s. built %s.\n" % (version_string, bpy.app.build_date))
fw("\n")
- fw("An introduction to blender and python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n")
+ fw("An introduction to Blender and Python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n")
fw("\n")
fw("`A PDF version of this document is also available <blender_python_reference_250.pdf>`__\n")
fw("\n")
@@ -350,6 +350,7 @@
fw("\n")
fw(".. toctree::\n")
fw(" :maxdepth: 1\n\n")
+ fw(" bpy.data.rst\n\n") # note: not actually a module
fw(" bpy.ops.rst\n\n")
fw(" bpy.types.rst\n\n")
@@ -390,8 +391,8 @@
filepath = os.path.join(BASEPATH, "bpy.ops.rst")
file = open(filepath, "w")
fw = file.write
- fw("Blender Operators (bpy.ops)\n")
- fw("===========================\n\n")
+ fw("Operators (bpy.ops)\n")
+ fw("===================\n\n")
fw(".. toctree::\n")
fw(" :glob:\n\n")
fw(" bpy.ops.*\n\n")
@@ -400,14 +401,37 @@
filepath = os.path.join(BASEPATH, "bpy.types.rst")
file = open(filepath, "w")
fw = file.write
- fw("Blender Types (bpy.types)\n")
- fw("=========================\n\n")
+ fw("Types (bpy.types)\n")
+ fw("=================\n\n")
fw(".. toctree::\n")
fw(" :glob:\n\n")
fw(" bpy.types.*\n\n")
file.close()
+ # not actually a module, only write this file so we
+ # can reference in the TOC
+ filepath = os.path.join(BASEPATH, "bpy.data.rst")
+ file = open(filepath, "w")
+ fw = file.write
+ fw("Data Access (bpy.data)\n")
+ fw("======================\n\n")
+ fw(".. module:: bpy\n")
+ fw("\n")
+ fw("This module is used for all blender/python access.\n")
+ fw("\n")
+ fw(" .. literalinclude:: ../examples/bpy.data.py\n")
+ fw("\n")
+ fw(" .. data:: data\n")
+ fw("\n")
+ fw(" Access to blenders internal data\n")
+ fw("\n")
+ fw(" :type: :class:`bpy.types.Main`\n")
+ file.close()
+
+ EXAMPLE_SET_USED.add("bpy.data")
+
+
# python modules
from bpy import utils as module
pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
@@ -424,7 +448,7 @@
del module
import blf as module
- pymodule2sphinx(BASEPATH, "blf", module, "Blender Font Drawing (blf)")
+ pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
del module
# game engine
Modified: trunk/blender/source/blender/python/doc/sphinx_doc_gen.sh
===================================================================
--- trunk/blender/source/blender/python/doc/sphinx_doc_gen.sh 2010-06-27 18:05:29 UTC (rev 29741)
+++ trunk/blender/source/blender/python/doc/sphinx_doc_gen.sh 2010-06-27 18:34:27 UTC (rev 29742)
@@ -8,7 +8,7 @@
SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation/250PythonDoc"
# dont delete existing docs, now partial updates are used for quick builds.
-$BLENDER -b -P ./source/blender/python/doc/sphinx_doc_gen.py
+$BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py
# html
sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
More information about the Bf-blender-cvs
mailing list