[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33582] trunk/blender: patch [#25027] formatting mathutils.geometry module docs for sphinx

Campbell Barton ideasman42 at gmail.com
Fri Dec 10 01:20:32 CET 2010


Revision: 33582
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33582
Author:   campbellbarton
Date:     2010-12-10 01:20:32 +0100 (Fri, 10 Dec 2010)

Log Message:
-----------
patch [#25027] formatting mathutils.geometry module docs for sphinx
from Luka Bonavita

See:
http://www.blender.org/documentation/250PythonDoc/mathutils.geometry.html

Modified Paths:
--------------
    trunk/blender/doc/python_api/sphinx_doc_gen.py
    trunk/blender/release/scripts/op/console_python.py
    trunk/blender/source/blender/makesrna/intern/rna_screen.c
    trunk/blender/source/blender/python/generic/blf_py_api.c
    trunk/blender/source/blender/python/generic/mathutils_geometry.c

Modified: trunk/blender/doc/python_api/sphinx_doc_gen.py
===================================================================
--- trunk/blender/doc/python_api/sphinx_doc_gen.py	2010-12-10 00:10:43 UTC (rev 33581)
+++ trunk/blender/doc/python_api/sphinx_doc_gen.py	2010-12-10 00:20:32 UTC (rev 33582)
@@ -64,11 +64,16 @@
 _BPY_STRUCT_FAKE = "bpy_struct"
 _BPY_FULL_REBUILD = False
 
+
 def undocumented_message(module_name, type_name, identifier):
-    message = "Undocumented (`contribute " \
-        "<http://wiki.blender.org/index.php/Dev:2.5/Py/API/Documentation/Contribute" \
-        "?action=edit&section=new&preload=Dev:2.5/Py/API/Documentation/Contribute/Howto-message" \
-        "&preloadtitle=%s.%s.%s>`_)\n\n" % (module_name, type_name, identifier)
+    if str(type_name).startswith('<module'):
+        preloadtitle = '%s.%s' % (module_name, identifier)
+    else:
+        preloadtitle = '%s.%s.%s' % (module_name, type_name, identifier)
+    message = "Undocumented (`contribute "\
+        "<http://wiki.blender.org/index.php/Dev:2.5/Py/API/Documentation/Contribute"\
+        "?action=edit&section=new&preload=Dev:2.5/Py/API/Documentation/Contribute/Howto-message"\
+        "&preloadtitle=%s>`_)\n\n" % preloadtitle
     return message
 
 
@@ -405,6 +410,9 @@
 
 
     fw("   mathutils.rst\n\n")
+    fw("   mathutils.geometry.rst\n\n")
+    # XXX TODO
+    #fw("   bgl.rst\n\n")
     fw("   blf.rst\n\n")
     fw("   aud.rst\n\n")
     
@@ -485,11 +493,20 @@
     import mathutils as module
     pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)")
     del module
+    
+    import mathutils.geometry as module
+    pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities (mathutils.geometry)")
+    del module
 
     import blf as module
     pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
     del module
     
+    # XXX TODO
+    #import bgl as module
+    #pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper (bgl)")
+    #del module
+
     import aud as module
     pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)")
     del module

Modified: trunk/blender/release/scripts/op/console_python.py
===================================================================
--- trunk/blender/release/scripts/op/console_python.py	2010-12-10 00:10:43 UTC (rev 33581)
+++ trunk/blender/release/scripts/op/console_python.py	2010-12-10 00:20:32 UTC (rev 33582)
@@ -264,7 +264,8 @@
     sc = context.space_data
     version_string = sys.version.strip().replace('\n', ' ')
 
-    add_scrollback(" * Python Interactive Console %s *" % version_string, 'OUTPUT')
+    add_scrollback("PYTHON INTERACTIVE CONSOLE %s" % version_string, 'OUTPUT')
+    add_scrollback("", 'OUTPUT')
     add_scrollback("Command History:     Up/Down Arrow", 'OUTPUT')
     add_scrollback("Cursor:              Left/Right Home/End", 'OUTPUT')
     add_scrollback("Remove:              Backspace/Delete", 'OUTPUT')

