code cleanup: warnings and use stdbool for bpy* funcs.
This commit is contained in:
@@ -33,12 +33,12 @@
|
||||
|
||||
#include "RNA_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "bpy_props.h"
|
||||
#include "bpy_rna.h"
|
||||
#include "bpy_util.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_idprop.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
@@ -199,7 +199,7 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
bpy_context_set(C, &gilstate);
|
||||
@@ -232,7 +232,7 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc
|
||||
bpy_context_clear(C, &gilstate);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
||||
@@ -264,21 +264,21 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
||||
|
||||
if (ret == NULL) {
|
||||
printf_func_error(py_func);
|
||||
value = FALSE;
|
||||
value = false;
|
||||
}
|
||||
else {
|
||||
value = PyLong_AsLong(ret);
|
||||
|
||||
if (value == -1 && PyErr_Occurred()) {
|
||||
printf_func_error(py_func);
|
||||
value = FALSE;
|
||||
value = false;
|
||||
}
|
||||
|
||||
Py_DECREF(ret);
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -296,7 +296,7 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
||||
@@ -324,7 +324,7 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct Propert
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
||||
@@ -358,21 +358,21 @@ static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct Propert
|
||||
printf_func_error(py_func);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
values[i] = FALSE;
|
||||
values[i] = false;
|
||||
}
|
||||
else {
|
||||
if (ret && PyC_AsArray(values, ret, len, &PyBool_Type, FALSE, "BoolVectorProperty get") < 0) {
|
||||
if (ret && PyC_AsArray(values, ret, len, &PyBool_Type, false, "BoolVectorProperty get") < 0) {
|
||||
printf_func_error(py_func);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
values[i] = FALSE;
|
||||
values[i] = false;
|
||||
}
|
||||
|
||||
Py_DECREF(ret);
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct Propert
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
||||
@@ -399,7 +399,7 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct Propert
|
||||
self = pyrna_struct_as_instance(ptr);
|
||||
PyTuple_SET_ITEM(args, 0, self);
|
||||
|
||||
py_values = PyC_FromArray(values, len, &PyBool_Type, FALSE, "BoolVectorProperty set");
|
||||
py_values = PyC_FromArray(values, len, &PyBool_Type, false, "BoolVectorProperty set");
|
||||
if (!py_values) {
|
||||
printf_func_error(py_func);
|
||||
}
|
||||
@@ -423,7 +423,7 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct Propert
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ static int bpy_prop_int_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop)
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
||||
@@ -469,7 +469,7 @@ static int bpy_prop_int_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop)
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -487,7 +487,7 @@ static void bpy_prop_int_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
||||
@@ -515,7 +515,7 @@ static void bpy_prop_int_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,7 +532,7 @@ static void bpy_prop_int_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
||||
@@ -552,7 +552,7 @@ static void bpy_prop_int_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA
|
||||
values[i] = 0;
|
||||
}
|
||||
else {
|
||||
if (ret && PyC_AsArray(values, ret, len, &PyLong_Type, FALSE, "IntVectorProperty get") < 0) {
|
||||
if (ret && PyC_AsArray(values, ret, len, &PyLong_Type, false, "IntVectorProperty get") < 0) {
|
||||
printf_func_error(py_func);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
@@ -563,7 +563,7 @@ static void bpy_prop_int_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ static void bpy_prop_int_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
||||
@@ -590,7 +590,7 @@ static void bpy_prop_int_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA
|
||||
self = pyrna_struct_as_instance(ptr);
|
||||
PyTuple_SET_ITEM(args, 0, self);
|
||||
|
||||
py_values = PyC_FromArray(values, len, &PyLong_Type, FALSE, "IntVectorProperty set");
|
||||
py_values = PyC_FromArray(values, len, &PyLong_Type, false, "IntVectorProperty set");
|
||||
if (!py_values) {
|
||||
printf_func_error(py_func);
|
||||
}
|
||||
@@ -614,7 +614,7 @@ static void bpy_prop_int_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,7 +631,7 @@ static float bpy_prop_float_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
||||
@@ -660,7 +660,7 @@ static float bpy_prop_float_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -678,7 +678,7 @@ static void bpy_prop_float_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pr
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
||||
@@ -706,7 +706,7 @@ static void bpy_prop_float_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pr
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ static void bpy_prop_float_array_get_cb(struct PointerRNA *ptr, struct PropertyR
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
||||
@@ -743,7 +743,7 @@ static void bpy_prop_float_array_get_cb(struct PointerRNA *ptr, struct PropertyR
|
||||
values[i] = 0.0f;
|
||||
}
|
||||
else {
|
||||
if (ret && PyC_AsArray(values, ret, len, &PyFloat_Type, FALSE, "FloatVectorProperty get") < 0) {
|
||||
if (ret && PyC_AsArray(values, ret, len, &PyFloat_Type, false, "FloatVectorProperty get") < 0) {
|
||||
printf_func_error(py_func);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
@@ -754,7 +754,7 @@ static void bpy_prop_float_array_get_cb(struct PointerRNA *ptr, struct PropertyR
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ static void bpy_prop_float_array_set_cb(struct PointerRNA *ptr, struct PropertyR
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
||||
@@ -781,7 +781,7 @@ static void bpy_prop_float_array_set_cb(struct PointerRNA *ptr, struct PropertyR
|
||||
self = pyrna_struct_as_instance(ptr);
|
||||
PyTuple_SET_ITEM(args, 0, self);
|
||||
|
||||
py_values = PyC_FromArray(values, len, &PyFloat_Type, FALSE, "FloatVectorProperty set");
|
||||
py_values = PyC_FromArray(values, len, &PyFloat_Type, false, "FloatVectorProperty set");
|
||||
if (!py_values) {
|
||||
printf_func_error(py_func);
|
||||
}
|
||||
@@ -805,7 +805,7 @@ static void bpy_prop_float_array_set_cb(struct PointerRNA *ptr, struct PropertyR
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ static void bpy_prop_string_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
||||
@@ -840,10 +840,12 @@ static void bpy_prop_string_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
||||
}
|
||||
else {
|
||||
Py_ssize_t length;
|
||||
char *buffer = _PyUnicode_AsStringAndSize(ret, &length);
|
||||
const char *buffer = _PyUnicode_AsStringAndSize(ret, &length);
|
||||
|
||||
if (!buffer && PyErr_Occurred()) {
|
||||
printf_func_error(py_func);
|
||||
if (!buffer) {
|
||||
if (PyErr_Occurred()) { /* should always be true */
|
||||
printf_func_error(py_func);
|
||||
}
|
||||
value[0] = '\0';
|
||||
}
|
||||
else {
|
||||
@@ -854,7 +856,7 @@ static void bpy_prop_string_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -871,7 +873,7 @@ static int bpy_prop_string_length_cb(struct PointerRNA *ptr, struct PropertyRNA
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
||||
@@ -893,7 +895,7 @@ static int bpy_prop_string_length_cb(struct PointerRNA *ptr, struct PropertyRNA
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
|
||||
return length;
|
||||
@@ -912,7 +914,7 @@ static void bpy_prop_string_set_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
||||
@@ -946,7 +948,7 @@ static void bpy_prop_string_set_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -963,7 +965,7 @@ static int bpy_prop_enum_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
||||
@@ -992,7 +994,7 @@ static int bpy_prop_enum_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -1010,7 +1012,7 @@ static void bpy_prop_enum_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pro
|
||||
BLI_assert(py_data != NULL);
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(TRUE);
|
||||
pyrna_write_set(true);
|
||||
}
|
||||
|
||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
||||
@@ -1038,7 +1040,7 @@ static void bpy_prop_enum_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pro
|
||||
}
|
||||
|
||||
if (!is_write_ok) {
|
||||
pyrna_write_set(FALSE);
|
||||
pyrna_write_set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1760,7 +1762,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, FALSE, "BoolVectorProperty(default=sequence)") < 0)
|
||||
if (pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, false, "BoolVectorProperty(default=sequence)") < 0)
|
||||
return NULL;
|
||||
|
||||
if (bpy_prop_callback_check(update_cb, "update", 2) == -1) {
|
||||
@@ -1955,7 +1957,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, FALSE, "IntVectorProperty(default=sequence)") < 0)
|
||||
if (pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, false, "IntVectorProperty(default=sequence)") < 0)
|
||||
return NULL;
|
||||
|
||||
if (bpy_prop_callback_check(update_cb, "update", 2) == -1) {
|
||||
@@ -2175,7 +2177,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, FALSE, "FloatVectorProperty(default=sequence)") < 0)
|
||||
if (pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, false, "FloatVectorProperty(default=sequence)") < 0)
|
||||
return NULL;
|
||||
|
||||
if (bpy_prop_callback_check(update_cb, "update", 2) == -1) {
|
||||
@@ -2340,7 +2342,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
|
||||
PropertyRNA *prop;
|
||||
PyObject *pyopts = NULL;
|
||||
int opts = 0;
|
||||
short is_itemf = FALSE;
|
||||
bool is_itemf = false;
|
||||
PyObject *update_cb = NULL;
|
||||
PyObject *get_cb = NULL;
|
||||
PyObject *set_cb = NULL;
|
||||
@@ -2384,7 +2386,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
is_itemf = TRUE;
|
||||
is_itemf = true;
|
||||
eitems = DummyRNA_NULL_items;
|
||||
}
|
||||
else {
|
||||
@@ -2416,7 +2418,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
|
||||
bpy_prop_callback_assign_enum(prop, get_cb, set_cb, (is_itemf ? items : NULL));
|
||||
RNA_def_property_duplicate_pointers(srna, prop);
|
||||
|
||||
if (is_itemf == FALSE) {
|
||||
if (is_itemf == false) {
|
||||
/* note: this must be postponed until after #RNA_def_property_duplicate_pointers
|
||||
* otherwise if this is a generator it may free the strings before we copy them */
|
||||
Py_DECREF(items_fast);
|
||||
|
Reference in New Issue
Block a user