diff options
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/gpu/gpu_py_platform.c | 29 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_gizmo_wrap.h | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_operator_wrap.h | 5 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 4 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_noise.c | 4 |
5 files changed, 37 insertions, 7 deletions
diff --git a/source/blender/python/gpu/gpu_py_platform.c b/source/blender/python/gpu/gpu_py_platform.c index b877e3ceb98..c6e964405fa 100644 --- a/source/blender/python/gpu/gpu_py_platform.c +++ b/source/blender/python/gpu/gpu_py_platform.c @@ -11,6 +11,7 @@ #include "BLI_utildefines.h" +#include "GPU_context.h" #include "GPU_platform.h" #include "gpu_py_platform.h" /* Own include. */ @@ -83,6 +84,30 @@ static PyObject *pygpu_platform_device_type_get(PyObject *UNUSED(self)) return PyUnicode_FromString("UNKNOWN"); } +PyDoc_STRVAR(pygpu_platform_backend_type_get_doc, + ".. function:: backend_type_get()\n" + "\n" + " Get actuve GPU backend.\n" + "\n" + " :return: Backend type ('OPENGL', 'VULKAN', 'METAL', 'NONE', 'UNKNOWN').\n" + " :rtype: str\n"); +static PyObject *pygpu_platform_backend_type_get(PyObject *UNUSED(self)) +{ + switch (GPU_backend_get_type()) { + case GPU_BACKEND_VULKAN: + return PyUnicode_FromString("VULKAN"); + case GPU_BACKEND_METAL: + return PyUnicode_FromString("METAL"); + case GPU_BACKEND_NONE: + return PyUnicode_FromString("NONE"); + case GPU_BACKEND_OPENGL: + return PyUnicode_FromString("OPENGL"); + case GPU_BACKEND_ANY: + break; + } + return PyUnicode_FromString("UNKNOWN"); +} + /** \} */ /* -------------------------------------------------------------------- */ @@ -106,6 +131,10 @@ static struct PyMethodDef pygpu_platform__tp_methods[] = { (PyCFunction)pygpu_platform_device_type_get, METH_NOARGS, pygpu_platform_device_type_get_doc}, + {"backend_type_get", + (PyCFunction)pygpu_platform_backend_type_get, + METH_NOARGS, + pygpu_platform_backend_type_get_doc}, {NULL, NULL, 0, NULL}, }; diff --git a/source/blender/python/intern/bpy_gizmo_wrap.h b/source/blender/python/intern/bpy_gizmo_wrap.h index 6a876747e22..7d5edebed0f 100644 --- a/source/blender/python/intern/bpy_gizmo_wrap.h +++ b/source/blender/python/intern/bpy_gizmo_wrap.h @@ -13,7 +13,7 @@ struct wmGizmoType; extern "C" { #endif -/* exposed to rna/wm api */ +/* Exposed to RNA/WM API. */ void BPY_RNA_gizmo_wrapper(struct wmGizmoType *gzt, void *userdata); void BPY_RNA_gizmogroup_wrapper(struct wmGizmoGroupType *gzgt, void *userdata); diff --git a/source/blender/python/intern/bpy_operator_wrap.h b/source/blender/python/intern/bpy_operator_wrap.h index de3779332da..4b8ceba5f0c 100644 --- a/source/blender/python/intern/bpy_operator_wrap.h +++ b/source/blender/python/intern/bpy_operator_wrap.h @@ -12,10 +12,11 @@ struct wmOperatorType; extern "C" { #endif -/* these are used for operator methods, used by bpy_operator.c */ +/** These are used for operator methods, used by `bpy_operator.c`. */ PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args); -/* exposed to rna/wm api */ +/* Exposed to RNA/WM API. */ + /** * Generic function used by all Python defined operators * it's passed as an argument to #WM_operatortype_append_ptr in for operator registration. diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 0eaa5d6b6c7..02f7e16e805 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -380,10 +380,10 @@ static short pyrna_rotation_euler_order_get(PointerRNA *ptr, const short order_fallback, PropertyRNA **r_prop_eul_order); -/* bpyrna vector/euler/quat callbacks. */ +/* `bpyrna` vector/euler/quaternion callbacks. */ static uchar mathutils_rna_array_cb_index = -1; /* Index for our callbacks. */ -/* Subtype not used much yet. */ +/* Sub-type not used much yet. */ # define MATHUTILS_CB_SUBTYPE_EUL 0 # define MATHUTILS_CB_SUBTYPE_VEC 1 # define MATHUTILS_CB_SUBTYPE_QUAT 2 diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c index 3a3297f27f7..3c564142160 100644 --- a/source/blender/python/mathutils/mathutils_noise.c +++ b/source/blender/python/mathutils/mathutils_noise.c @@ -40,7 +40,7 @@ * * Any feedback is very welcome. * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html - * email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space). */ + * email: `m-mat @ math.sci.hiroshima-u.ac.jp` (remove space). */ /* Period parameters */ #define N 624 @@ -120,7 +120,7 @@ static void setRndSeed(int seed) } } -/* float number in range [0, 1) using the mersenne twister rng */ +/* Float number in range [0, 1) using the mersenne twister random number generator. */ static float frand(void) { ulong y; |