Modified: trunk/blender/source/blender/makesrna/intern/rna_screen.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_screen.c	2010-12-10 00:10:43 UTC (rev 33581)
+++ trunk/blender/source/blender/makesrna/intern/rna_screen.c	2010-12-10 00:20:32 UTC (rev 33582)
@@ -116,7 +116,7 @@
 	prop= RNA_def_property(srna, "spaces", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "spacedata", NULL);
 	RNA_def_property_struct_type(prop, "Space");
-	RNA_def_property_ui_text(prop, "Spaces", "Spaces contained in this area, the first space is active");
+	RNA_def_property_ui_text(prop, "Spaces", "Spaces contained in this area, the first being the active space. NOTE: Useful for example to restore a previously used 3d view space in a certain area to get the old view orientation.");
 
 	prop= RNA_def_property(srna, "active_space", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "spacedata.first");

Modified: trunk/blender/source/blender/python/generic/blf_py_api.c
===================================================================
--- trunk/blender/source/blender/python/generic/blf_py_api.c	2010-12-10 00:10:43 UTC (rev 33581)
+++ trunk/blender/source/blender/python/generic/blf_py_api.c	2010-12-10 00:20:32 UTC (rev 33582)
@@ -367,7 +367,7 @@
 	{"dimensions", (PyCFunction) py_blf_dimensions, METH_VARARGS, py_blf_dimensions_doc},
 	{"draw", (PyCFunction) py_blf_draw, METH_VARARGS, py_blf_draw_doc},
 	{"enable", (PyCFunction) py_blf_enable, METH_VARARGS, py_blf_enable_doc},
