[Bf-blender-cvs] [42a6b2fd06e] master: Cleanup: move public doc-strings into headers for 'python'

Campbell Barton noreply at git.blender.org
Thu Dec 2 12:55:48 CET 2021


Commit: 42a6b2fd06e4fefe1bdb283d9e568d7f7dca178e
Author: Campbell Barton
Date:   Thu Dec 2 17:24:04 2021 +1100
Branches: master
https://developer.blender.org/rB42a6b2fd06e4fefe1bdb283d9e568d7f7dca178e

Cleanup: move public doc-strings into headers for 'python'

===================================================================

M	source/blender/python/BPY_extern.h
M	source/blender/python/bmesh/bmesh_py_ops_call.c
M	source/blender/python/bmesh/bmesh_py_ops_call.h
M	source/blender/python/bmesh/bmesh_py_types.c
M	source/blender/python/bmesh/bmesh_py_types.h
M	source/blender/python/bmesh/bmesh_py_types_customdata.c
M	source/blender/python/bmesh/bmesh_py_types_customdata.h
M	source/blender/python/bmesh/bmesh_py_types_meshdata.c
M	source/blender/python/bmesh/bmesh_py_types_meshdata.h
M	source/blender/python/bmesh/bmesh_py_types_select.c
M	source/blender/python/bmesh/bmesh_py_types_select.h
M	source/blender/python/generic/bgl.c
M	source/blender/python/generic/bgl.h
M	source/blender/python/generic/bpy_threads.c
M	source/blender/python/generic/idprop_py_api.c
M	source/blender/python/generic/idprop_py_api.h
M	source/blender/python/generic/py_capi_rna.c
M	source/blender/python/generic/py_capi_rna.h
M	source/blender/python/generic/py_capi_utils.c
M	source/blender/python/generic/py_capi_utils.h
M	source/blender/python/generic/python_utildefines.h
M	source/blender/python/gpu/gpu_py_buffer.c
M	source/blender/python/gpu/gpu_py_buffer.h
M	source/blender/python/intern/bpy.c
M	source/blender/python/intern/bpy.h
M	source/blender/python/intern/bpy_capi_utils.c
M	source/blender/python/intern/bpy_capi_utils.h
M	source/blender/python/intern/bpy_driver.c
M	source/blender/python/intern/bpy_driver.h
M	source/blender/python/intern/bpy_interface.c
M	source/blender/python/intern/bpy_operator_wrap.c
M	source/blender/python/intern/bpy_operator_wrap.h
M	source/blender/python/intern/bpy_props.c
M	source/blender/python/intern/bpy_props.h
M	source/blender/python/intern/bpy_rna.c
M	source/blender/python/intern/bpy_rna_array.c
M	source/blender/python/intern/bpy_rna_driver.c
M	source/blender/python/intern/bpy_rna_driver.h
M	source/blender/python/mathutils/mathutils.c
M	source/blender/python/mathutils/mathutils.h
M	source/blender/python/mathutils/mathutils_Matrix.c
M	source/blender/python/mathutils/mathutils_Matrix.h
M	source/blender/python/mathutils/mathutils_Vector.c
M	source/blender/python/mathutils/mathutils_Vector.h

===================================================================

diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 43a73363c98..554d4a4541f 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -55,7 +55,13 @@ int BPY_is_pyconstraint(struct Text *text);
 
 typedef void *BPy_ThreadStatePtr;
 
+/**
+ * Analogue of #PyEval_SaveThread()
+ */
 BPy_ThreadStatePtr BPY_thread_save(void);
+/**
+ * Analogue of #PyEval_RestoreThread()
+ */
 void BPY_thread_restore(BPy_ThreadStatePtr tstate);
 
 /* our own wrappers to Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS */
@@ -74,7 +80,18 @@ void BPY_modules_load_user(struct bContext *C);
 
 void BPY_app_handlers_reset(const short do_all);
 
+/**
+ * Update function, it gets rid of py-drivers global dictionary, forcing
+ * BPY_driver_exec to recreate it. This function is used to force
+ * reloading the Blender text module "pydrivers.py", if available, so
+ * updates in it reach py-driver evaluation.
+ */
 void BPY_driver_reset(void);
+
+/**
+ * This evaluates Python driver expressions, `driver_orig->expression`
+ * is a Python expression that should evaluate to a float number, which is returned.
+ */
 float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
                       struct ChannelDriver *driver,
                       struct ChannelDriver *driver_orig,
