bmesh operator api reference - add in 'bmesh' arg at the start of each operator,...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 28 Nov 2012 01:14:11 +0000 (01:14 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 28 Nov 2012 01:14:11 +0000 (01:14 +0000)
doc/python_api/rst/bge.logic.rst
doc/python_api/rst_from_bmesh_opdefines.py
release/scripts/modules/bpy_extras/mesh_utils.py

index acf287067095418f9adbf898e662f66a34e55109..7d20aa31a36d22afa395bdf1535ba924936bb266 100644 (file)
@@ -416,9 +416,9 @@ Sensor Status
 .. data:: KX_SENSOR_ACTIVE
 .. data:: KX_SENSOR_JUST_DEACTIVATED
 
--------------
+---------------
 Armature Sensor
--------------
+---------------
 
 .. _armaturesensor-type:
 
@@ -537,9 +537,9 @@ See :class:`bge.types.BL_ActionActuator`
 .. data:: KX_ACTIONACT_LOOPEND
 .. data:: KX_ACTIONACT_PROPERTY
 
----------------
+-----------------
 Armature Actuator
----------------
+-----------------
 
  .. _armatureactuator-constants-type:
    
@@ -556,13 +556,13 @@ See :class:`bge.types.BL_ArmatureActuator.type`
 .. 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 @@ See :class:`bge.types.KX_SoundActuator`
 
    :value: 6
 
---------------
+-----------------
 Steering Actuator
---------------
+-----------------
 
 .. _logic-steering-actuator:
 
@@ -961,9 +961,9 @@ See :class:`bge.types.BL_ArmatureChannel.rotation_mode`
   :value: 6
 
 
-----------------
+-------------------
 Armature Constraint
-----------------
+-------------------
 .. _armatureconstraint-constants-type:
 
 See :class:`bge.types.BL_ArmatureConstraint.type`
@@ -1075,9 +1075,9 @@ See :class:`bge.types.SCA_PythonKeyboard`, :class:`bge.types.SCA_PythonMouse`, :
 .. 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 @@ See :class:`bge.types.SCA_MouseSensor`
 .. data:: KX_MOUSE_BUT_MIDDLE
 .. data:: KX_MOUSE_BUT_RIGHT
 
-------------
+--------------------------
 Navigation Mesh Draw Modes
-------------
+--------------------------
 
 .. _navmesh-draw-mode:
 
@@ -1199,25 +1199,25 @@ See :class:`bge.types.KX_StateActuator.operation`
 .. 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:
index 5803315ff86cc707bf89a467b75a9fb1a98b8725..3077798cbef89da9b73d95fc051624869e0964dc 100644 (file)
@@ -38,8 +38,8 @@ FILE_OP_DEFINES_C = os.path.join(SOURCE_DIR, "source", "blender", "bmesh", "inte
 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 @@ def main():
         "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 @@ def main():
         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 @@ def main():
 
 
         # 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 @@ def main():
                 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 @@ def main():
                     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 @@ def main():
                             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 @@ def main():
             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 == "":
index 2042cc1c8a1c44316f201ff0ccc9d0af4a913cf7..0166f954dc9e0b97ee91b9f9f52ee8747070de36 100644 (file)
@@ -325,10 +325,12 @@ def ngon_tessellate(from_data, indices, fix_loops=True):
     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