[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52625] trunk/blender: bmesh operator api reference - add in 'bmesh' arg at the start of each operator, also use :class: references.

Campbell Barton ideasman42 at gmail.com
Wed Nov 28 02:14:15 CET 2012


Revision: 52625
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52625
Author:   campbellbarton
Date:     2012-11-28 01:14:11 +0000 (Wed, 28 Nov 2012)
Log Message:
-----------
bmesh operator api reference - add in 'bmesh' arg at the start of each operator, also use :class: references.

Modified Paths:
--------------
    trunk/blender/doc/python_api/rst/bge.logic.rst
    trunk/blender/doc/python_api/rst_from_bmesh_opdefines.py
    trunk/blender/release/scripts/modules/bpy_extras/mesh_utils.py

Modified: trunk/blender/doc/python_api/rst/bge.logic.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bge.logic.rst	2012-11-28 00:47:33 UTC (rev 52624)
+++ trunk/blender/doc/python_api/rst/bge.logic.rst	2012-11-28 01:14:11 UTC (rev 52625)
@@ -416,9 +416,9 @@
 .. data:: KX_SENSOR_ACTIVE
 .. data:: KX_SENSOR_JUST_DEACTIVATED
 
--------------
+---------------
 Armature Sensor
--------------
+---------------
 
 .. _armaturesensor-type:
 
@@ -537,9 +537,9 @@
 .. data:: KX_ACTIONACT_LOOPEND
 .. data:: KX_ACTIONACT_PROPERTY
 
----------------
+-----------------
 Armature Actuator
----------------
+-----------------
 
  .. _armatureactuator-constants-type:
    
@@ -556,13 +556,13 @@
 .. data:: KX_ACT_ARMATURE_ENABLE
 
   Enable the constraint.
-		
+
   :value: 1
 
 .. data:: KX_ACT_ARMATURE_DISABLE
 
   Disable the constraint (runtime constraint values are not updated).
-		
+
   :value: 2
 
 .. data:: KX_ACT_ARMATURE_SETTARGET
@@ -809,9 +809,9 @@
 
    :value: 6
 
---------------
+-----------------
 Steering Actuator
---------------
+-----------------
 
 .. _logic-steering-actuator:
 
@@ -961,9 +961,9 @@
   :value: 6
 
 
-----------------
+-------------------
 Armature Constraint
-----------------
+-------------------
 .. _armatureconstraint-constants-type:
 
 See :class:`bge.types.BL_ArmatureConstraint.type`
@@ -1075,9 +1075,9 @@
 .. data:: KX_INPUT_ACTIVE
 .. data:: KX_INPUT_JUST_RELEASED
 
-------------
+-------------
 KX_GameObject
------------
+-------------
 .. _gameobject-playaction-mode:
 
 See :class:`bge.types.KX_GameObject.playAction`
@@ -1111,9 +1111,9 @@
 .. data:: KX_MOUSE_BUT_MIDDLE
 .. data:: KX_MOUSE_BUT_RIGHT
 
-------------
+--------------------------
 Navigation Mesh Draw Modes
-------------
+--------------------------
 
 .. _navmesh-draw-mode:
 
@@ -1199,25 +1199,25 @@
 .. data:: KX_STATE_OP_CLR
 
    Substract bits to state mask
-   
+
    :value: 0
 
 .. data:: KX_STATE_OP_CPY
 
    Copy state mask
-   
+
    :value: 1
    
 .. data:: KX_STATE_OP_NEG
 
    Invert bits to state mask
-   
+
    :value: 2
-   
+
 .. data:: KX_STATE_OP_SET
 
    Add bits to state mask
-   
+
    :value: 3
-   
+
 .. _Two-D-FilterActuator-mode:

