From 4fe35721e647126c6f929725d20064d279783ac3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Nov 2012 01:14:11 +0000 Subject: bmesh operator api reference - add in 'bmesh' arg at the start of each operator, also use :class: references. --- doc/python_api/rst/bge.logic.rst | 40 ++++++++++++++--------------- doc/python_api/rst_from_bmesh_opdefines.py | 41 +++++++++++++++++------------- 2 files changed, 43 insertions(+), 38 deletions(-) (limited to 'doc') diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst index acf28706709..7d20aa31a36 100644 --- a/doc/python_api/rst/bge.logic.rst +++ b/doc/python_api/rst/bge.logic.rst @@ -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: diff --git a/doc/python_api/rst_from_bmesh_opdefines.py b/doc/python_api/rst_from_bmesh_opdefines.py index 5803315ff86..3077798cbef 100644 --- a/doc/python_api/rst_from_bmesh_opdefines.py +++ b/doc/python_api/rst_from_bmesh_opdefines.py @@ -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 == "": -- cgit v1.2.3