[Bf-blender-cvs] [c15439bcdc5] blender2.8: Cleanup: use PyModule_AddIntConstant
mano-wii
noreply at git.blender.org
Fri Oct 5 05:07:23 CEST 2018
Commit: c15439bcdc52f90570dd22fc0f61b94bdf56145d
Author: mano-wii
Date: Thu Oct 4 23:52:49 2018 -0300
Branches: blender2.8
https://developer.blender.org/rBc15439bcdc52f90570dd22fc0f61b94bdf56145d
Cleanup: use PyModule_AddIntConstant
===================================================================
M source/blender/python/gpu/gpu_py_shader.c
===================================================================
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index c8193e00f6a..64b208ed49f 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -45,21 +45,18 @@
static void bpygpu_shader_add_enum_objects(PyObject *submodule)
{
- PyObject *dict = PyModule_GetDict(submodule);
- PyObject *item;
-
-#define PY_DICT_ADD_INT(x) PyDict_SetItemString(dict, #x, item = PyLong_FromLong(x)); Py_DECREF(item)
+#define ADDCONST(x) PyModule_AddIntConstant(submodule, #x, x)
/* Shaders */
- PY_DICT_ADD_INT(GPU_SHADER_2D_UNIFORM_COLOR);
- PY_DICT_ADD_INT(GPU_SHADER_2D_FLAT_COLOR);
- PY_DICT_ADD_INT(GPU_SHADER_2D_SMOOTH_COLOR);
- PY_DICT_ADD_INT(GPU_SHADER_2D_IMAGE);
- PY_DICT_ADD_INT(GPU_SHADER_3D_UNIFORM_COLOR);
- PY_DICT_ADD_INT(GPU_SHADER_3D_FLAT_COLOR);
- PY_DICT_ADD_INT(GPU_SHADER_3D_SMOOTH_COLOR);
-
-#undef PY_DICT_ADD_INT
+ ADDCONST(GPU_SHADER_2D_UNIFORM_COLOR);
+ ADDCONST(GPU_SHADER_2D_FLAT_COLOR);
+ ADDCONST(GPU_SHADER_2D_SMOOTH_COLOR);
+ ADDCONST(GPU_SHADER_2D_IMAGE);
+ ADDCONST(GPU_SHADER_3D_UNIFORM_COLOR);
+ ADDCONST(GPU_SHADER_3D_FLAT_COLOR);
+ ADDCONST(GPU_SHADER_3D_SMOOTH_COLOR);
+
+#undef ADDCONST
}
static int bpygpu_pyLong_as_shader_enum(PyObject *o)
More information about the Bf-blender-cvs
mailing list