diff options
author | Campbell Barton <campbell@blender.org> | 2022-04-14 04:21:51 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-04-14 04:21:51 +0300 |
commit | 927cb5bfacadd4ce23643a37b6429487d11ec4a9 (patch) | |
tree | 613eedd04a4279e89fbfe73bbc9c2948a5f8e495 /source/blender/python | |
parent | f076493dbbf35c8993970b3b1096aa4ce105a3fd (diff) |
Cleanup: separate format-units for Python argument parsing
Recent addition to the Python API [0] didn't follow this convention.
See [1] for the rationale behind this change.
[0]: 9bc678969aaef5e2343d9362648e9a633d1b6e5e
[1]: 982aea88e0d74020c62c2054a45eeafa56c8ca30
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/gpu/gpu_py_shader_create_info.cc | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/source/blender/python/gpu/gpu_py_shader_create_info.cc b/source/blender/python/gpu/gpu_py_shader_create_info.cc index ab2bdf33b26..3b043c605fa 100644 --- a/source/blender/python/gpu/gpu_py_shader_create_info.cc +++ b/source/blender/python/gpu/gpu_py_shader_create_info.cc @@ -483,7 +483,16 @@ static PyObject *pygpu_shader_info_fragment_out(BPyGPUShaderCreateInfo *self, struct PyC_StringEnum blend_type = {pygpu_dualblend_items, (int)DualBlend::NONE}; static const char *_keywords[] = {"slot", "type", "name", "blend", nullptr}; - static _PyArg_Parser _parser = {"iO&s|$O&:fragment_out", _keywords, nullptr}; + static _PyArg_Parser _parser = { + "i" /* `slot` */ + "O&" /* `type` */ + "s" /* `name` */ + "|$" /* Optional keyword only arguments. */ + "O&" /* `blend` */ + ":fragment_out", + _keywords, + nullptr, + }; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, @@ -577,7 +586,17 @@ static PyObject *pygpu_shader_info_image(BPyGPUShaderCreateInfo *self, Qualifier qualifier = Qualifier::NO_RESTRICT; static const char *_keywords[] = {"slot", "format", "type", "name", "qualifiers", nullptr}; - static _PyArg_Parser _parser = {"iO&O&s|$O:image", _keywords, 0}; + static _PyArg_Parser _parser = { + "i" /* `slot` */ + "O&" /* `format` */ + "O&" /* `type` */ + "s" /* `name` */ + "|$" /* Optional keyword only arguments. */ + "O" /* `qualifiers` */ + ":image", + _keywords, + nullptr, + }; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, @@ -733,7 +752,15 @@ static PyObject *pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self, int array_size = 0; static const char *_keywords[] = {"type", "name", "size", nullptr}; - static _PyArg_Parser _parser = {"O&s|I:push_constant", _keywords, nullptr}; + static _PyArg_Parser _parser = { + "O&" /* `type` */ + "s" /* `name` */ + "|" /* Optional arguments. */ + "I" /* `size` */ + ":push_constant", + _keywords, + nullptr, + }; if (!_PyArg_ParseTupleAndKeywordsFast( args, kwds, &_parser, PyC_ParseStringEnum, &pygpu_type, &name, &array_size)) { return nullptr; |