Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-09-19 05:05:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-19 05:12:21 +0300
commitbb3ec3ebafbc2c0e5d8530148a433242e0adad30 (patch)
treed30aaa3df2d03f90f6e7749bdc075445a5642045 /source/blender/python
parent4c918efd44be11d47afc1efed684a15ad5579722 (diff)
BLI_utildefines: rename pointer conversion macros
Terms get/set don't make much sense when casting values. Name macros so the conversion is obvious, use common prefix for easier completion. - GET_INT_FROM_POINTER -> POINTER_AS_INT - SET_INT_IN_POINTER -> POINTER_FROM_INT - GET_UINT_FROM_POINTER -> POINTER_AS_UINT - SET_UINT_IN_POINTER -> POINTER_FROM_UINT
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c8
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c8
-rw-r--r--source/blender/python/intern/bpy_app.c8
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c8
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c16
9 files changed, 31 insertions, 31 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 5bd938ba279..df01dda94c6 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -112,7 +112,7 @@ PyDoc_STRVAR(bpy_bm_elem_seam_doc, "Seam for UV unwrapping.\n\n:type: boolean
static PyObject *bpy_bm_elem_hflag_get(BPy_BMElem *self, void *flag)
{
- const char hflag = (char)GET_INT_FROM_POINTER(flag);
+ const char hflag = (char)POINTER_AS_INT(flag);
BPY_BM_CHECK_OBJ(self);
@@ -121,7 +121,7 @@ static PyObject *bpy_bm_elem_hflag_get(BPy_BMElem *self, void *flag)
static int bpy_bm_elem_hflag_set(BPy_BMElem *self, PyObject *value, void *flag)
{
- const char hflag = (char)GET_INT_FROM_POINTER(flag);
+ const char hflag = (char)POINTER_AS_INT(flag);
int param;
BPY_BM_CHECK_INT(self);
@@ -265,7 +265,7 @@ PyDoc_STRVAR(bpy_bmloops_link_loops_doc,
static PyObject *bpy_bmelemseq_elem_get(BPy_BMElem *self, void *itype)
{
BPY_BM_CHECK_OBJ(self);
- return BPy_BMElemSeq_CreatePyObject(self->bm, self, GET_INT_FROM_POINTER(itype));
+ return BPy_BMElemSeq_CreatePyObject(self->bm, self, POINTER_AS_INT(itype));
}
@@ -613,7 +613,7 @@ static PyObject *bpy_bmelemseq_layers_get(BPy_BMElemSeq *self, void *htype)
{
BPY_BM_CHECK_OBJ(self);
- return BPy_BMLayerAccess_CreatePyObject(self->bm, GET_INT_FROM_POINTER(htype));
+ return BPy_BMLayerAccess_CreatePyObject(self->bm, POINTER_AS_INT(htype));
}
/* FaceSeq
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index aee9d6405d0..ecf5cce8bd2 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -131,7 +131,7 @@ PyDoc_STRVAR(bpy_bmlayeraccess_collection__freestyle_face_doc,
static PyObject *bpy_bmlayeraccess_collection_get(BPy_BMLayerAccess *self, void *flag)
{
- const int type = (int)GET_INT_FROM_POINTER(flag);
+ const int type = (int)POINTER_AS_INT(flag);
BPY_BM_CHECK_OBJ(self);
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index e4a2cb8fbbc..d2ea87dd03f 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -182,13 +182,13 @@ PyDoc_STRVAR(bpy_bmloopuv_flag__select_edge_doc,
static PyObject *bpy_bmloopuv_flag_get(BPy_BMLoopUV *self, void *flag_p)
{
- const int flag = GET_INT_FROM_POINTER(flag_p);
+ const int flag = POINTER_AS_INT(flag_p);
return PyBool_FromLong(self->data->flag & flag);
}
static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag_p)
{
- const int flag = GET_INT_FROM_POINTER(flag_p);
+ const int flag = POINTER_AS_INT(flag_p);
switch (PyC_Long_AsBool(value)) {
case true:
@@ -290,13 +290,13 @@ PyDoc_STRVAR(bpy_bmvertskin_flag__use_loose_doc,
static PyObject *bpy_bmvertskin_flag_get(BPy_BMVertSkin *self, void *flag_p)
{
- const int flag = GET_INT_FROM_POINTER(flag_p);
+ const int flag = POINTER_AS_INT(flag_p);
return PyBool_FromLong(self->data->flag & flag);
}
static int bpy_bmvertskin_flag_set(BPy_BMVertSkin *self, PyObject *value, void *flag_p)
{
- const int flag = GET_INT_FROM_POINTER(flag_p);
+ const int flag = POINTER_AS_INT(flag_p);
switch (PyC_Long_AsBool(value)) {
case true:
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 66c64b580f3..d519b5f8aef 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -230,13 +230,13 @@ PyDoc_STRVAR(bpy_app_debug_doc,
);
static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *closure)
{
- const int flag = GET_INT_FROM_POINTER(closure);
+ const int flag = POINTER_AS_INT(closure);
return PyBool_FromLong(G.debug & flag);
}
static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *closure)
{
- const int flag = GET_INT_FROM_POINTER(closure);
+ const int flag = POINTER_AS_INT(closure);
const int param = PyObject_IsTrue(value);
if (param == -1) {
@@ -307,7 +307,7 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void
static PyObject *bpy_app_global_flag_get(PyObject *UNUSED(self), void *closure)
{
- const int flag = GET_INT_FROM_POINTER(closure);
+ const int flag = POINTER_AS_INT(closure);
return PyBool_FromLong(G.f & flag);
}
@@ -339,7 +339,7 @@ PyDoc_STRVAR(bpy_app_preview_render_size_doc,
);
static PyObject *bpy_app_preview_render_size_get(PyObject *UNUSED(self), void *closure)
{
- return PyLong_FromLong((long)UI_preview_render_size(GET_INT_FROM_POINTER(closure)));
+ return PyLong_FromLong((long)UI_preview_render_size(POINTER_AS_INT(closure)));
}
static PyObject *bpy_app_autoexec_fail_message_get(PyObject *UNUSED(self), void *UNUSED(closure))
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index ded5ead93aa..8453808d6ec 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -241,7 +241,7 @@ PyObject *BPY_app_handlers_struct(void)
funcstore = &funcstore_array[pos];
funcstore->func = bpy_app_generic_callback;
funcstore->alloc = 0;
- funcstore->arg = SET_INT_IN_POINTER(pos);
+ funcstore->arg = POINTER_FROM_INT(pos);
BLI_callback_add(funcstore, pos);
}
}
@@ -300,7 +300,7 @@ void BPY_app_handlers_reset(const short do_all)
/* the actual callback - not necessarily called from py */
void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *arg)
{
- PyObject *cb_list = py_cb_array[GET_INT_FROM_POINTER(arg)];
+ PyObject *cb_list = py_cb_array[POINTER_AS_INT(arg)];
if (PyList_GET_SIZE(cb_list) > 0) {
PyGILState_STATE gilstate = PyGILState_Ensure();
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index 4c1163a6181..e97ed095b24 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -706,12 +706,12 @@ PyDoc_STRVAR(Color_channel_b_doc, "Blue color channel.\n\n:type: float");
static PyObject *Color_channel_get(ColorObject *self, void *type)
{
- return Color_item(self, GET_INT_FROM_POINTER(type));
+ return Color_item(self, POINTER_AS_INT(type));
}
static int Color_channel_set(ColorObject *self, PyObject *value, void *type)
{
- return Color_ass_item(self, GET_INT_FROM_POINTER(type), value);
+ return Color_ass_item(self, POINTER_AS_INT(type), value);
}
/* color channel (HSV), color.h/s/v */
@@ -722,7 +722,7 @@ PyDoc_STRVAR(Color_channel_hsv_v_doc, "HSV Value component in [0, 1].\n\n:type:
static PyObject *Color_channel_hsv_get(ColorObject *self, void *type)
{
float hsv[3];
- int i = GET_INT_FROM_POINTER(type);
+ int i = POINTER_AS_INT(type);
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -735,7 +735,7 @@ static PyObject *Color_channel_hsv_get(ColorObject *self, void *type)
static int Color_channel_hsv_set(ColorObject *self, PyObject *value, void *type)
{
float hsv[3];
- int i = GET_INT_FROM_POINTER(type);
+ int i = POINTER_AS_INT(type);
float f = PyFloat_AsDouble(value);
if (f == -1 && PyErr_Occurred()) {
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 31576c32497..9046bdc1aa4 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -612,12 +612,12 @@ PyDoc_STRVAR(Euler_axis_doc,
);
static PyObject *Euler_axis_get(EulerObject *self, void *type)
{
- return Euler_item(self, GET_INT_FROM_POINTER(type));
+ return Euler_item(self, POINTER_AS_INT(type));
}
static int Euler_axis_set(EulerObject *self, PyObject *value, void *type)
{
- return Euler_ass_item(self, GET_INT_FROM_POINTER(type), value);
+ return Euler_ass_item(self, POINTER_AS_INT(type), value);
}
/* rotation order */
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 48c18dd20c1..bf603502ec2 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -972,12 +972,12 @@ PyDoc_STRVAR(Quaternion_axis_doc,
);
static PyObject *Quaternion_axis_get(QuaternionObject *self, void *type)
{
- return Quaternion_item(self, GET_INT_FROM_POINTER(type));
+ return Quaternion_item(self, POINTER_AS_INT(type));
}
static int Quaternion_axis_set(QuaternionObject *self, PyObject *value, void *type)
{
- return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value);
+ return Quaternion_ass_item(self, POINTER_AS_INT(type), value);
}
PyDoc_STRVAR(Quaternion_magnitude_doc,
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index c203ac2bd05..e7776f836aa 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -2132,12 +2132,12 @@ PyDoc_STRVAR(Vector_axis_w_doc, "Vector W axis (4D Vectors only).\n\n:type: floa
static PyObject *Vector_axis_get(VectorObject *self, void *type)
{
- return vector_item_internal(self, GET_INT_FROM_POINTER(type), true);
+ return vector_item_internal(self, POINTER_AS_INT(type), true);
}
static int Vector_axis_set(VectorObject *self, PyObject *value, void *type)
{
- return vector_ass_item_internal(self, GET_INT_FROM_POINTER(type), value, true);
+ return vector_ass_item_internal(self, POINTER_AS_INT(type), value, true);
}
/* vector.length */
@@ -2280,7 +2280,7 @@ static PyObject *Vector_swizzle_get(VectorObject *self, void *closure)
/* Unpack the axes from the closure into an array. */
axis_to = 0;
- swizzleClosure = GET_INT_FROM_POINTER(closure);
+ swizzleClosure = POINTER_AS_INT(closure);
while (swizzleClosure & SWIZZLE_VALID_AXIS) {
axis_from = swizzleClosure & SWIZZLE_AXIS;
if (axis_from >= self->size) {
@@ -2327,7 +2327,7 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
/* Check that the closure can be used with this vector: even 2D vectors have
* swizzles defined for axes z and w, but they would be invalid. */
- swizzleClosure = GET_INT_FROM_POINTER(closure);
+ swizzleClosure = POINTER_AS_INT(closure);
axis_from = 0;
while (swizzleClosure & SWIZZLE_VALID_AXIS) {
@@ -2366,7 +2366,7 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
/* Copy vector contents onto swizzled axes. */
axis_from = 0;
- swizzleClosure = GET_INT_FROM_POINTER(closure);
+ swizzleClosure = POINTER_AS_INT(closure);
/* We must first copy current vec into tvec, else some org values may be lost.
* See [#31760].
@@ -2396,9 +2396,9 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
#define _SWIZZLE3(a, b, c) (_SWIZZLE2(a, b) | (((c) | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)))
#define _SWIZZLE4(a, b, c, d) (_SWIZZLE3(a, b, c) | (((d) | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))
-#define SWIZZLE2(a, b) SET_INT_IN_POINTER(_SWIZZLE2(a, b))
-#define SWIZZLE3(a, b, c) SET_INT_IN_POINTER(_SWIZZLE3(a, b, c))
-#define SWIZZLE4(a, b, c, d) SET_INT_IN_POINTER(_SWIZZLE4(a, b, c, d))
+#define SWIZZLE2(a, b) POINTER_FROM_INT(_SWIZZLE2(a, b))
+#define SWIZZLE3(a, b, c) POINTER_FROM_INT(_SWIZZLE3(a, b, c))
+#define SWIZZLE4(a, b, c, d) POINTER_FROM_INT(_SWIZZLE4(a, b, c, d))
/*****************************************************************************/
/* Python attributes get/set structure: */