[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60216] trunk/blender: fixes for python api docs.
Campbell Barton
ideasman42 at gmail.com
Wed Sep 18 07:20:44 CEST 2013
Revision: 60216
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60216
Author: campbellbarton
Date: 2013-09-18 05:20:43 +0000 (Wed, 18 Sep 2013)
Log Message:
-----------
fixes for python api docs.
also move foreach_get/set examples into their own py example files (prefer not to have example code built into blenders binary).
Modified Paths:
--------------
trunk/blender/doc/python_api/examples/bpy.props.5.py
trunk/blender/doc/python_api/examples/bpy.types.UIList.1.py
trunk/blender/doc/python_api/rst/bge.logic.rst
trunk/blender/doc/python_api/sphinx_doc_gen.py
trunk/blender/release/scripts/modules/bpy/path.py
trunk/blender/release/scripts/modules/bpy_extras/mesh_utils.py
trunk/blender/release/scripts/modules/bpy_types.py
trunk/blender/release/scripts/startup/bl_ui/__init__.py
trunk/blender/source/blender/python/intern/bpy_rna.c
Added Paths:
-----------
trunk/blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_get.py
trunk/blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py
Modified: trunk/blender/doc/python_api/examples/bpy.props.5.py
===================================================================
--- trunk/blender/doc/python_api/examples/bpy.props.5.py 2013-09-18 04:32:29 UTC (rev 60215)
+++ trunk/blender/doc/python_api/examples/bpy.props.5.py 2013-09-18 05:20:43 UTC (rev 60216)
@@ -1,6 +1,6 @@
"""
Get/Set Example
-++++++++++++++
++++++++++++++++
Get/Set functions can be used for boolean, int, float, string and enum properties.
If these callbacks are defined the property will not be stored in the ID properties
Modified: trunk/blender/doc/python_api/examples/bpy.types.UIList.1.py
===================================================================
--- trunk/blender/doc/python_api/examples/bpy.types.UIList.1.py 2013-09-18 04:32:29 UTC (rev 60215)
+++ trunk/blender/doc/python_api/examples/bpy.types.UIList.1.py 2013-09-18 05:20:43 UTC (rev 60216)
@@ -1,6 +1,7 @@
"""
Basic UIList Example
-+++++++++++++++++++
+++++++++++++++++++++
+
This script is the UIList subclass used to show material slots, with a bunch of additional commentaries.
Notice the name of the class, this naming convention is similar as the one for panels or menus.
@@ -73,8 +74,8 @@
# with no custom draw code, use "UI_UL_list").
layout.template_list("MATERIAL_UL_matslots_example", "", obj, "material_slots", obj, "active_material_index")
- # The second one can usually be left as an empty string. It's an additional ID used to distinguish lists in case you
- # use the same list several times in a given area.
+ # The second one can usually be left as an empty string.
+ # It's an additional ID used to distinguish lists in case you use the same list several times in a given area.
layout.template_list("MATERIAL_UL_matslots_example", "compact", obj, "material_slots",
obj, "active_material_index", type='COMPACT')
Added: trunk/blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_get.py
===================================================================
--- trunk/blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_get.py (rev 0)
+++ trunk/blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_get.py 2013-09-18 05:20:43 UTC (rev 60216)
@@ -0,0 +1,11 @@
+"""
+Only works for 'basic type' properties (bool, int and float)!
+Multi-dimensional arrays (like array of vectors) will be flattened into seq.
+"""
+
+collection.foreach_get(attr, some_seq)
+
+# Python equivalent
+for i in range(len(seq)):
+ some_seq[i] = getattr(collection[i], attr)
+
Property changes on: trunk/blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_get.py
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py
===================================================================
--- trunk/blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py (rev 0)
+++ trunk/blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py 2013-09-18 05:20:43 UTC (rev 60216)
@@ -0,0 +1,11 @@
+"""
+Only works for 'basic type' properties (bool, int and float)!
+seq must be uni-dimensional, multi-dimensional arrays (like array of vectors) will be re-created from it.
+"""
+
+collection.foreach_set(attr, some_seq)
+
+# Python equivalent
+for i in range(len(some_seq)):
+ setattr(collection[i], attr, some_seq[i])
+
Property changes on: trunk/blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/blender/doc/python_api/rst/bge.logic.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bge.logic.rst 2013-09-18 04:32:29 UTC (rev 60215)
+++ trunk/blender/doc/python_api/rst/bge.logic.rst 2013-09-18 05:20:43 UTC (rev 60216)
@@ -127,7 +127,9 @@
.. data:: joysticks
- A list of attached :class:`~bge.types.SCA_PythonJoystick`s. The list size is the maximum number of supported joysticks. If no joystick is available for a given slot, the slot is set to None.
+ A list of attached :class:`~bge.types.SCA_PythonJoystick`.
+ The list size is the maximum number of supported joysticks.
+ If no joystick is available for a given slot, the slot is set to None.
*****************
General functions
Modified: trunk/blender/doc/python_api/sphinx_doc_gen.py
===================================================================
--- trunk/blender/doc/python_api/sphinx_doc_gen.py 2013-09-18 04:32:29 UTC (rev 60215)
+++ trunk/blender/doc/python_api/sphinx_doc_gen.py 2013-09-18 05:20:43 UTC (rev 60216)
@@ -482,6 +482,9 @@
def undocumented_message(module_name, type_name, identifier):
+ return "Undocumented"
+
+ """
if str(type_name).startswith('<module'):
preloadtitle = '%s.%s' % (module_name, identifier)
else:
@@ -494,6 +497,7 @@
"&preload=Dev:2.5/Py/API/Generating_API_Reference/Contribute/Howto-message"
"&preloadtitle=%s>`_)\n\n" % preloadtitle)
return message
+ """
def range_str(val):
Modified: trunk/blender/release/scripts/modules/bpy/path.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/path.py 2013-09-18 04:32:29 UTC (rev 60215)
+++ trunk/blender/release/scripts/modules/bpy/path.py 2013-09-18 05:20:43 UTC (rev 60216)
@@ -121,7 +121,7 @@
def clean_name(name, replace="_"):
"""
Returns a name with characters replaced that
- may cause problems under various circumstances,
+ may cause problems under various circumstances,
such as writing to a file.
All characters besides A-Z/a-z, 0-9 are replaced with "_"
or the replace argument if defined.
Modified: trunk/blender/release/scripts/modules/bpy_extras/mesh_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_extras/mesh_utils.py 2013-09-18 04:32:29 UTC (rev 60215)
+++ trunk/blender/release/scripts/modules/bpy_extras/mesh_utils.py 2013-09-18 05:20:43 UTC (rev 60216)
@@ -327,7 +327,8 @@
indicie lists. Designed to be used for importers that need indices for an
fgon to create from existing verts.
- from_data: either a mesh, or a list/tuple of vectors.
+ :arg from_data: either a mesh, or a list/tuple of vectors.
+ :type from_data: list or :class:`bpy.types.Mesh`
:arg indices: a list of indices to use this list
is the ordered closed polyline
to fill, and can be a subset of the data given.
Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py 2013-09-18 04:32:29 UTC (rev 60215)
+++ trunk/blender/release/scripts/modules/bpy_types.py 2013-09-18 05:20:43 UTC (rev 60216)
@@ -219,9 +219,10 @@
@property
def length(self):
- """ The distance from head to tail,
- when set the head is moved to fit the length.
"""
+ The distance from head to tail,
+ when set the head is moved to fit the length.
+ """
return self.vector.length
@length.setter
@@ -230,9 +231,10 @@
@property
def vector(self):
- """ The direction this bone is pointing.
- Utility function for (tail - head)
"""
+ The direction this bone is pointing.
+ Utility function for (tail - head)
+ """
return (self.tail - self.head)
@property
Modified: trunk/blender/release/scripts/startup/bl_ui/__init__.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/__init__.py 2013-09-18 04:32:29 UTC (rev 60215)
+++ trunk/blender/release/scripts/startup/bl_ui/__init__.py 2013-09-18 05:20:43 UTC (rev 60216)
@@ -152,7 +152,7 @@
propname is the name of the string property to use for filtering.
flags must be a list of integers the same length as items, or None!
return a list of flags (based on given flags if not None),
- or an empty list if no flags were given and no filtering has been done.
+ or an empty list if no flags were given and no filtering has been done.
"""
import fnmatch
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2013-09-18 04:32:29 UTC (rev 60215)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2013-09-18 05:20:43 UTC (rev 60216)
@@ -4600,17 +4600,6 @@
".. method:: foreach_get(attr, seq)\n"
"\n"
" This is a function to give fast access to attributes within a collection.\n"
-"\n"
-" Only works for 'basic type' properties (bool, int and float)!\n"
-" Multi-dimensional arrays (like array of vectors) will be flattened into seq.\n"
-"\n"
-" .. code-block:: python\n"
-"\n"
-" collection.foreach_get(attr, someseq)\n"
-"\n"
-" # Python equivalent\n"
-" for i in range(len(seq)): someseq[i] = getattr(collection[i], attr)\n"
-"\n"
);
static PyObject *pyrna_prop_collection_foreach_get(BPy_PropertyRNA *self, PyObject *args)
{
@@ -4623,17 +4612,6 @@
".. method:: foreach_set(attr, seq)\n"
"\n"
" This is a function to give fast access to attributes within a collection.\n"
-"\n"
-" Only works for 'basic type' properties (bool, int and float)!\n"
-" seq must be uni-dimensional, multi-dimensional arrays (like array of vectors) will be re-created from it.\n"
-"\n"
-" .. code-block:: python\n"
-"\n"
-" collection.foreach_set(attr, seq)\n"
-"\n"
-" # Python equivalent\n"
-" for i in range(len(seq)): setattr(collection[i], attr, seq[i])\n"
-"\n"
);
static PyObject *pyrna_prop_collection_foreach_set(BPy_PropertyRNA *self, PyObject *args)
{
More information about the Bf-blender-cvs
mailing list