code cleanup: warnings and use stdbool for bpy* funcs.
This commit is contained in:
@@ -66,7 +66,7 @@ void BPY_python_end(void);
|
|||||||
|
|
||||||
/* 2.5 UI Scripts */
|
/* 2.5 UI Scripts */
|
||||||
int BPY_filepath_exec(struct bContext *C, const char *filepath, struct ReportList *reports);
|
int BPY_filepath_exec(struct bContext *C, const char *filepath, struct ReportList *reports);
|
||||||
int BPY_text_exec(struct bContext *C, struct Text *text, struct ReportList *reports, const short do_jump);
|
int BPY_text_exec(struct bContext *C, struct Text *text, struct ReportList *reports, const bool do_jump);
|
||||||
void BPY_text_free_code(struct Text *text);
|
void BPY_text_free_code(struct Text *text);
|
||||||
void BPY_modules_update(struct bContext *C); // XXX - annoying, need this for pointers that get out of date
|
void BPY_modules_update(struct bContext *C); // XXX - annoying, need this for pointers that get out of date
|
||||||
void BPY_modules_load_user(struct bContext *C);
|
void BPY_modules_load_user(struct bContext *C);
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <frameobject.h>
|
#include <frameobject.h>
|
||||||
|
|
||||||
|
#include "BLI_utildefines.h" /* for bool */
|
||||||
|
|
||||||
#include "py_capi_utils.h"
|
#include "py_capi_utils.h"
|
||||||
|
|
||||||
/* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */
|
/* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */
|
||||||
@@ -44,7 +46,7 @@
|
|||||||
|
|
||||||
/* array utility function */
|
/* array utility function */
|
||||||
int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
|
int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
|
||||||
const PyTypeObject *type, const short is_double, const char *error_prefix)
|
const PyTypeObject *type, const bool is_double, const char *error_prefix)
|
||||||
{
|
{
|
||||||
PyObject *value_fast;
|
PyObject *value_fast;
|
||||||
Py_ssize_t value_len;
|
Py_ssize_t value_len;
|
||||||
@@ -114,7 +116,7 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
|
|||||||
|
|
||||||
/* array utility function */
|
/* array utility function */
|
||||||
PyObject *PyC_FromArray(const void *array, int length, const PyTypeObject *type,
|
PyObject *PyC_FromArray(const void *array, int length, const PyTypeObject *type,
|
||||||
const short is_double, const char *error_prefix)
|
const bool is_double, const char *error_prefix)
|
||||||
{
|
{
|
||||||
PyObject *tuple;
|
PyObject *tuple;
|
||||||
int i;
|
int i;
|
||||||
|
@@ -38,9 +38,9 @@ PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *f
|
|||||||
void PyC_FileAndNum(const char **filename, int *lineno);
|
void PyC_FileAndNum(const char **filename, int *lineno);
|
||||||
void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */
|
void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */
|
||||||
int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
|
int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
|
||||||
const PyTypeObject *type, const short is_double, const char *error_prefix);
|
const PyTypeObject *type, const bool is_double, const char *error_prefix);
|
||||||
PyObject * PyC_FromArray(const void *array, int length, const PyTypeObject *type,
|
PyObject * PyC_FromArray(const void *array, int length, const PyTypeObject *type,
|
||||||
const short is_double, const char *error_prefix);
|
const bool is_double, const char *error_prefix);
|
||||||
|
|
||||||
/* follow http://www.python.org/dev/peps/pep-0383/ */
|
/* follow http://www.python.org/dev/peps/pep-0383/ */
|
||||||
PyObject * PyC_UnicodeFromByte(const char *str);
|
PyObject * PyC_UnicodeFromByte(const char *str);
|
||||||
|
@@ -35,19 +35,19 @@
|
|||||||
#include "RNA_types.h"
|
#include "RNA_types.h"
|
||||||
#include "RNA_access.h"
|
#include "RNA_access.h"
|
||||||
|
|
||||||
#include "bpy.h"
|
#include "BLI_path_util.h"
|
||||||
#include "bpy_util.h"
|
#include "BLI_string.h"
|
||||||
|
#include "BKE_bpath.h"
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
|
#include "bpy.h"
|
||||||
|
#include "bpy_util.h"
|
||||||
#include "bpy_rna.h"
|
#include "bpy_rna.h"
|
||||||
#include "bpy_app.h"
|
#include "bpy_app.h"
|
||||||
#include "bpy_props.h"
|
#include "bpy_props.h"
|
||||||
#include "bpy_library.h"
|
#include "bpy_library.h"
|
||||||
#include "bpy_operator.h"
|
#include "bpy_operator.h"
|
||||||
|
|
||||||
#include "BLI_path_util.h"
|
|
||||||
#include "BLI_string.h"
|
|
||||||
#include "BKE_bpath.h"
|
|
||||||
#include "BLI_utildefines.h"
|
|
||||||
|
|
||||||
#include "BKE_main.h"
|
#include "BKE_main.h"
|
||||||
#include "BKE_global.h" /* XXX, G.main only */
|
#include "BKE_global.h" /* XXX, G.main only */
|
||||||
#include "BKE_blender.h"
|
#include "BKE_blender.h"
|
||||||
@@ -94,7 +94,7 @@ static int bpy_blend_paths_visit_cb(void *userdata, char *UNUSED(path_dst), cons
|
|||||||
PyObject *item = PyUnicode_DecodeFSDefault(path_src);
|
PyObject *item = PyUnicode_DecodeFSDefault(path_src);
|
||||||
PyList_Append(list, item);
|
PyList_Append(list, item);
|
||||||
Py_DECREF(item);
|
Py_DECREF(item);
|
||||||
return FALSE; /* never edits the path */
|
return false; /* never edits the path */
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(bpy_blend_paths_doc,
|
PyDoc_STRVAR(bpy_blend_paths_doc,
|
||||||
@@ -116,9 +116,9 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
|
|||||||
int flag = 0;
|
int flag = 0;
|
||||||
PyObject *list;
|
PyObject *list;
|
||||||
|
|
||||||
int absolute = FALSE;
|
int absolute = false;
|
||||||
int packed = FALSE;
|
int packed = false;
|
||||||
int local = FALSE;
|
int local = false;
|
||||||
static const char *kwlist[] = {"absolute", "packed", "local", NULL};
|
static const char *kwlist[] = {"absolute", "packed", "local", NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|iii:blend_paths",
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "|iii:blend_paths",
|
||||||
@@ -205,7 +205,7 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = BLI_get_folder_version(folder_id, (major * 100) + minor, FALSE);
|
path = BLI_get_folder_version(folder_id, (major * 100) + minor, false);
|
||||||
|
|
||||||
return PyUnicode_DecodeFSDefault(path ? path : "");
|
return PyUnicode_DecodeFSDefault(path ? path : "");
|
||||||
}
|
}
|
||||||
|
@@ -122,7 +122,7 @@ static void bpy_pydriver_update_dict(const float evaltime)
|
|||||||
void BPY_driver_reset(void)
|
void BPY_driver_reset(void)
|
||||||
{
|
{
|
||||||
PyGILState_STATE gilstate;
|
PyGILState_STATE gilstate;
|
||||||
int use_gil = TRUE; /* !PYC_INTERPRETER_ACTIVE; */
|
bool use_gil = true; /* !PYC_INTERPRETER_ACTIVE; */
|
||||||
|
|
||||||
if (use_gil)
|
if (use_gil)
|
||||||
gilstate = PyGILState_Ensure();
|
gilstate = PyGILState_Ensure();
|
||||||
@@ -175,7 +175,7 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
|
|||||||
PyObject *expr_vars; /* speed up by pre-hashing string & avoids re-converting unicode strings for every execution */
|
PyObject *expr_vars; /* speed up by pre-hashing string & avoids re-converting unicode strings for every execution */
|
||||||
PyObject *expr_code;
|
PyObject *expr_code;
|
||||||
PyGILState_STATE gilstate;
|
PyGILState_STATE gilstate;
|
||||||
int use_gil;
|
bool use_gil;
|
||||||
|
|
||||||
DriverVar *dvar;
|
DriverVar *dvar;
|
||||||
double result = 0.0; /* default return */
|
double result = 0.0; /* default return */
|
||||||
@@ -193,7 +193,7 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
|
|||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
use_gil = TRUE; /* !PYC_INTERPRETER_ACTIVE; */
|
use_gil = true; /* !PYC_INTERPRETER_ACTIVE; */
|
||||||
|
|
||||||
if (use_gil)
|
if (use_gil)
|
||||||
gilstate = PyGILState_Ensure();
|
gilstate = PyGILState_Ensure();
|
||||||
|
@@ -39,6 +39,15 @@
|
|||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
|
#include "BLI_path_util.h"
|
||||||
|
#include "BLI_fileops.h"
|
||||||
|
#include "BLI_listbase.h"
|
||||||
|
#include "BLI_math_base.h"
|
||||||
|
#include "BLI_string.h"
|
||||||
|
#include "BLI_string_utf8.h"
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
#include "BLI_threads.h"
|
||||||
|
|
||||||
#include "RNA_types.h"
|
#include "RNA_types.h"
|
||||||
|
|
||||||
#include "bpy.h"
|
#include "bpy.h"
|
||||||
@@ -52,15 +61,6 @@
|
|||||||
#include "DNA_space_types.h"
|
#include "DNA_space_types.h"
|
||||||
#include "DNA_text_types.h"
|
#include "DNA_text_types.h"
|
||||||
|
|
||||||
#include "BLI_path_util.h"
|
|
||||||
#include "BLI_fileops.h"
|
|
||||||
#include "BLI_listbase.h"
|
|
||||||
#include "BLI_math_base.h"
|
|
||||||
#include "BLI_string.h"
|
|
||||||
#include "BLI_string_utf8.h"
|
|
||||||
#include "BLI_utildefines.h"
|
|
||||||
#include "BLI_threads.h"
|
|
||||||
|
|
||||||
#include "BKE_context.h"
|
#include "BKE_context.h"
|
||||||
#include "BKE_text.h"
|
#include "BKE_text.h"
|
||||||
#include "BKE_main.h"
|
#include "BKE_main.h"
|
||||||
@@ -166,7 +166,7 @@ void BPY_text_free_code(Text *text)
|
|||||||
{
|
{
|
||||||
if (text->compiled) {
|
if (text->compiled) {
|
||||||
PyGILState_STATE gilstate;
|
PyGILState_STATE gilstate;
|
||||||
int use_gil = !PYC_INTERPRETER_ACTIVE;
|
bool use_gil = !PYC_INTERPRETER_ACTIVE;
|
||||||
|
|
||||||
if (use_gil)
|
if (use_gil)
|
||||||
gilstate = PyGILState_Ensure();
|
gilstate = PyGILState_Ensure();
|
||||||
@@ -378,8 +378,8 @@ static void python_script_error_jump_text(struct Text *text)
|
|||||||
python_script_error_jump(text->id.name + 2, &lineno, &offset);
|
python_script_error_jump(text->id.name + 2, &lineno, &offset);
|
||||||
if (lineno != -1) {
|
if (lineno != -1) {
|
||||||
/* select the line with the error */
|
/* select the line with the error */
|
||||||
txt_move_to(text, lineno - 1, INT_MAX, FALSE);
|
txt_move_to(text, lineno - 1, INT_MAX, false);
|
||||||
txt_move_to(text, lineno - 1, offset, TRUE);
|
txt_move_to(text, lineno - 1, offset, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ typedef struct {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int python_script_exec(bContext *C, const char *fn, struct Text *text,
|
static int python_script_exec(bContext *C, const char *fn, struct Text *text,
|
||||||
struct ReportList *reports, const short do_jump)
|
struct ReportList *reports, const bool do_jump)
|
||||||
{
|
{
|
||||||
Main *bmain_old = CTX_data_main(C);
|
Main *bmain_old = CTX_data_main(C);
|
||||||
PyObject *main_mod = NULL;
|
PyObject *main_mod = NULL;
|
||||||
@@ -514,11 +514,11 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
|
|||||||
/* Can run a file or text block */
|
/* Can run a file or text block */
|
||||||
int BPY_filepath_exec(bContext *C, const char *filepath, struct ReportList *reports)
|
int BPY_filepath_exec(bContext *C, const char *filepath, struct ReportList *reports)
|
||||||
{
|
{
|
||||||
return python_script_exec(C, filepath, NULL, reports, FALSE);
|
return python_script_exec(C, filepath, NULL, reports, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BPY_text_exec(bContext *C, struct Text *text, struct ReportList *reports, const short do_jump)
|
int BPY_text_exec(bContext *C, struct Text *text, struct ReportList *reports, const bool do_jump)
|
||||||
{
|
{
|
||||||
return python_script_exec(C, NULL, text, reports, do_jump);
|
return python_script_exec(C, NULL, text, reports, do_jump);
|
||||||
}
|
}
|
||||||
@@ -719,12 +719,12 @@ void BPY_modules_load_user(bContext *C)
|
|||||||
int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *result)
|
int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *result)
|
||||||
{
|
{
|
||||||
PyGILState_STATE gilstate;
|
PyGILState_STATE gilstate;
|
||||||
int use_gil = !PYC_INTERPRETER_ACTIVE;
|
bool use_gil = !PYC_INTERPRETER_ACTIVE;
|
||||||
|
|
||||||
PyObject *pyctx;
|
PyObject *pyctx;
|
||||||
PyObject *item;
|
PyObject *item;
|
||||||
PointerRNA *ptr = NULL;
|
PointerRNA *ptr = NULL;
|
||||||
int done = FALSE;
|
bool done = false;
|
||||||
|
|
||||||
if (use_gil)
|
if (use_gil)
|
||||||
gilstate = PyGILState_Ensure();
|
gilstate = PyGILState_Ensure();
|
||||||
@@ -743,7 +743,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
|
|||||||
|
|
||||||
//result->ptr = ((BPy_StructRNA *)item)->ptr;
|
//result->ptr = ((BPy_StructRNA *)item)->ptr;
|
||||||
CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
|
CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
|
||||||
done = TRUE;
|
done = true;
|
||||||
}
|
}
|
||||||
else if (PySequence_Check(item)) {
|
else if (PySequence_Check(item)) {
|
||||||
PyObject *seq_fast = PySequence_Fast(item, "bpy_context_get sequence conversion");
|
PyObject *seq_fast = PySequence_Fast(item, "bpy_context_get sequence conversion");
|
||||||
@@ -774,7 +774,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
|
|||||||
}
|
}
|
||||||
Py_DECREF(seq_fast);
|
Py_DECREF(seq_fast);
|
||||||
|
|
||||||
done = TRUE;
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,13 +31,13 @@
|
|||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
|
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "bpy_util.h"
|
#include "bpy_util.h"
|
||||||
#include "bpy.h" /* own include */
|
#include "bpy.h" /* own include */
|
||||||
|
|
||||||
#include "WM_api.h"
|
#include "WM_api.h"
|
||||||
|
|
||||||
#include "BLI_utildefines.h"
|
|
||||||
|
|
||||||
static PyObject *bpy_atexit(PyObject *UNUSED(self), PyObject *UNUSED(args), PyObject *UNUSED(kw))
|
static PyObject *bpy_atexit(PyObject *UNUSED(self), PyObject *UNUSED(args), PyObject *UNUSED(kw))
|
||||||
{
|
{
|
||||||
/* close down enough of blender at least not to crash */
|
/* close down enough of blender at least not to crash */
|
||||||
|
@@ -244,7 +244,7 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
|
|||||||
self->blo_handle = BLO_blendhandle_from_file(self->abspath, &reports);
|
self->blo_handle = BLO_blendhandle_from_file(self->abspath, &reports);
|
||||||
|
|
||||||
if (self->blo_handle == NULL) {
|
if (self->blo_handle == NULL) {
|
||||||
if (BPy_reports_to_error(&reports, PyExc_IOError, TRUE) != -1) {
|
if (BPy_reports_to_error(&reports, PyExc_IOError, true) != -1) {
|
||||||
PyErr_Format(PyExc_IOError,
|
PyErr_Format(PyExc_IOError,
|
||||||
"load: %s failed to open blend file",
|
"load: %s failed to open blend file",
|
||||||
self->abspath);
|
self->abspath);
|
||||||
|
@@ -35,6 +35,9 @@
|
|||||||
|
|
||||||
#include "RNA_types.h"
|
#include "RNA_types.h"
|
||||||
|
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
#include "BLI_string.h"
|
||||||
|
|
||||||
#include "BPY_extern.h"
|
#include "BPY_extern.h"
|
||||||
#include "bpy_operator.h"
|
#include "bpy_operator.h"
|
||||||
#include "bpy_operator_wrap.h"
|
#include "bpy_operator_wrap.h"
|
||||||
@@ -42,9 +45,6 @@
|
|||||||
#include "bpy_util.h"
|
#include "bpy_util.h"
|
||||||
#include "../generic/bpy_internal_import.h"
|
#include "../generic/bpy_internal_import.h"
|
||||||
|
|
||||||
#include "BLI_utildefines.h"
|
|
||||||
#include "BLI_string.h"
|
|
||||||
|
|
||||||
#include "RNA_access.h"
|
#include "RNA_access.h"
|
||||||
#include "RNA_enum_types.h"
|
#include "RNA_enum_types.h"
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
|
|||||||
if (!PyArg_ParseTuple(args, "s|Os:_bpy.ops.poll", &opname, &context_dict, &context_str))
|
if (!PyArg_ParseTuple(args, "s|Os:_bpy.ops.poll", &opname, &context_dict, &context_str))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ot = WM_operatortype_find(opname, TRUE);
|
ot = WM_operatortype_find(opname, true);
|
||||||
|
|
||||||
if (ot == NULL) {
|
if (ot == NULL) {
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError,
|
||||||
@@ -147,7 +147,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
|
|||||||
|
|
||||||
/* note that context is an int, python does the conversion in this case */
|
/* note that context is an int, python does the conversion in this case */
|
||||||
int context = WM_OP_EXEC_DEFAULT;
|
int context = WM_OP_EXEC_DEFAULT;
|
||||||
int is_undo = FALSE;
|
int is_undo = false;
|
||||||
|
|
||||||
/* XXX Todo, work out a better solution for passing on context,
|
/* XXX Todo, work out a better solution for passing on context,
|
||||||
* could make a tuple from self and pack the name and Context into it... */
|
* could make a tuple from self and pack the name and Context into it... */
|
||||||
@@ -164,7 +164,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ot = WM_operatortype_find(opname, TRUE);
|
ot = WM_operatortype_find(opname, true);
|
||||||
|
|
||||||
if (ot == NULL) {
|
if (ot == NULL) {
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError,
|
||||||
@@ -209,7 +209,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
|
|||||||
CTX_py_dict_set(C, (void *)context_dict);
|
CTX_py_dict_set(C, (void *)context_dict);
|
||||||
Py_XINCREF(context_dict); /* so we done loose it */
|
Py_XINCREF(context_dict); /* so we done loose it */
|
||||||
|
|
||||||
if (WM_operator_poll_context((bContext *)C, ot, context) == FALSE) {
|
if (WM_operator_poll_context((bContext *)C, ot, context) == false) {
|
||||||
const char *msg = CTX_wm_operator_poll_msg_get(C);
|
const char *msg = CTX_wm_operator_poll_msg_get(C);
|
||||||
PyErr_Format(PyExc_RuntimeError,
|
PyErr_Format(PyExc_RuntimeError,
|
||||||
"Operator bpy.ops.%.200s.poll() %.200s",
|
"Operator bpy.ops.%.200s.poll() %.200s",
|
||||||
@@ -248,7 +248,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
error_val = BPy_reports_to_error(reports, PyExc_RuntimeError, FALSE);
|
error_val = BPy_reports_to_error(reports, PyExc_RuntimeError, false);
|
||||||
|
|
||||||
/* operator output is nice to have in the terminal/console too */
|
/* operator output is nice to have in the terminal/console too */
|
||||||
if (reports->list.first) {
|
if (reports->list.first) {
|
||||||
@@ -328,7 +328,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
|
|||||||
if (!PyArg_ParseTuple(args, "s|O!i:_bpy.ops.as_string", &opname, &PyDict_Type, &kw, &all_args))
|
if (!PyArg_ParseTuple(args, "s|O!i:_bpy.ops.as_string", &opname, &PyDict_Type, &kw, &all_args))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ot = WM_operatortype_find(opname, TRUE);
|
ot = WM_operatortype_find(opname, true);
|
||||||
|
|
||||||
if (ot == NULL) {
|
if (ot == NULL) {
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError,
|
||||||
@@ -392,7 +392,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
|
|||||||
PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument");
|
PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ot = WM_operatortype_find(opname, TRUE);
|
ot = WM_operatortype_find(opname, true);
|
||||||
if (ot == NULL) {
|
if (ot == NULL) {
|
||||||
PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname);
|
PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -408,7 +408,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
|
|||||||
|
|
||||||
pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
|
pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
|
||||||
#ifdef PYRNA_FREE_SUPPORT
|
#ifdef PYRNA_FREE_SUPPORT
|
||||||
pyrna->freeptr = TRUE;
|
pyrna->freeptr = true;
|
||||||
#endif
|
#endif
|
||||||
return (PyObject *)pyrna;
|
return (PyObject *)pyrna;
|
||||||
}
|
}
|
||||||
@@ -425,7 +425,7 @@ static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value)
|
|||||||
PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_instance() expects a string argument");
|
PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_instance() expects a string argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ot = WM_operatortype_find(opname, TRUE);
|
ot = WM_operatortype_find(opname, true);
|
||||||
if (ot == NULL) {
|
if (ot == NULL) {
|
||||||
PyErr_Format(PyExc_KeyError, "_bpy.ops.get_instance(\"%s\") not found", opname);
|
PyErr_Format(PyExc_KeyError, "_bpy.ops.get_instance(\"%s\") not found", opname);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -444,7 +444,7 @@ static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value)
|
|||||||
|
|
||||||
pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
|
pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
|
||||||
#ifdef PYRNA_FREE_SUPPORT
|
#ifdef PYRNA_FREE_SUPPORT
|
||||||
pyrna->freeptr = TRUE;
|
pyrna->freeptr = true;
|
||||||
#endif
|
#endif
|
||||||
op->ptr = &pyrna->ptr;
|
op->ptr = &pyrna->ptr;
|
||||||
|
|
||||||
|
@@ -112,7 +112,7 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
|
|||||||
if (!PyArg_ParseTuple(args, "Os:_bpy.ops.macro_define", ¯o, &opname))
|
if (!PyArg_ParseTuple(args, "Os:_bpy.ops.macro_define", ¯o, &opname))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (WM_operatortype_find(opname, TRUE) == NULL) {
|
if (WM_operatortype_find(opname, true) == NULL) {
|
||||||
PyErr_Format(PyExc_ValueError,
|
PyErr_Format(PyExc_ValueError,
|
||||||
"Macro Define: '%s' is not a valid operator id",
|
"Macro Define: '%s' is not a valid operator id",
|
||||||
opname);
|
opname);
|
||||||
@@ -123,7 +123,7 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
|
|||||||
srna = srna_from_self(macro, "Macro Define:");
|
srna = srna_from_self(macro, "Macro Define:");
|
||||||
macroname = RNA_struct_identifier(srna);
|
macroname = RNA_struct_identifier(srna);
|
||||||
|
|
||||||
ot = WM_operatortype_find(macroname, TRUE);
|
ot = WM_operatortype_find(macroname, true);
|
||||||
|
|
||||||
if (!ot) {
|
if (!ot) {
|
||||||
PyErr_Format(PyExc_ValueError,
|
PyErr_Format(PyExc_ValueError,
|
||||||
|
@@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
|
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "bpy_path.h"
|
#include "bpy_path.h"
|
||||||
|
|
||||||
#include "../generic/py_capi_utils.h"
|
#include "../generic/py_capi_utils.h"
|
||||||
|
@@ -33,12 +33,12 @@
|
|||||||
|
|
||||||
#include "RNA_types.h"
|
#include "RNA_types.h"
|
||||||
|
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "bpy_props.h"
|
#include "bpy_props.h"
|
||||||
#include "bpy_rna.h"
|
#include "bpy_rna.h"
|
||||||
#include "bpy_util.h"
|
#include "bpy_util.h"
|
||||||
|
|
||||||
#include "BLI_utildefines.h"
|
|
||||||
|
|
||||||
#include "BKE_idprop.h"
|
#include "BKE_idprop.h"
|
||||||
|
|
||||||
#include "RNA_access.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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bpy_context_set(C, &gilstate);
|
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);
|
bpy_context_clear(C, &gilstate);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
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) {
|
if (ret == NULL) {
|
||||||
printf_func_error(py_func);
|
printf_func_error(py_func);
|
||||||
value = FALSE;
|
value = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
value = PyLong_AsLong(ret);
|
value = PyLong_AsLong(ret);
|
||||||
|
|
||||||
if (value == -1 && PyErr_Occurred()) {
|
if (value == -1 && PyErr_Occurred()) {
|
||||||
printf_func_error(py_func);
|
printf_func_error(py_func);
|
||||||
value = FALSE;
|
value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(FALSE);
|
pyrna_write_set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@@ -296,7 +296,7 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *
|
|||||||
BLI_assert(py_data != NULL);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
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) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
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);
|
printf_func_error(py_func);
|
||||||
|
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
values[i] = FALSE;
|
values[i] = false;
|
||||||
}
|
}
|
||||||
else {
|
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);
|
printf_func_error(py_func);
|
||||||
|
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
values[i] = FALSE;
|
values[i] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_write_ok) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
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);
|
self = pyrna_struct_as_instance(ptr);
|
||||||
PyTuple_SET_ITEM(args, 0, self);
|
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) {
|
if (!py_values) {
|
||||||
printf_func_error(py_func);
|
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) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
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) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(FALSE);
|
pyrna_write_set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@@ -487,7 +487,7 @@ static void bpy_prop_int_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop
|
|||||||
BLI_assert(py_data != NULL);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
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) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
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;
|
values[i] = 0;
|
||||||
}
|
}
|
||||||
else {
|
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);
|
printf_func_error(py_func);
|
||||||
|
|
||||||
for (i = 0; i < len; ++i)
|
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) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
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);
|
self = pyrna_struct_as_instance(ptr);
|
||||||
PyTuple_SET_ITEM(args, 0, self);
|
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) {
|
if (!py_values) {
|
||||||
printf_func_error(py_func);
|
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) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
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) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(FALSE);
|
pyrna_write_set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@@ -678,7 +678,7 @@ static void bpy_prop_float_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pr
|
|||||||
BLI_assert(py_data != NULL);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
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) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
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;
|
values[i] = 0.0f;
|
||||||
}
|
}
|
||||||
else {
|
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);
|
printf_func_error(py_func);
|
||||||
|
|
||||||
for (i = 0; i < len; ++i)
|
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) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
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);
|
self = pyrna_struct_as_instance(ptr);
|
||||||
PyTuple_SET_ITEM(args, 0, self);
|
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) {
|
if (!py_values) {
|
||||||
printf_func_error(py_func);
|
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) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
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 {
|
else {
|
||||||
Py_ssize_t length;
|
Py_ssize_t length;
|
||||||
char *buffer = _PyUnicode_AsStringAndSize(ret, &length);
|
const char *buffer = _PyUnicode_AsStringAndSize(ret, &length);
|
||||||
|
|
||||||
if (!buffer && PyErr_Occurred()) {
|
if (!buffer) {
|
||||||
printf_func_error(py_func);
|
if (PyErr_Occurred()) { /* should always be true */
|
||||||
|
printf_func_error(py_func);
|
||||||
|
}
|
||||||
value[0] = '\0';
|
value[0] = '\0';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -854,7 +856,7 @@ static void bpy_prop_string_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_write_ok) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
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) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(FALSE);
|
pyrna_write_set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
@@ -912,7 +914,7 @@ static void bpy_prop_string_set_cb(struct PointerRNA *ptr, struct PropertyRNA *p
|
|||||||
BLI_assert(py_data != NULL);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
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) {
|
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);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_GET];
|
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) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(FALSE);
|
pyrna_write_set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@@ -1010,7 +1012,7 @@ static void bpy_prop_enum_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pro
|
|||||||
BLI_assert(py_data != NULL);
|
BLI_assert(py_data != NULL);
|
||||||
|
|
||||||
if (!is_write_ok) {
|
if (!is_write_ok) {
|
||||||
pyrna_write_set(TRUE);
|
pyrna_write_set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
py_func = py_data[BPY_DATA_CB_SLOT_SET];
|
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) {
|
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;
|
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;
|
return NULL;
|
||||||
|
|
||||||
if (bpy_prop_callback_check(update_cb, "update", 2) == -1) {
|
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;
|
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;
|
return NULL;
|
||||||
|
|
||||||
if (bpy_prop_callback_check(update_cb, "update", 2) == -1) {
|
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;
|
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;
|
return NULL;
|
||||||
|
|
||||||
if (bpy_prop_callback_check(update_cb, "update", 2) == -1) {
|
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;
|
PropertyRNA *prop;
|
||||||
PyObject *pyopts = NULL;
|
PyObject *pyopts = NULL;
|
||||||
int opts = 0;
|
int opts = 0;
|
||||||
short is_itemf = FALSE;
|
bool is_itemf = false;
|
||||||
PyObject *update_cb = NULL;
|
PyObject *update_cb = NULL;
|
||||||
PyObject *get_cb = NULL;
|
PyObject *get_cb = NULL;
|
||||||
PyObject *set_cb = NULL;
|
PyObject *set_cb = NULL;
|
||||||
@@ -2384,7 +2386,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_itemf = TRUE;
|
is_itemf = true;
|
||||||
eitems = DummyRNA_NULL_items;
|
eitems = DummyRNA_NULL_items;
|
||||||
}
|
}
|
||||||
else {
|
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));
|
bpy_prop_callback_assign_enum(prop, get_cb, set_cb, (is_itemf ? items : NULL));
|
||||||
RNA_def_property_duplicate_pointers(srna, prop);
|
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
|
/* 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 */
|
* otherwise if this is a generator it may free the strings before we copy them */
|
||||||
Py_DECREF(items_fast);
|
Py_DECREF(items_fast);
|
||||||
|
@@ -37,6 +37,12 @@
|
|||||||
|
|
||||||
#include "RNA_types.h"
|
#include "RNA_types.h"
|
||||||
|
|
||||||
|
#include "BLI_dynstr.h"
|
||||||
|
#include "BLI_string.h"
|
||||||
|
#include "BLI_listbase.h"
|
||||||
|
#include "BLI_math_rotation.h"
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "BPY_extern.h"
|
#include "BPY_extern.h"
|
||||||
|
|
||||||
#include "bpy_rna.h"
|
#include "bpy_rna.h"
|
||||||
@@ -50,12 +56,6 @@
|
|||||||
# include "MEM_guardedalloc.h"
|
# include "MEM_guardedalloc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "BLI_dynstr.h"
|
|
||||||
#include "BLI_string.h"
|
|
||||||
#include "BLI_listbase.h"
|
|
||||||
#include "BLI_math_rotation.h"
|
|
||||||
#include "BLI_utildefines.h"
|
|
||||||
|
|
||||||
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
|
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
|
||||||
# include "BLI_ghash.h"
|
# include "BLI_ghash.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -309,9 +309,9 @@ void BPY_id_release(struct ID *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_PEDANTIC_WRITE
|
#ifdef USE_PEDANTIC_WRITE
|
||||||
static short rna_disallow_writes = FALSE;
|
static bool rna_disallow_writes = false;
|
||||||
|
|
||||||
static int rna_id_write_error(PointerRNA *ptr, PyObject *key)
|
static bool rna_id_write_error(PointerRNA *ptr, PyObject *key)
|
||||||
{
|
{
|
||||||
ID *id = ptr->id.data;
|
ID *id = ptr->id.data;
|
||||||
if (id) {
|
if (id) {
|
||||||
@@ -329,30 +329,30 @@ static int rna_id_write_error(PointerRNA *ptr, PyObject *key)
|
|||||||
"%.200s, %.200s datablock, error setting %.200s.%.200s",
|
"%.200s, %.200s datablock, error setting %.200s.%.200s",
|
||||||
id->name + 2, idtype, RNA_struct_identifier(ptr->type), pyname);
|
id->name + 2, idtype, RNA_struct_identifier(ptr->type), pyname);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#endif /* USE_PEDANTIC_WRITE */
|
#endif /* USE_PEDANTIC_WRITE */
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PEDANTIC_WRITE
|
#ifdef USE_PEDANTIC_WRITE
|
||||||
int pyrna_write_check(void)
|
bool pyrna_write_check(void)
|
||||||
{
|
{
|
||||||
return !rna_disallow_writes;
|
return !rna_disallow_writes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pyrna_write_set(int val)
|
void pyrna_write_set(bool val)
|
||||||
{
|
{
|
||||||
rna_disallow_writes = !val;
|
rna_disallow_writes = !val;
|
||||||
}
|
}
|
||||||
#else /* USE_PEDANTIC_WRITE */
|
#else /* USE_PEDANTIC_WRITE */
|
||||||
int pyrna_write_check(void)
|
bool pyrna_write_check(void)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
void pyrna_write_set(int UNUSED(val))
|
void pyrna_write_set(bool UNUSED(val))
|
||||||
{
|
{
|
||||||
/* nothing */
|
/* nothing */
|
||||||
}
|
}
|
||||||
@@ -644,7 +644,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
|
RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 4, 4, mathutils_rna_matrix_cb_index, FALSE);
|
PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 4, 4, mathutils_rna_matrix_cb_index, 0);
|
||||||
Py_DECREF(ret); /* the matrix owns now */
|
Py_DECREF(ret); /* the matrix owns now */
|
||||||
ret = mat_cb; /* return the matrix instead */
|
ret = mat_cb; /* return the matrix instead */
|
||||||
}
|
}
|
||||||
@@ -655,7 +655,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
|
RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 3, 3, mathutils_rna_matrix_cb_index, FALSE);
|
PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 3, 3, mathutils_rna_matrix_cb_index, 0);
|
||||||
Py_DECREF(ret); /* the matrix owns now */
|
Py_DECREF(ret); /* the matrix owns now */
|
||||||
ret = mat_cb; /* return the matrix instead */
|
ret = mat_cb; /* return the matrix instead */
|
||||||
}
|
}
|
||||||
@@ -1123,7 +1123,7 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
{
|
{
|
||||||
EnumPropertyItem *item;
|
EnumPropertyItem *item;
|
||||||
const char *result;
|
const char *result;
|
||||||
int free = FALSE;
|
int free = false;
|
||||||
|
|
||||||
RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
|
RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
|
||||||
if (item) {
|
if (item) {
|
||||||
@@ -1202,7 +1202,7 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj
|
|||||||
{
|
{
|
||||||
EnumPropertyItem *item;
|
EnumPropertyItem *item;
|
||||||
int ret;
|
int ret;
|
||||||
int free = FALSE;
|
int free = false;
|
||||||
|
|
||||||
*r_value = 0;
|
*r_value = 0;
|
||||||
|
|
||||||
@@ -1282,7 +1282,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EnumPropertyItem *enum_item;
|
EnumPropertyItem *enum_item;
|
||||||
int free = FALSE;
|
int free = false;
|
||||||
|
|
||||||
/* don't throw error here, can't trust blender 100% to give the
|
/* don't throw error here, can't trust blender 100% to give the
|
||||||
* right values, python code should not generate error for that */
|
* right values, python code should not generate error for that */
|
||||||
@@ -1777,7 +1777,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BPy_StructRNA *param = (BPy_StructRNA *)value;
|
BPy_StructRNA *param = (BPy_StructRNA *)value;
|
||||||
int raise_error = FALSE;
|
bool raise_error = false;
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
||||||
if (flag & PROP_RNAPTR) {
|
if (flag & PROP_RNAPTR) {
|
||||||
@@ -1804,7 +1804,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
|
|||||||
*((void **)data) = param->ptr.data;
|
*((void **)data) = param->ptr.data;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
raise_error = TRUE;
|
raise_error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2195,7 +2195,7 @@ static int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *sel
|
|||||||
else {
|
else {
|
||||||
PyObject *keylib = PyTuple_GET_ITEM(key, 1);
|
PyObject *keylib = PyTuple_GET_ITEM(key, 1);
|
||||||
Library *lib;
|
Library *lib;
|
||||||
int found = FALSE;
|
bool found = false;
|
||||||
|
|
||||||
if (keylib == Py_None) {
|
if (keylib == Py_None) {
|
||||||
lib = NULL;
|
lib = NULL;
|
||||||
@@ -2232,7 +2232,7 @@ static int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *sel
|
|||||||
{
|
{
|
||||||
ID *id = itemptr.data; /* always an ID */
|
ID *id = itemptr.data; /* always an ID */
|
||||||
if (id->lib == lib && (strncmp(keyname, id->name + 2, sizeof(id->name) - 2) == 0)) {
|
if (id->lib == lib && (strncmp(keyname, id->name + 2, sizeof(id->name) - 2) == 0)) {
|
||||||
found = TRUE;
|
found = true;
|
||||||
if (r_ptr) {
|
if (r_ptr) {
|
||||||
*r_ptr = itemptr;
|
*r_ptr = itemptr;
|
||||||
}
|
}
|
||||||
@@ -2242,7 +2242,7 @@ static int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *sel
|
|||||||
RNA_PROP_END;
|
RNA_PROP_END;
|
||||||
|
|
||||||
/* we may want to fail silently as with collection.get() */
|
/* we may want to fail silently as with collection.get() */
|
||||||
if ((found == FALSE) && err_not_found) {
|
if ((found == false) && err_not_found) {
|
||||||
/* only runs for getitem access so use fixed string */
|
/* only runs for getitem access so use fixed string */
|
||||||
PyErr_SetString(PyExc_KeyError,
|
PyErr_SetString(PyExc_KeyError,
|
||||||
"bpy_prop_collection[key, lib]: not found");
|
"bpy_prop_collection[key, lib]: not found");
|
||||||
@@ -2255,7 +2255,7 @@ static int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *sel
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *self, PyObject *key,
|
static PyObject *pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *self, PyObject *key,
|
||||||
const char *err_prefix, const short err_not_found)
|
const char *err_prefix, const bool err_not_found)
|
||||||
{
|
{
|
||||||
PointerRNA ptr;
|
PointerRNA ptr;
|
||||||
const int contains = pyrna_prop_collection_subscript_str_lib_pair_ptr(self, key, err_prefix, err_not_found, &ptr);
|
const int contains = pyrna_prop_collection_subscript_str_lib_pair_ptr(self, key, err_prefix, err_not_found, &ptr);
|
||||||
@@ -2448,7 +2448,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
|
|||||||
else if (PyTuple_Check(key)) {
|
else if (PyTuple_Check(key)) {
|
||||||
/* special case, for ID datablocks we */
|
/* special case, for ID datablocks we */
|
||||||
return pyrna_prop_collection_subscript_str_lib_pair(self, key,
|
return pyrna_prop_collection_subscript_str_lib_pair(self, key,
|
||||||
"bpy_prop_collection[id, lib]", TRUE);
|
"bpy_prop_collection[id, lib]", true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
@@ -2865,7 +2865,7 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *key)
|
|||||||
if (PyTuple_Check(key)) {
|
if (PyTuple_Check(key)) {
|
||||||
/* special case, for ID datablocks we */
|
/* special case, for ID datablocks we */
|
||||||
return pyrna_prop_collection_subscript_str_lib_pair_ptr(self, key,
|
return pyrna_prop_collection_subscript_str_lib_pair_ptr(self, key,
|
||||||
"(id, lib) in bpy_prop_collection", FALSE, NULL);
|
"(id, lib) in bpy_prop_collection", false, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@@ -4205,7 +4205,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
|
|||||||
}
|
}
|
||||||
else if (PyTuple_Check(key_ob)) {
|
else if (PyTuple_Check(key_ob)) {
|
||||||
PyObject *ret = pyrna_prop_collection_subscript_str_lib_pair(self, key_ob,
|
PyObject *ret = pyrna_prop_collection_subscript_str_lib_pair(self, key_ob,
|
||||||
"bpy_prop_collection.get((id, lib))", FALSE);
|
"bpy_prop_collection.get((id, lib))", false);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -4267,12 +4267,12 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key
|
|||||||
|
|
||||||
static void foreach_attr_type(BPy_PropertyRNA *self, const char *attr,
|
static void foreach_attr_type(BPy_PropertyRNA *self, const char *attr,
|
||||||
/* values to assign */
|
/* values to assign */
|
||||||
RawPropertyType *raw_type, int *attr_tot, int *attr_signed)
|
RawPropertyType *raw_type, int *attr_tot, bool *attr_signed)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
*raw_type = PROP_RAW_UNSET;
|
*raw_type = PROP_RAW_UNSET;
|
||||||
*attr_tot = 0;
|
*attr_tot = 0;
|
||||||
*attr_signed = FALSE;
|
*attr_signed = false;
|
||||||
|
|
||||||
/* note: this is fail with zero length lists, so don't let this get caled in that case */
|
/* note: this is fail with zero length lists, so don't let this get caled in that case */
|
||||||
RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop)
|
RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop)
|
||||||
@@ -4280,7 +4280,7 @@ static void foreach_attr_type(BPy_PropertyRNA *self, const char *attr,
|
|||||||
prop = RNA_struct_find_property(&itemptr, attr);
|
prop = RNA_struct_find_property(&itemptr, attr);
|
||||||
*raw_type = RNA_property_raw_type(prop);
|
*raw_type = RNA_property_raw_type(prop);
|
||||||
*attr_tot = RNA_property_array_length(&itemptr, prop);
|
*attr_tot = RNA_property_array_length(&itemptr, prop);
|
||||||
*attr_signed = (RNA_property_subtype(prop) == PROP_UNSIGNED) ? FALSE : TRUE;
|
*attr_signed = (RNA_property_subtype(prop) == PROP_UNSIGNED) ? false : true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
RNA_PROP_END;
|
RNA_PROP_END;
|
||||||
@@ -4291,7 +4291,7 @@ static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args,
|
|||||||
|
|
||||||
/* values to assign */
|
/* values to assign */
|
||||||
const char **attr, PyObject **seq, int *tot, int *size,
|
const char **attr, PyObject **seq, int *tot, int *size,
|
||||||
RawPropertyType *raw_type, int *attr_tot, int *attr_signed
|
RawPropertyType *raw_type, int *attr_tot, bool *attr_signed
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
@@ -4299,7 +4299,8 @@ static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args,
|
|||||||
int target_tot;
|
int target_tot;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*size = *attr_tot = *attr_signed = FALSE;
|
*size = *attr_tot = 0;
|
||||||
|
*attr_signed = false;
|
||||||
*raw_type = PROP_RAW_UNSET;
|
*raw_type = PROP_RAW_UNSET;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "sO", attr, seq) || (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq))) {
|
if (!PyArg_ParseTuple(args, "sO", attr, seq) || (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq))) {
|
||||||
@@ -4344,7 +4345,7 @@ static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, const char *format)
|
static bool foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, const char *format)
|
||||||
{
|
{
|
||||||
char f = format ? *format : 'B'; /* B is assumed when not set */
|
char f = format ? *format : 'B'; /* B is assumed when not set */
|
||||||
|
|
||||||
@@ -4372,13 +4373,15 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons
|
|||||||
static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
|
static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
|
||||||
{
|
{
|
||||||
PyObject *item = NULL;
|
PyObject *item = NULL;
|
||||||
int i = 0, ok = 0, buffer_is_compat;
|
int i = 0, ok = 0;
|
||||||
|
bool buffer_is_compat;
|
||||||
void *array = NULL;
|
void *array = NULL;
|
||||||
|
|
||||||
/* get/set both take the same args currently */
|
/* get/set both take the same args currently */
|
||||||
const char *attr;
|
const char *attr;
|
||||||
PyObject *seq;
|
PyObject *seq;
|
||||||
int tot, size, attr_tot, attr_signed;
|
int tot, size, attr_tot;
|
||||||
|
bool attr_signed;
|
||||||
RawPropertyType raw_type;
|
RawPropertyType raw_type;
|
||||||
|
|
||||||
if (foreach_parse_args(self, args, &attr, &seq, &tot, &size, &raw_type, &attr_tot, &attr_signed) < 0)
|
if (foreach_parse_args(self, args, &attr, &seq, &tot, &size, &raw_type, &attr_tot, &attr_signed) < 0)
|
||||||
@@ -4390,7 +4393,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
|
|||||||
|
|
||||||
|
|
||||||
if (set) { /* get the array from python */
|
if (set) { /* get the array from python */
|
||||||
buffer_is_compat = FALSE;
|
buffer_is_compat = false;
|
||||||
if (PyObject_CheckBuffer(seq)) {
|
if (PyObject_CheckBuffer(seq)) {
|
||||||
Py_buffer buf;
|
Py_buffer buf;
|
||||||
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
|
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
|
||||||
@@ -4441,7 +4444,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buffer_is_compat = FALSE;
|
buffer_is_compat = false;
|
||||||
if (PyObject_CheckBuffer(seq)) {
|
if (PyObject_CheckBuffer(seq)) {
|
||||||
Py_buffer buf;
|
Py_buffer buf;
|
||||||
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
|
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
|
||||||
@@ -4945,7 +4948,8 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
|
|||||||
ParameterIterator iter;
|
ParameterIterator iter;
|
||||||
PropertyRNA *parm;
|
PropertyRNA *parm;
|
||||||
PyObject *ret, *item;
|
PyObject *ret, *item;
|
||||||
int i, pyargs_len, pykw_len, parms_len, ret_len, flag, err = 0, kw_tot = 0, kw_arg;
|
int i, pyargs_len, pykw_len, parms_len, ret_len, flag, err = 0, kw_tot = 0;
|
||||||
|
bool kw_arg;
|
||||||
|
|
||||||
PropertyRNA *pret_single = NULL;
|
PropertyRNA *pret_single = NULL;
|
||||||
void *retdata_single = NULL;
|
void *retdata_single = NULL;
|
||||||
@@ -5026,7 +5030,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
|
|||||||
|
|
||||||
if (i < pyargs_len) {
|
if (i < pyargs_len) {
|
||||||
item = PyTuple_GET_ITEM(args, i);
|
item = PyTuple_GET_ITEM(args, i);
|
||||||
kw_arg = FALSE;
|
kw_arg = false;
|
||||||
}
|
}
|
||||||
else if (kw != NULL) {
|
else if (kw != NULL) {
|
||||||
#if 0
|
#if 0
|
||||||
@@ -5037,7 +5041,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
|
|||||||
if (item)
|
if (item)
|
||||||
kw_tot++; /* make sure invalid keywords are not given */
|
kw_tot++; /* make sure invalid keywords are not given */
|
||||||
|
|
||||||
kw_arg = TRUE;
|
kw_arg = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
i++; /* current argument */
|
i++; /* current argument */
|
||||||
@@ -5074,7 +5078,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
|
|||||||
char error_prefix[512];
|
char error_prefix[512];
|
||||||
PyErr_Clear(); /* re-raise */
|
PyErr_Clear(); /* re-raise */
|
||||||
|
|
||||||
if (kw_arg == TRUE)
|
if (kw_arg == true)
|
||||||
BLI_snprintf(error_prefix, sizeof(error_prefix),
|
BLI_snprintf(error_prefix, sizeof(error_prefix),
|
||||||
"%.200s.%.200s(): error with keyword argument \"%.200s\" - ",
|
"%.200s.%.200s(): error with keyword argument \"%.200s\" - ",
|
||||||
RNA_struct_identifier(self_ptr->type),
|
RNA_struct_identifier(self_ptr->type),
|
||||||
@@ -5109,12 +5113,12 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
|
|||||||
DynStr *good_args = BLI_dynstr_new();
|
DynStr *good_args = BLI_dynstr_new();
|
||||||
|
|
||||||
const char *arg_name, *bad_args_str, *good_args_str;
|
const char *arg_name, *bad_args_str, *good_args_str;
|
||||||
int found = FALSE, first = TRUE;
|
bool found = false, first = true;
|
||||||
|
|
||||||
while (PyDict_Next(kw, &pos, &key, &value)) {
|
while (PyDict_Next(kw, &pos, &key, &value)) {
|
||||||
|
|
||||||
arg_name = _PyUnicode_AsString(key);
|
arg_name = _PyUnicode_AsString(key);
|
||||||
found = FALSE;
|
found = false;
|
||||||
|
|
||||||
if (arg_name == NULL) { /* unlikely the argname is not a string but ignore if it is*/
|
if (arg_name == NULL) { /* unlikely the argname is not a string but ignore if it is*/
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
@@ -5125,22 +5129,22 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
|
|||||||
for (; iter.valid; RNA_parameter_list_next(&iter)) {
|
for (; iter.valid; RNA_parameter_list_next(&iter)) {
|
||||||
parm = iter.parm;
|
parm = iter.parm;
|
||||||
if (strcmp(arg_name, RNA_property_identifier(parm)) == 0) {
|
if (strcmp(arg_name, RNA_property_identifier(parm)) == 0) {
|
||||||
found = TRUE;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_parameter_list_end(&iter);
|
RNA_parameter_list_end(&iter);
|
||||||
|
|
||||||
if (found == FALSE) {
|
if (found == false) {
|
||||||
BLI_dynstr_appendf(bad_args, first ? "%s" : ", %s", arg_name);
|
BLI_dynstr_appendf(bad_args, first ? "%s" : ", %s", arg_name);
|
||||||
first = FALSE;
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* list good args */
|
/* list good args */
|
||||||
first = TRUE;
|
first = true;
|
||||||
|
|
||||||
RNA_parameter_list_begin(&parms, &iter);
|
RNA_parameter_list_begin(&parms, &iter);
|
||||||
for (; iter.valid; RNA_parameter_list_next(&iter)) {
|
for (; iter.valid; RNA_parameter_list_next(&iter)) {
|
||||||
@@ -5149,7 +5153,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
BLI_dynstr_appendf(good_args, first ? "%s" : ", %s", RNA_property_identifier(parm));
|
BLI_dynstr_appendf(good_args, first ? "%s" : ", %s", RNA_property_identifier(parm));
|
||||||
first = FALSE;
|
first = false;
|
||||||
}
|
}
|
||||||
RNA_parameter_list_end(&iter);
|
RNA_parameter_list_end(&iter);
|
||||||
|
|
||||||
@@ -5179,7 +5183,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
|
|||||||
BKE_reports_init(&reports, RPT_STORE);
|
BKE_reports_init(&reports, RPT_STORE);
|
||||||
RNA_function_call(C, &reports, self_ptr, self_func, &parms);
|
RNA_function_call(C, &reports, self_ptr, self_func, &parms);
|
||||||
|
|
||||||
err = (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE));
|
err = (BPy_reports_to_error(&reports, PyExc_RuntimeError, true));
|
||||||
|
|
||||||
/* return value */
|
/* return value */
|
||||||
if (err != -1) {
|
if (err != -1) {
|
||||||
@@ -5242,7 +5246,7 @@ static PyObject *pyrna_func_doc_get(BPy_FunctionRNA *self, void *UNUSED(closure)
|
|||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
char *args;
|
char *args;
|
||||||
|
|
||||||
args = RNA_function_as_string_keywords(NULL, self->func, NULL, TRUE, TRUE);
|
args = RNA_function_as_string_keywords(NULL, self->func, NULL, true, true);
|
||||||
|
|
||||||
ret = PyUnicode_FromFormat("%.200s.%.200s(%.200s)\n%s",
|
ret = PyUnicode_FromFormat("%.200s.%.200s(%.200s)\n%s",
|
||||||
RNA_struct_identifier(self->ptr.type),
|
RNA_struct_identifier(self->ptr.type),
|
||||||
@@ -5974,7 +5978,7 @@ static PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self)
|
|||||||
|
|
||||||
static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *self)
|
static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *self)
|
||||||
{
|
{
|
||||||
if (self->iter.valid == FALSE) {
|
if (self->iter.valid == false) {
|
||||||
PyErr_SetString(PyExc_StopIteration, "pyrna_prop_collection_iter stop");
|
PyErr_SetString(PyExc_StopIteration, "pyrna_prop_collection_iter stop");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -6052,7 +6056,7 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
|
|||||||
FunctionRNA *func = (FunctionRNA *)link;
|
FunctionRNA *func = (FunctionRNA *)link;
|
||||||
const int flag = RNA_function_flag(func);
|
const int flag = RNA_function_flag(func);
|
||||||
if ((flag & FUNC_NO_SELF) && /* is staticmethod or classmethod */
|
if ((flag & FUNC_NO_SELF) && /* is staticmethod or classmethod */
|
||||||
(flag & FUNC_REGISTER) == FALSE) /* is not for registration */
|
(flag & FUNC_REGISTER) == false) /* is not for registration */
|
||||||
{
|
{
|
||||||
/* we may want to set the type of this later */
|
/* we may want to set the type of this later */
|
||||||
PyObject *func_py = pyrna_func_to_py(&func_ptr, func);
|
PyObject *func_py = pyrna_func_to_py(&func_ptr, func);
|
||||||
@@ -6262,7 +6266,7 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
|
|||||||
|
|
||||||
pyrna->ptr = *ptr;
|
pyrna->ptr = *ptr;
|
||||||
#ifdef PYRNA_FREE_SUPPORT
|
#ifdef PYRNA_FREE_SUPPORT
|
||||||
pyrna->freeptr = FALSE;
|
pyrna->freeptr = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_PYRNA_STRUCT_REFERENCE
|
#ifdef USE_PYRNA_STRUCT_REFERENCE
|
||||||
@@ -6342,15 +6346,15 @@ PyObject *pyrna_id_CreatePyObject(ID *id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int pyrna_id_FromPyObject(PyObject *obj, ID **id)
|
bool pyrna_id_FromPyObject(PyObject *obj, ID **id)
|
||||||
{
|
{
|
||||||
if (BPy_StructRNA_Check(obj) && (RNA_struct_is_ID(((BPy_StructRNA *)obj)->ptr.type))) {
|
if (BPy_StructRNA_Check(obj) && (RNA_struct_is_ID(((BPy_StructRNA *)obj)->ptr.type))) {
|
||||||
*id = ((BPy_StructRNA *)obj)->ptr.id.data;
|
*id = ((BPy_StructRNA *)obj)->ptr.id.data;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*id = NULL;
|
*id = NULL;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6561,7 +6565,7 @@ PyObject *BPY_rna_types(void)
|
|||||||
return (PyObject *)self;
|
return (PyObject *)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_prefix)
|
StructRNA *pyrna_struct_as_srna(PyObject *self, const bool parent, const char *error_prefix)
|
||||||
{
|
{
|
||||||
BPy_StructRNA *py_srna = NULL;
|
BPy_StructRNA *py_srna = NULL;
|
||||||
StructRNA *srna;
|
StructRNA *srna;
|
||||||
@@ -6635,7 +6639,7 @@ StructRNA *srna_from_self(PyObject *self, const char *error_prefix)
|
|||||||
PyErr_Fetch(&error_type, &error_value, &error_traceback);
|
PyErr_Fetch(&error_type, &error_value, &error_traceback);
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
|
|
||||||
srna = pyrna_struct_as_srna(self, 0, error_prefix);
|
srna = pyrna_struct_as_srna(self, false, error_prefix);
|
||||||
|
|
||||||
if (!PyErr_Occurred()) {
|
if (!PyErr_Occurred()) {
|
||||||
PyErr_Restore(error_type, error_value, error_traceback);
|
PyErr_Restore(error_type, error_value, error_traceback);
|
||||||
@@ -7051,7 +7055,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
|
|||||||
if (py_class->tp_init) {
|
if (py_class->tp_init) {
|
||||||
#ifdef USE_PEDANTIC_WRITE
|
#ifdef USE_PEDANTIC_WRITE
|
||||||
const int prev_write = rna_disallow_writes;
|
const int prev_write = rna_disallow_writes;
|
||||||
rna_disallow_writes = is_operator ? FALSE : TRUE; /* only operators can write on __init__ */
|
rna_disallow_writes = is_operator ? false : true; /* only operators can write on __init__ */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* true in most cases even when the class its self doesn't define an __init__ function. */
|
/* true in most cases even when the class its self doesn't define an __init__ function. */
|
||||||
@@ -7070,7 +7074,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
const int prev_write = rna_disallow_writes;
|
const int prev_write = rna_disallow_writes;
|
||||||
rna_disallow_writes = TRUE;
|
rna_disallow_writes = true;
|
||||||
|
|
||||||
/* 'almost' all the time calling the class isn't needed.
|
/* 'almost' all the time calling the class isn't needed.
|
||||||
* We could just do... */
|
* We could just do... */
|
||||||
@@ -7146,7 +7150,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_PEDANTIC_WRITE
|
#ifdef USE_PEDANTIC_WRITE
|
||||||
rna_disallow_writes = is_readonly ? TRUE : FALSE;
|
rna_disallow_writes = is_readonly ? true : false;
|
||||||
#endif
|
#endif
|
||||||
/* *** Main Caller *** */
|
/* *** Main Caller *** */
|
||||||
|
|
||||||
@@ -7155,7 +7159,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
|
|||||||
/* *** Done Calling *** */
|
/* *** Done Calling *** */
|
||||||
|
|
||||||
#ifdef USE_PEDANTIC_WRITE
|
#ifdef USE_PEDANTIC_WRITE
|
||||||
rna_disallow_writes = FALSE;
|
rna_disallow_writes = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RNA_parameter_list_end(&iter);
|
RNA_parameter_list_end(&iter);
|
||||||
@@ -7420,7 +7424,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* warning: gets parent classes srna, only for the register function */
|
/* warning: gets parent classes srna, only for the register function */
|
||||||
srna = pyrna_struct_as_srna(py_class, 1, "register_class(...):");
|
srna = pyrna_struct_as_srna(py_class, true, "register_class(...):");
|
||||||
if (srna == NULL)
|
if (srna == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -7456,7 +7460,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
|
|||||||
srna_new = reg(CTX_data_main(C), &reports, py_class, identifier,
|
srna_new = reg(CTX_data_main(C), &reports, py_class, identifier,
|
||||||
bpy_class_validate, bpy_class_call, bpy_class_free);
|
bpy_class_validate, bpy_class_call, bpy_class_free);
|
||||||
|
|
||||||
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
|
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* python errors validating are not converted into reports so the check above will fail.
|
/* python errors validating are not converted into reports so the check above will fail.
|
||||||
@@ -7563,7 +7567,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
srna = pyrna_struct_as_srna(py_class, 0, "unregister_class(...):");
|
srna = pyrna_struct_as_srna(py_class, false, "unregister_class(...):");
|
||||||
if (srna == NULL)
|
if (srna == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@@ -115,7 +115,7 @@ typedef struct {
|
|||||||
#endif /* !USE_PYRNA_STRUCT_REFERENCE */
|
#endif /* !USE_PYRNA_STRUCT_REFERENCE */
|
||||||
|
|
||||||
#ifdef PYRNA_FREE_SUPPORT
|
#ifdef PYRNA_FREE_SUPPORT
|
||||||
int freeptr; /* needed in some cases if ptr.data is created on the fly, free when deallocing */
|
bool freeptr; /* needed in some cases if ptr.data is created on the fly, free when deallocing */
|
||||||
#endif /* PYRNA_FREE_SUPPORT */
|
#endif /* PYRNA_FREE_SUPPORT */
|
||||||
} BPy_StructRNA;
|
} BPy_StructRNA;
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ typedef struct {
|
|||||||
#define BPy_BaseTypeRNA BPy_PropertyRNA
|
#define BPy_BaseTypeRNA BPy_PropertyRNA
|
||||||
|
|
||||||
StructRNA *srna_from_self(PyObject *self, const char *error_prefix);
|
StructRNA *srna_from_self(PyObject *self, const char *error_prefix);
|
||||||
StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_prefix);
|
StructRNA *pyrna_struct_as_srna(PyObject *self, const bool parent, const char *error_prefix);
|
||||||
|
|
||||||
void BPY_rna_init(void);
|
void BPY_rna_init(void);
|
||||||
PyObject *BPY_rna_module(void);
|
PyObject *BPY_rna_module(void);
|
||||||
@@ -178,7 +178,7 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop);
|
|||||||
|
|
||||||
/* extern'd by other modules which don't deal closely with RNA */
|
/* extern'd by other modules which don't deal closely with RNA */
|
||||||
PyObject *pyrna_id_CreatePyObject(struct ID *id);
|
PyObject *pyrna_id_CreatePyObject(struct ID *id);
|
||||||
int pyrna_id_FromPyObject(PyObject *obj, struct ID **id);
|
bool pyrna_id_FromPyObject(PyObject *obj, struct ID **id);
|
||||||
|
|
||||||
/* operators also need this to set args */
|
/* operators also need this to set args */
|
||||||
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const char *error_prefix);
|
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const char *error_prefix);
|
||||||
@@ -205,8 +205,8 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
|
|||||||
PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop);
|
PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value);
|
int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value);
|
||||||
|
|
||||||
int pyrna_write_check(void);
|
bool pyrna_write_check(void);
|
||||||
void pyrna_write_set(int val);
|
void pyrna_write_set(bool val);
|
||||||
|
|
||||||
void pyrna_invalidate(BPy_DummyPointerRNA *self);
|
void pyrna_invalidate(BPy_DummyPointerRNA *self);
|
||||||
int pyrna_struct_validity_check(BPy_StructRNA *pysrna);
|
int pyrna_struct_validity_check(BPy_StructRNA *pysrna);
|
||||||
|
@@ -222,7 +222,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
|
|||||||
result = insert_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, options);
|
result = insert_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, options);
|
||||||
MEM_freeN((void *)path_full);
|
MEM_freeN((void *)path_full);
|
||||||
|
|
||||||
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
|
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return PyBool_FromLong(result);
|
return PyBool_FromLong(result);
|
||||||
@@ -271,7 +271,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
|
|||||||
result = delete_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0);
|
result = delete_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0);
|
||||||
MEM_freeN((void *)path_full);
|
MEM_freeN((void *)path_full);
|
||||||
|
|
||||||
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
|
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return PyBool_FromLong(result);
|
return PyBool_FromLong(result);
|
||||||
@@ -313,7 +313,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
|
|||||||
|
|
||||||
result = ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index, 0, DRIVER_TYPE_PYTHON);
|
result = ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index, 0, DRIVER_TYPE_PYTHON);
|
||||||
|
|
||||||
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
|
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
@@ -390,7 +390,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
|
|||||||
|
|
||||||
MEM_freeN((void *)path_full);
|
MEM_freeN((void *)path_full);
|
||||||
|
|
||||||
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
|
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
|
WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
|
||||||
|
@@ -32,12 +32,12 @@
|
|||||||
|
|
||||||
#include "RNA_types.h"
|
#include "RNA_types.h"
|
||||||
|
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "bpy_rna.h"
|
#include "bpy_rna.h"
|
||||||
#include "bpy_rna_callback.h"
|
#include "bpy_rna_callback.h"
|
||||||
#include "bpy_util.h"
|
#include "bpy_util.h"
|
||||||
|
|
||||||
#include "BLI_utildefines.h"
|
|
||||||
|
|
||||||
#include "DNA_space_types.h"
|
#include "DNA_space_types.h"
|
||||||
#include "DNA_screen_types.h"
|
#include "DNA_screen_types.h"
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ PyObject *pyrna_callback_classmethod_add(PyObject *UNUSED(self), PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cls = PyTuple_GET_ITEM(args, 0);
|
cls = PyTuple_GET_ITEM(args, 0);
|
||||||
if (!(srna = pyrna_struct_as_srna(cls, FALSE, "handler_add"))) {
|
if (!(srna = pyrna_struct_as_srna(cls, false, "handler_add"))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cb_func = PyTuple_GET_ITEM(args, 1);
|
cb_func = PyTuple_GET_ITEM(args, 1);
|
||||||
@@ -257,7 +257,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar
|
|||||||
}
|
}
|
||||||
|
|
||||||
cls = PyTuple_GET_ITEM(args, 0);
|
cls = PyTuple_GET_ITEM(args, 0);
|
||||||
if (!(srna = pyrna_struct_as_srna(cls, FALSE, "callback_remove"))) {
|
if (!(srna = pyrna_struct_as_srna(cls, false, "callback_remove"))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
py_handle = PyTuple_GET_ITEM(args, 1);
|
py_handle = PyTuple_GET_ITEM(args, 1);
|
||||||
|
@@ -29,9 +29,13 @@
|
|||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
|
|
||||||
#include "bpy_util.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_dynstr.h"
|
#include "BLI_dynstr.h"
|
||||||
|
|
||||||
|
#include "bpy_util.h"
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
#include "BKE_report.h"
|
#include "BKE_report.h"
|
||||||
#include "BKE_context.h"
|
#include "BKE_context.h"
|
||||||
|
|
||||||
@@ -59,13 +63,13 @@ char *BPy_enum_as_string(EnumPropertyItem *item)
|
|||||||
return cstring;
|
return cstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
short BPy_reports_to_error(ReportList *reports, PyObject *exception, const short clear)
|
short BPy_reports_to_error(ReportList *reports, PyObject *exception, const bool clear)
|
||||||
{
|
{
|
||||||
char *report_str;
|
char *report_str;
|
||||||
|
|
||||||
report_str = BKE_reports_string(reports, RPT_ERROR);
|
report_str = BKE_reports_string(reports, RPT_ERROR);
|
||||||
|
|
||||||
if (clear) {
|
if (clear == true) {
|
||||||
BKE_reports_clear(reports);
|
BKE_reports_clear(reports);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ char *BPy_enum_as_string(struct EnumPropertyItem *item);
|
|||||||
#define BLANK_PYTHON_TYPE {PyVarObject_HEAD_INIT(NULL, 0) NULL}
|
#define BLANK_PYTHON_TYPE {PyVarObject_HEAD_INIT(NULL, 0) NULL}
|
||||||
|
|
||||||
/* error reporting */
|
/* error reporting */
|
||||||
short BPy_reports_to_error(struct ReportList *reports, PyObject *exception, const short clear);
|
short BPy_reports_to_error(struct ReportList *reports, PyObject *exception, const bool clear);
|
||||||
short BPy_errors_to_report(struct ReportList *reports);
|
short BPy_errors_to_report(struct ReportList *reports);
|
||||||
|
|
||||||
/* TODO - find a better solution! */
|
/* TODO - find a better solution! */
|
||||||
|
@@ -952,7 +952,7 @@ static void create_ao_raytree(MultiresBakeRender *bkr, MAOBakeData *ao_data)
|
|||||||
RayFace *face;
|
RayFace *face;
|
||||||
CCGElem **grid_data;
|
CCGElem **grid_data;
|
||||||
CCGKey key;
|
CCGKey key;
|
||||||
int num_grids, grid_size, face_side, num_faces;
|
int num_grids, grid_size /*, face_side */, num_faces;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
num_grids = hidm->getNumGrids(hidm);
|
num_grids = hidm->getNumGrids(hidm);
|
||||||
@@ -960,7 +960,7 @@ static void create_ao_raytree(MultiresBakeRender *bkr, MAOBakeData *ao_data)
|
|||||||
grid_data = hidm->getGridData(hidm);
|
grid_data = hidm->getGridData(hidm);
|
||||||
hidm->getGridKey(hidm, &key);
|
hidm->getGridKey(hidm, &key);
|
||||||
|
|
||||||
face_side = (grid_size << 1) - 1;
|
/* face_side = (grid_size << 1) - 1; */ /* UNUSED */
|
||||||
num_faces = num_grids * (grid_size - 1) * (grid_size - 1);
|
num_faces = num_grids * (grid_size - 1) * (grid_size - 1);
|
||||||
|
|
||||||
raytree = ao_data->raytree = RE_rayobject_create(bkr->raytrace_structure, num_faces, bkr->octree_resolution);
|
raytree = ao_data->raytree = RE_rayobject_create(bkr->raytrace_structure, num_faces, bkr->octree_resolution);
|
||||||
|
Reference in New Issue
Block a user