Modified: trunk/blender/doc/python_api/rst_from_bmesh_opdefines.py
===================================================================
--- trunk/blender/doc/python_api/rst_from_bmesh_opdefines.py	2012-11-28 00:47:33 UTC (rev 52624)
+++ trunk/blender/doc/python_api/rst_from_bmesh_opdefines.py	2012-11-28 01:14:11 UTC (rev 52625)
@@ -38,8 +38,8 @@
 OUT_RST = os.path.join(CURRENT_DIR, "rst", "bmesh.ops.rst")
 
 HEADER = r"""
-BMesh Operators
-===============
+BMesh Operators (bmesh.ops)
+===========================
 
 .. module:: bmesh.ops
 
@@ -123,7 +123,7 @@
         "BMO_OP_SLOT_SUBTYPE_MAP_ELEM",
         "BMO_OP_SLOT_SUBTYPE_MAP_BOOL",
         "BMO_OP_SLOT_SUBTYPE_MAP_INT",
-        "BMO_OP_SLOT_SUBTYPE_MAP_FLOAT",
+        "BMO_OP_SLOT_SUBTYPE_MAP_FLT",
         "BMO_OP_SLOT_SUBTYPE_MAP_EMPTY",
         "BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL",
 
@@ -211,7 +211,7 @@
         if args_out is not None:
             args_out_index[:] = [i for (i, a) in enumerate(args_out) if type(a) == tuple]
 
-        fw(".. function:: %s(%s)\n\n" % (b[0], ", ".join([args_in[i][0] for i in args_in_index])))
+        fw(".. function:: %s(bm, %s)\n\n" % (b[0], ", ".join([args_in[i][0] for i in args_in_index])))
         
         # -- wash the comment
         comment_washed = []
@@ -233,7 +233,7 @@
 
 
         # get the args
-        def get_args_wash(args, args_index):
+        def get_args_wash(args, args_index, is_ret):
             args_wash = []
             for i in args_index:
                 arg = args[i]
@@ -277,20 +277,22 @@
                 elif tp == BMO_OP_SLOT_BOOL:
                     tp_str = "bool"
                 elif tp == BMO_OP_SLOT_MAT:
-                    tp_str = "matrix"
+                    tp_str = ":class:`mathutils.Matrix`"
                 elif tp == BMO_OP_SLOT_VEC:
-                    tp_str = "matrix"
+                    tp_str = ":class:`mathutils.Vector`"
+                    if not is_ret:
+                        tp_str += " or any sequence of 3 floats"
                 elif tp == BMO_OP_SLOT_PTR:
                     tp_str = "dict"
                     assert(tp_sub is not None)
                     if tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_BMESH:
-                        tp_str = "BMesh"
+                        tp_str = ":class:`bmesh.types.BMesh`"
                     elif tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_SCENE:
-                        tp_str = "Scene"
+                        tp_str = ":class:`bpy.types.Scene`"
                     elif tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_OBJECT:
-                        tp_str = "Object"
+                        tp_str = ":class:`bpy.types.Object`"
                     elif tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_MESH:
-                        tp_str = "Mesh"
+                        tp_str = ":class:`bpy.types.Mesh`"
                     else:
                         print("Cant find", vars_dict_reverse[tp_sub])
                         assert(0)
@@ -299,9 +301,9 @@
                     assert(tp_sub is not None)
                     
                     ls = []
-                    if tp_sub & BM_VERT: ls.append("vert")
-                    if tp_sub & BM_EDGE: ls.append("edge")
-                    if tp_sub & BM_FACE: ls.append("face")
+                    if tp_sub & BM_VERT: ls.append(":class:`bmesh.types.BMVert`")
+                    if tp_sub & BM_EDGE: ls.append(":class:`bmesh.types.BMEdge`")
+                    if tp_sub & BM_FACE: ls.append(":class:`bmesh.types.BMFace`")
                     assert(ls)  # must be at least one
 
                     if tp_sub & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE:
@@ -319,10 +321,10 @@
                             tp_str += "bool"
                         elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_INT:
                             tp_str += "int"
-                        elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_FLOAT:
+                        elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_FLT:
                             tp_str += "float"
                         elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_ELEM:
-                            tp_str += "vert/edge/face elements"
+                            tp_str += ":class:`bmesh.types.BMVert`/:class:`bmesh.types.BMEdge`/:class:`bmesh.types.BMFace`"
                         elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL:
                             tp_str += "unknown internal data, not compatible with python"
                         else:
@@ -336,9 +338,12 @@
             return args_wash
         # end get_args_wash
 
+        # all ops get this arg
+        fw("   :arg bm: The bmesh to operate on.\n")
+        fw("   :type bm: :class:`bmesh.types.BMesh`\n")
 
-        args_in_wash = get_args_wash(args_in, args_in_index)
-        args_out_wash = get_args_wash(args_out, args_out_index)
+        args_in_wash = get_args_wash(args_in, args_in_index, False)
+        args_out_wash = get_args_wash(args_out, args_out_index, True)
 
         for (name, tp, comment) in args_in_wash:
             if comment == "":

Modified: trunk/blender/release/scripts/modules/bpy_extras/mesh_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_extras/mesh_utils.py	2012-11-28 00:47:33 UTC (rev 52624)
+++ trunk/blender/release/scripts/modules/bpy_extras/mesh_utils.py	2012-11-28 01:14:11 UTC (rev 52625)
@@ -325,10 +325,12 @@
     fgon to create from existing verts.
 
     from_data: either a mesh, or a list/tuple of vectors.
-    indices: a list of indices to use this list is the ordered closed polyline
+    :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.
-    fix_loops: If this is enabled polylines that use loops to make multiple
+    :type indices: list
+    :arg fix_loops: If this is enabled polylines that use loops to make multiple
        polylines are delt with correctly.
+    :type fix_loops: bool
     """
 
     from mathutils.geometry import tessellate_polygon




More information about the Bf-blender-cvs mailing list