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()
|
||||||
|
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ def rna2sphinx(BASEPATH):
|
|||||||
if bpy.app.build_revision != "Unknown":
|
if bpy.app.build_revision != "Unknown":
|
||||||
version_string = version_string + " r" + bpy.app.build_revision
|
version_string = version_string + " r" + bpy.app.build_revision
|
||||||
|
|
||||||
fw("project = 'Blender 3D'\n")
|
fw("project = 'Blender'\n")
|
||||||
# fw("master_doc = 'index'\n")
|
# fw("master_doc = 'index'\n")
|
||||||
fw("copyright = u'Blender Foundation'\n")
|
fw("copyright = u'Blender Foundation'\n")
|
||||||
fw("version = '%s - UNSTABLE API'\n" % version_string)
|
fw("version = '%s - UNSTABLE API'\n" % version_string)
|
||||||
@@ -323,7 +323,7 @@ def rna2sphinx(BASEPATH):
|
|||||||
fw("\n")
|
fw("\n")
|
||||||
fw("This document is an API reference for Blender %s. built %s.\n" % (version_string, bpy.app.build_date))
|
fw("This document is an API reference for Blender %s. built %s.\n" % (version_string, bpy.app.build_date))
|
||||||
fw("\n")
|
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("\n")
|
||||||
fw("`A PDF version of this document is also available <blender_python_reference_250.pdf>`__\n")
|
fw("`A PDF version of this document is also available <blender_python_reference_250.pdf>`__\n")
|
||||||
fw("\n")
|
fw("\n")
|
||||||
@@ -350,6 +350,7 @@ def rna2sphinx(BASEPATH):
|
|||||||
fw("\n")
|
fw("\n")
|
||||||
fw(".. toctree::\n")
|
fw(".. toctree::\n")
|
||||||
fw(" :maxdepth: 1\n\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.ops.rst\n\n")
|
||||||
fw(" bpy.types.rst\n\n")
|
fw(" bpy.types.rst\n\n")
|
||||||
|
|
||||||
@@ -390,8 +391,8 @@ def rna2sphinx(BASEPATH):
|
|||||||
filepath = os.path.join(BASEPATH, "bpy.ops.rst")
|
filepath = os.path.join(BASEPATH, "bpy.ops.rst")
|
||||||
file = open(filepath, "w")
|
file = open(filepath, "w")
|
||||||
fw = file.write
|
fw = file.write
|
||||||
fw("Blender Operators (bpy.ops)\n")
|
fw("Operators (bpy.ops)\n")
|
||||||
fw("===========================\n\n")
|
fw("===================\n\n")
|
||||||
fw(".. toctree::\n")
|
fw(".. toctree::\n")
|
||||||
fw(" :glob:\n\n")
|
fw(" :glob:\n\n")
|
||||||
fw(" bpy.ops.*\n\n")
|
fw(" bpy.ops.*\n\n")
|
||||||
@@ -400,14 +401,37 @@ def rna2sphinx(BASEPATH):
|
|||||||
filepath = os.path.join(BASEPATH, "bpy.types.rst")
|
filepath = os.path.join(BASEPATH, "bpy.types.rst")
|
||||||
file = open(filepath, "w")
|
file = open(filepath, "w")
|
||||||
fw = file.write
|
fw = file.write
|
||||||
fw("Blender Types (bpy.types)\n")
|
fw("Types (bpy.types)\n")
|
||||||
fw("=========================\n\n")
|
fw("=================\n\n")
|
||||||
fw(".. toctree::\n")
|
fw(".. toctree::\n")
|
||||||
fw(" :glob:\n\n")
|
fw(" :glob:\n\n")
|
||||||
fw(" bpy.types.*\n\n")
|
fw(" bpy.types.*\n\n")
|
||||||
file.close()
|
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
|
# python modules
|
||||||
from bpy import utils as module
|
from bpy import utils as module
|
||||||
pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
|
pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
|
||||||
@@ -424,7 +448,7 @@ def rna2sphinx(BASEPATH):
|
|||||||
del module
|
del module
|
||||||
|
|
||||||
import blf as module
|
import blf as module
|
||||||
pymodule2sphinx(BASEPATH, "blf", module, "Blender Font Drawing (blf)")
|
pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
|
||||||
del module
|
del module
|
||||||
|
|
||||||
# game engine
|
# game engine
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ SSH_HOST="ideasman42@emo.blender.org"
|
|||||||
SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation/250PythonDoc"
|
SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation/250PythonDoc"
|
||||||
|
|
||||||
# dont delete existing docs, now partial updates are used for quick builds.
|
# 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
|
# html
|
||||||
sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
|
sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
|
||||||
|
|||||||
Reference in New Issue
Block a user