@@ -93,6 +110,16 @@ void BPY_context_update(struct bContext *C);
                                        (C)->data.py_context_orig, \
                                        ((const char *[]){__VA_ARGS__}), \
                                        VA_NARGS_COUNT(__VA_ARGS__))
+/**
+ * Use for `CTX_*_set(..)` functions need to set values which are later read back as expected.
+ * In this case we don't want the Python context to override the values as it causes problems
+ * see T66256.
+ *
+ * \param dict_p: A pointer to #bContext.data.py_context so we can assign a new value.
+ * \param dict_orig: The value of #bContext.data.py_context_orig to check if we need to copy.
+ *
+ * \note Typically accessed via #BPY_context_dict_clear_members macro.
+ */
 void BPY_context_dict_clear_members_array(void **dict_p,
                                           void *dict_orig,
                                           const char *context_members[],
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
index 24887b24eb6..f1423c20b3b 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -745,9 +745,6 @@ static PyObject *bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
   return item;
 }
 
-/**
- * This is the __call__ for bmesh.ops.xxx()
- */
 PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
 {
   PyObject *ret;
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.h b/source/blender/python/bmesh/bmesh_py_ops_call.h
index 1c7a35788d2..c567375c568 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.h
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.h
@@ -28,4 +28,7 @@ typedef struct {
   const char *opname;
 } BPy_BMeshOpFunc;
 
+/**
+ * This is the `__call__` for `bmesh.ops.xxx()`.
+ */
 PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw);
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 3dd8e58781e..38ec242fa49 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -3954,7 +3954,6 @@ PyObject *BPy_BMIter_CreatePyObject(BMesh *bm)
   return (PyObject *)self;
 }
 
-/* this is just a helper func */
 PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele)
 {
   switch (ele->htype) {
@@ -4036,11 +4035,6 @@ void bpy_bm_generic_invalidate(BPy_BMGeneric *self)
   self->bm = NULL;
 }
 
-/* generic python seq as BMVert/Edge/Face array,
- * return value must be freed with PyMem_FREE(...);
- *
- * The 'bm_r' value is assigned when empty, and used when set.
- */
 void *BPy_BMElem_PySeq_As_Array_FAST(BMesh **r_bm,
                                      PyObject *seq_fast,
                                      Py_ssize_t min,
@@ -4233,11 +4227,6 @@ int BPy_BMElem_CheckHType(PyTypeObject *type, const char htype)
           ((htype & BM_LOOP) && (type == &BPy_BMLoop_Type)));
 }
 
-/**
- * Use for error strings only, not thread safe,
- *
- * \return a string like '(BMVert/BMEdge/BMFace/BMLoop)'
- */
 char *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32])
 {
   /* zero to ensure string is always NULL terminated */
diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h
index 043c5322735..42d1fee31c3 100644
--- a/source/blender/python/bmesh/bmesh_py_types.h
+++ b/source/blender/python/bmesh/bmesh_py_types.h
@@ -148,9 +148,15 @@ PyObject *BPy_BMFaceSeq_CreatePyObject(BMesh *bm);
 PyObject *BPy_BMLoopSeq_CreatePyObject(BMesh *bm);
 PyObject *BPy_BMIter_CreatePyObject(BMesh *bm);
 
-/* Just checks type and creates v/e/f/l. */
+/** Just checks type and creates vert/edge/face/loop. */
 PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele);
 
+/**
+ * Generic python seq as BMVert/Edge/Face array,
+ * return value must be freed with PyMem_FREE(...);
+ *
+ * The 'bm_r' value is assigned when empty, and used when set.
+ */
 void *BPy_BMElem_PySeq_As_Array_FAST(BMesh **r_bm,
                                      PyObject *seq_fast,
                                      Py_ssize_t min,
@@ -177,6 +183,11 @@ PyObject *BPy_BMFace_Array_As_Tuple(BMesh *bm, BMFace **elem, Py_ssize_t elem_le
 PyObject *BPy_BMLoop_Array_As_Tuple(BMesh *bm, BMLoop **elem, Py_ssize_t elem_len);
 
 int BPy_BMElem_CheckHType(PyTypeObject *type, const char htype);
+/**
+ * Use for error strings only, not thread safe,
+ *
+ * \return a string like '(BMVert/BMEdge/BMFace/BMLoop)'
+ */
 char *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32]);
 char *BPy_BMElem_StringFromHType(const char htype);
 