-	{"position", (PyCFunction)py_blf_position, METH_VARARGS, py_blf_position_doc},
+	{"position", (PyCFunction) py_blf_position, METH_VARARGS, py_blf_position_doc},
 	{"rotation", (PyCFunction) py_blf_rotation, METH_VARARGS, py_blf_rotation_doc},
 	{"shadow", (PyCFunction) py_blf_shadow, METH_VARARGS, py_blf_shadow_doc},
 	{"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc},

Modified: trunk/blender/source/blender/python/generic/mathutils_geometry.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils_geometry.c	2010-12-10 00:10:43 UTC (rev 33581)
+++ trunk/blender/source/blender/python/generic/mathutils_geometry.c	2010-12-10 00:20:32 UTC (rev 33582)
@@ -45,18 +45,152 @@
 
 /*-------------------------DOC STRINGS ---------------------------*/
 static char M_Geometry_doc[] = "The Blender geometry module\n\n";
-static char M_Geometry_Intersect_doc[] = "(v1, v2, v3, ray, orig, clip=1) - returns the intersection between a ray and a triangle, if possible, returns None otherwise";
-static char M_Geometry_TriangleArea_doc[] = "(v1, v2, v3) - returns the area size of the 2D or 3D triangle defined";
-static char M_Geometry_TriangleNormal_doc[] = "(v1, v2, v3) - returns the normal of the 3D triangle defined";
-static char M_Geometry_QuadNormal_doc[] = "(v1, v2, v3, v4) - returns the normal of the 3D quad defined";
-static char M_Geometry_LineIntersect_doc[] = "(v1, v2, v3, v4) - returns a tuple with the points on each line respectively closest to the other";
-static char M_Geometry_PolyFill_doc[] = "(veclist_list) - takes a list of polylines (each point a vector) and returns the point indicies for a polyline filled with triangles";
-static char M_Geometry_LineIntersect2D_doc[] = "(lineA_p1, lineA_p2, lineB_p1, lineB_p2) - takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None";
-static char M_Geometry_ClosestPointOnLine_doc[] = "(pt, line_p1, line_p2) - takes a point and a line and returns a (Vector, float) for the point on the line, and the bool so you can know if the point was between the 2 points";
-static char M_Geometry_PointInTriangle2D_doc[] = "(pt, tri_p1, tri_p2, tri_p3) - takes 4 vectors, one is the point and the next 3 define the triangle, only the x and y are used from the vectors";
-static char M_Geometry_PointInQuad2D_doc[] = "(pt, quad_p1, quad_p2, quad_p3, quad_p4) - takes 5 vectors, one is the point and the next 4 define the quad, only the x and y are used from the vectors";
+static char M_Geometry_Intersect_doc[] =
+".. function:: Intersect(v1, v2, v3, ray, orig, clip=True)\n"
+"\n"
+"   Returns the intersection between a ray and a triangle, if possible, returns None otherwise.\n"
+"\n"
+"   :rtype: boolean\n"
+"   :arg v1: Point1\n"
+"   :type v1: :class:`mathutils.Vector`\n"
+"   :arg v2: Point2\n"
+"   :type v2: :class:`mathutils.Vector`\n"
+"   :arg v3: Point3\n"
+"   :type v3: :class:`mathutils.Vector`\n"
+"   :arg ray: Direction of the projection\n"
+"   :type ray: :class:`mathutils.Vector`\n"
+"   :arg orig: Origin\n"
+"   :type orig: :class:`mathutils.Vector`\n"
+"   :arg clip: Clip by the ray length\n"
+"   :type clip: boolean\n";
+
+static char M_Geometry_TriangleArea_doc[] =
+".. function:: TriangleArea(v1, v2, v3)\n"
+"\n"
+"   Returns the area size of the 2D or 3D triangle defined.\n"
+"\n"
+"   :rtype: float\n"
+"   :arg v1: Point1\n"
+"   :type v1: :class:`mathutils.Vector`\n"
+"   :arg v2: Point2\n"
+"   :type v2: :class:`mathutils.Vector`\n"
+"   :arg v3: Point3\n"
+"   :type v3: :class:`mathutils.Vector`\n";
+
+static char M_Geometry_TriangleNormal_doc[] = 
+".. function:: TriangleNormal(v1, v2, v3)\n"
+"\n"
+"   Returns the normal of the 3D triangle defined.\n"
+"\n"
+"   :rtype: :class:`mathutils.Vector`\n"
+"   :arg v1: Point1\n"
+"   :type v1: :class:`mathutils.Vector`\n"
+"   :arg v2: Point2\n"
+"   :type v2: :class:`mathutils.Vector`\n"
+"   :arg v3: Point3\n"
+"   :type v3: :class:`mathutils.Vector`\n";
+
+static char M_Geometry_QuadNormal_doc[] = 
+".. function:: QuadNormal(v1, v2, v3, v4)\n"
+"\n"
+"   Returns the normal of the 3D quad defined.\n"
+"\n"
+"   :rtype: :class:`mathutils.Vector`\n"
+"   :arg v1: Point1\n"
+"   :type v1: :class:`mathutils.Vector`\n"
+"   :arg v2: Point2\n"
+"   :type v2: :class:`mathutils.Vector`\n"
+"   :arg v3: Point3\n"
+"   :type v3: :class:`mathutils.Vector`\n"
+"   :arg v4: Point4\n"
+"   :type v4: :class:`mathutils.Vector`\n";
+
+static char M_Geometry_LineIntersect_doc[] = 
+".. function:: LineIntersect(v1, v2, v3, v4)\n"
+"\n"
+"   Returns a tuple with the points on each line respectively closest to the other.\n"
+"\n"
+"   :rtype: tuple with elements being of type :class:`mathutils.Vector`\n"
+"   :arg v1: First point of the first line\n"
+"   :type v1: :class:`mathutils.Vector`\n"
+"   :arg v2: Second point of the first line\n"
+"   :type v2: :class:`mathutils.Vector`\n"
+"   :arg v3: First point of the second line\n"
+"   :type v3: :class:`mathutils.Vector`\n"
+"   :arg v4: Second point of the second line\n"
+"   :type v4: :class:`mathutils.Vector`\n";
+
+static char M_Geometry_PolyFill_doc[] = 
+".. function:: PolyFill(veclist_list)\n"
+"\n"
+"   Takes a list of polylines (each point a vector) and returns the point indicies for a polyline filled with triangles.\n"
+"\n"
+"   :rtype: list\n"
+"   :arg veclist_list: list of polylines\n";
+
+static char M_Geometry_LineIntersect2D_doc[] = 
+".. function:: LineIntersect2D(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n"
+"\n"
+"   Takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None.\n"
+"\n"
+"   :rtype: :class:`mathutils.Vector`\n"
+"   :arg lineA_p1: First point of the first line\n"
+"   :type lineA_p1: :class:`mathutils.Vector`\n"

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list