[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40048] trunk/blender/doc/python_api: bpy api - add new page for best-practice ( so Thomas has something to point to when kicking devs for writing shoddy UI layouts )

Campbell Barton ideasman42 at gmail.com
Fri Sep 9 01:59:49 CEST 2011


Revision: 40048
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40048
Author:   campbellbarton
Date:     2011-09-08 23:59:47 +0000 (Thu, 08 Sep 2011)
Log Message:
-----------
bpy api - add new page for best-practice (so Thomas has something to point to when kicking devs for writing shoddy UI layouts)

Modified Paths:
--------------
    trunk/blender/doc/python_api/rst/info_quickstart.rst
    trunk/blender/doc/python_api/sphinx_doc_gen.py

Added Paths:
-----------
    trunk/blender/doc/python_api/rst/info_best_practice.rst

Added: trunk/blender/doc/python_api/rst/info_best_practice.rst
===================================================================
--- trunk/blender/doc/python_api/rst/info_best_practice.rst	                        (rev 0)
+++ trunk/blender/doc/python_api/rst/info_best_practice.rst	2011-09-08 23:59:47 UTC (rev 40048)
@@ -0,0 +1,65 @@
+*************
+Best Practice
+*************
+
+
+TODO: Intro text
+
+
+Style Conventions
+=================
+
+For Blender 2.5 we have chosen to follow python suggested style guide to avoid mixing styles amongst our own scripts and make it easier to use python scripts from other projects.
+
+Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender.
+
+This style guide is known as pep8 and can be found `here <http://www.python.org/dev/peps/pep-0008>`_
+
+A brief listing of pep8 criteria.
+
+* camel caps for class names: MyClass
+
+* all lower case underscore separated module names: my_module
+
+* indentation of 4 spaces (no tabs)
+
+* spaces around operators. ``1 + 1``, not ``1+1``
+
+* only use explicit imports, (no importing '*')
+
+* don't use single line: ``if val: body``, separate onto 2 lines instead.
+
+
+As well as pep8 we have other conventions used for blender python scripts.
+
+* Use single quotes for enums, and double quotes for strings.
+
+  Both are of course strings but in our internal API enums are unique items from a limited set. eg.
+
+  .. code-block:: python
+
+     bpy.context.scene.render.file_format = 'PNG'
+     bpy.context.scene.render.filepath = "//render_out"
+
+* pep8 also defines that lines should not exceed 79 characters, we felt this is too restrictive so this is optional per script.
+
+Periodically we run checks for pep8 compliance on blender scripts, for scripts to be included in this check add this line as a comment at the top of the script.
+
+``# <pep8 compliant>``
+
+To enable line length checks use this instead.
+
+``# <pep8-80 compliant>``
+
+
+User Interface Layout
+=====================
+
+TODO: Thomas
+
+
+Script Efficiency
+=================
+
+TODO: Campbell
+

Modified: trunk/blender/doc/python_api/rst/info_quickstart.rst
===================================================================
--- trunk/blender/doc/python_api/rst/info_quickstart.rst	2011-09-08 22:13:11 UTC (rev 40047)
+++ trunk/blender/doc/python_api/rst/info_quickstart.rst	2011-09-08 23:59:47 UTC (rev 40048)
@@ -420,49 +420,3 @@
    fcu_z.keyframe_points[0].co = 10.0, 0.0
    fcu_z.keyframe_points[1].co = 20.0, 1.0
 
-
-Style Conventions
-=================
-
-For Blender 2.5 we have chosen to follow python suggested style guide to avoid mixing styles amongst our own scripts and make it easier to use python scripts from other projects.
-
-Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender.
-
-This style guide is known as pep8 and can be found `here <http://www.python.org/dev/peps/pep-0008>`_
-
-A brief listing of pep8 criteria.
-
-* camel caps for class names: MyClass
-
-* all lower case underscore separated module names: my_module
-
-* indentation of 4 spaces (no tabs)
-
-* spaces around operators. ``1 + 1``, not ``1+1``
-
-* only use explicit imports, (no importing '*')
-
-* don't use single line: ``if val: body``, separate onto 2 lines instead.
-
-
-As well as pep8 we have other conventions used for blender python scripts.
-
-* Use single quotes for enums, and double quotes for strings.
-
-  Both are of course strings but in our internal API enums are unique items from a limited set. eg.
-
-  .. code-block:: python
-
-     bpy.context.scene.render.file_format = 'PNG'
-     bpy.context.scene.render.filepath = "//render_out"
-
-* pep8 also defines that lines should not exceed 79 characters, we felt this is too restrictive so this is optional per script.
-
-Periodically we run checks for pep8 compliance on blender scripts, for scripts to be included in this check add this line as a comment at the top of the script.
-
-``# <pep8 compliant>``
-
-To enable line length checks use this instead.
-
-``# <pep8-80 compliant>``
-

Modified: trunk/blender/doc/python_api/sphinx_doc_gen.py
===================================================================
--- trunk/blender/doc/python_api/sphinx_doc_gen.py	2011-09-08 22:13:11 UTC (rev 40047)
+++ trunk/blender/doc/python_api/sphinx_doc_gen.py	2011-09-08 23:59:47 UTC (rev 40048)
@@ -103,6 +103,7 @@
 INFO_DOCS = (
     ("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get you're feet wet?"),
     ("info_overview.rst", "Blender/Python API Overview: a more complete explanation of python integration"),
+    ("info_best_practice.rst", "Best Practice: Conventions to follow for writing good scripts"),
     ("info_tips_and_tricks.rst", "Tips and Tricks: Hints to help you while writeing scripts for blender"),
     ("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"),
     )




More information about the Bf-blender-cvs mailing list