@@ -198,7 +209,9 @@ int bpy_bm_generic_valid_check_source(BMesh *bm_source,
   } \
   (void)0
 
-/* macros like BPY_BM_CHECK_OBJ/BPY_BM_CHECK_INT that ensure we're from the right BMesh */
+/**
+ * Macros like `BPY_BM_CHECK_OBJ/BPY_BM_CHECK_INT` that ensure we're from the right #BMesh.
+ */
 #define BPY_BM_CHECK_SOURCE_OBJ(bm, errmsg, ...) \
   { \
     void *_args[] = {__VA_ARGS__}; \
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 0aa92158524..1e1ba5edb0f 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -1104,13 +1104,6 @@ static void *bpy_bmlayeritem_ptr_get(BPy_BMElem *py_ele, BPy_BMLayerItem *py_lay
   return value;
 }
 
-/**
- *\brief BMElem.__getitem__()
- *
- * assume all error checks are done, eg:
- *
- *     uv = vert[uv_layer]
- */
 PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
 {
   void *value = bpy_bmlayeritem_ptr_get(py_ele, py_layer);
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.h b/source/blender/python/bmesh/bmesh_py_types_customdata.h
index 8552942f73a..a5555a14ad7 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.h
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.h
@@ -23,7 +23,8 @@
 
 #pragma once
 
-/* all use BPy_BMLayerAccess struct */
+/* All use #BPy_BMLayerAccess struct. */
+
 extern PyTypeObject BPy_BMLayerAccessVert_Type;
 extern PyTypeObject BPy_BMLayerAccessEdge_Type;
 extern PyTypeObject BPy_BMLayerAccessFace_Type;
@@ -36,14 +37,14 @@ extern PyTypeObject BPy_BMLayerItem_Type;
 #define BPy_BMLayerCollection_Check(v) (Py_TYPE(v) == &BPy_BMLayerCollection_Type)
 #define BPy_BMLayerItem_Check(v) (Py_TYPE(v) == &BPy_BMLayerItem_Type)
 
-/* all layers for vert/edge/face/loop */
+/** All layers for vert/edge/face/loop. */
 typedef struct BPy_BMLayerAccess {
   PyObject_VAR_HEAD
   struct BMesh *bm; /* keep first */
   char htype;
 } BPy_BMLayerAccess;
 
-/* access different layer types deform/uv/vertexcolor */
+/** Access different layer types deform/uv/vertex-color. */
 typedef struct BPy_BMLayerCollection {
   PyObject_VAR_HEAD
   struct BMesh *bm; /* keep first */
@@ -51,7 +52,7 @@ typedef struct BPy_BMLayerCollection {
   int type; /* customdata type - CD_XXX */
 } BPy_BMLayerCollection;
 
-/* access a specific layer directly */
+/** Access a specific layer directly. */
 typedef struct BPy_BMLayerItem {
   PyObject_VAR_HEAD
   struct BMesh *bm; /* keep first */
@@ -66,6 +67,10 @@ PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, const char htype, int type,
 
 void BPy_BM_init_types_customdata(void);
 
-/* __getitem__ / __setitem__ */
+/**
+ *\brief BMElem.__getitem__() / __setitem__()
+ *
+ * Assume all error checks are done, eg: `uv = vert[uv_layer]`
+ */
 PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer);
 int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObject *value);
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index d0c745e6a1d..dffc0814d9d 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -683,7 +683,6 @@ PyObject *BPy_BMDeformVert_CreatePyObject(struct MDeformVert *dvert)
 
 /* --- End Mesh Deform Vert --- */
 
-/* call to init all types */
 void BPy_BM_init_types_meshdata(void)
 {
   bm_init_types_bmloopuv();
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.h b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
index 426bfcef6a0..b52bf6889bc 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.h
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
@@ -50,4 +50,5 @@ PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopCol *mloopcol);
 int BPy_BMDeformVert_AssignPyObject(struct MDeformVert *dvert, PyObject *value);
 PyObject *BPy_BMDeformVert_CreatePyObject(struct MDeformVert *dvert);
 
+/* call to init all types */
 void BPy_BM_init_types_meshdata(void);
diff --git a/source/blender/python/bmesh/bmesh_py_type

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list