Cleanup: various non-functional changes for C++ (python, windowmanager)
- Remove redundant void, struct. - Use function style casts.
This commit is contained in:
@@ -213,14 +213,14 @@ static PyObject *bpy_flip_name(PyObject * /*self*/, PyObject *args, PyObject *kw
|
||||
// PyDoc_STRVAR(bpy_user_resource_doc[] = /* now in bpy/utils.py */
|
||||
static PyObject *bpy_user_resource(PyObject * /*self*/, PyObject *args, PyObject *kw)
|
||||
{
|
||||
const struct PyC_StringEnumItems type_items[] = {
|
||||
const PyC_StringEnumItems type_items[] = {
|
||||
{BLENDER_USER_DATAFILES, "DATAFILES"},
|
||||
{BLENDER_USER_CONFIG, "CONFIG"},
|
||||
{BLENDER_USER_SCRIPTS, "SCRIPTS"},
|
||||
{BLENDER_USER_AUTOSAVE, "AUTOSAVE"},
|
||||
{0, nullptr},
|
||||
};
|
||||
struct PyC_StringEnum type = {type_items};
|
||||
PyC_StringEnum type = {type_items};
|
||||
|
||||
const char *subdir = nullptr;
|
||||
|
||||
@@ -257,13 +257,13 @@ PyDoc_STRVAR(bpy_system_resource_doc,
|
||||
" :type path: string\n");
|
||||
static PyObject *bpy_system_resource(PyObject * /*self*/, PyObject *args, PyObject *kw)
|
||||
{
|
||||
const struct PyC_StringEnumItems type_items[] = {
|
||||
const PyC_StringEnumItems type_items[] = {
|
||||
{BLENDER_SYSTEM_DATAFILES, "DATAFILES"},
|
||||
{BLENDER_SYSTEM_SCRIPTS, "SCRIPTS"},
|
||||
{BLENDER_SYSTEM_PYTHON, "PYTHON"},
|
||||
{0, nullptr},
|
||||
};
|
||||
struct PyC_StringEnum type = {type_items};
|
||||
PyC_StringEnum type = {type_items};
|
||||
|
||||
const char *subdir = nullptr;
|
||||
|
||||
@@ -303,13 +303,13 @@ PyDoc_STRVAR(
|
||||
" :rtype: string\n");
|
||||
static PyObject *bpy_resource_path(PyObject * /*self*/, PyObject *args, PyObject *kw)
|
||||
{
|
||||
const struct PyC_StringEnumItems type_items[] = {
|
||||
const PyC_StringEnumItems type_items[] = {
|
||||
{BLENDER_RESOURCE_PATH_USER, "USER"},
|
||||
{BLENDER_RESOURCE_PATH_LOCAL, "LOCAL"},
|
||||
{BLENDER_RESOURCE_PATH_SYSTEM, "SYSTEM"},
|
||||
{0, nullptr},
|
||||
};
|
||||
struct PyC_StringEnum type = {type_items};
|
||||
PyC_StringEnum type = {type_items};
|
||||
|
||||
int major = BLENDER_VERSION / 100, minor = BLENDER_VERSION % 100;
|
||||
const char *path;
|
||||
@@ -611,7 +611,7 @@ static PyObject *bpy_import_test(const char *modname)
|
||||
return mod;
|
||||
}
|
||||
|
||||
void BPy_init_modules(struct bContext *C)
|
||||
void BPy_init_modules(bContext *C)
|
||||
{
|
||||
PointerRNA ctx_ptr;
|
||||
PyObject *mod;
|
||||
|
||||
@@ -132,7 +132,7 @@ static PyStructSequence_Desc app_info_desc = {
|
||||
ARRAY_SIZE(app_info_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *make_app_info(void)
|
||||
static PyObject *make_app_info()
|
||||
{
|
||||
PyObject *app_info;
|
||||
int pos = 0;
|
||||
@@ -339,7 +339,7 @@ PyDoc_STRVAR(bpy_app_preview_render_size_doc,
|
||||
static PyObject *bpy_app_preview_render_size_get(PyObject * /*self*/, void *closure)
|
||||
{
|
||||
return PyLong_FromLong(
|
||||
(long)UI_icon_preview_to_render_size(eIconSizes(POINTER_AS_INT(closure))));
|
||||
long(UI_icon_preview_to_render_size(eIconSizes(POINTER_AS_INT(closure)))));
|
||||
}
|
||||
|
||||
static PyObject *bpy_app_autoexec_fail_message_get(PyObject * /*self*/, void * /*closure*/)
|
||||
@@ -568,7 +568,7 @@ static PyMethodDef bpy_app_methods[] = {
|
||||
{nullptr, nullptr, 0, nullptr},
|
||||
};
|
||||
|
||||
static void py_struct_seq_getset_init(void)
|
||||
static void py_struct_seq_getset_init()
|
||||
{
|
||||
/* tricky dynamic members, not to py-spec! */
|
||||
for (PyGetSetDef *getset = bpy_app_getsets; getset->name; getset++) {
|
||||
@@ -578,7 +578,7 @@ static void py_struct_seq_getset_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void py_struct_seq_method_init(void)
|
||||
static void py_struct_seq_method_init()
|
||||
{
|
||||
for (PyMethodDef *method = bpy_app_methods; method->ml_name; method++) {
|
||||
BLI_assert_msg(method->ml_flags & METH_STATIC, "Only static methods make sense for 'bpy.app'");
|
||||
@@ -590,7 +590,7 @@ static void py_struct_seq_method_init(void)
|
||||
|
||||
/* end dynamic bpy.app */
|
||||
|
||||
PyObject *BPY_app_struct(void)
|
||||
PyObject *BPY_app_struct()
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ static PyStructSequence_Desc app_alembic_info_desc = {
|
||||
ARRAY_SIZE(app_alembic_info_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *make_alembic_info(void)
|
||||
static PyObject *make_alembic_info()
|
||||
{
|
||||
PyObject *alembic_info = PyStructSequence_New(&BlenderAppABCType);
|
||||
|
||||
@@ -75,7 +75,7 @@ static PyObject *make_alembic_info(void)
|
||||
return alembic_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_alembic_struct(void)
|
||||
PyObject *BPY_app_alembic_struct()
|
||||
{
|
||||
PyStructSequence_InitType(&BlenderAppABCType, &app_alembic_info_desc);
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ static PyStructSequence_Desc app_builtopts_info_desc = {
|
||||
ARRAY_SIZE(app_builtopts_info_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *make_builtopts_info(void)
|
||||
static PyObject *make_builtopts_info()
|
||||
{
|
||||
PyObject *builtopts_info;
|
||||
int pos = 0;
|
||||
@@ -337,7 +337,7 @@ static PyObject *make_builtopts_info(void)
|
||||
return builtopts_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_build_options_struct(void)
|
||||
PyObject *BPY_app_build_options_struct()
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ static PyStructSequence_Desc app_ffmpeg_info_desc = {
|
||||
ARRAY_SIZE(app_ffmpeg_info_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *make_ffmpeg_info(void)
|
||||
static PyObject *make_ffmpeg_info()
|
||||
{
|
||||
PyObject *ffmpeg_info;
|
||||
int pos = 0;
|
||||
@@ -118,7 +118,7 @@ static PyObject *make_ffmpeg_info(void)
|
||||
return ffmpeg_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_ffmpeg_struct(void)
|
||||
PyObject *BPY_app_ffmpeg_struct()
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "BPY_extern.h"
|
||||
|
||||
void bpy_app_generic_callback(struct Main *main,
|
||||
void bpy_app_generic_callback(Main *main,
|
||||
PointerRNA **pointers,
|
||||
const int pointers_num,
|
||||
void *arg);
|
||||
@@ -213,7 +213,7 @@ static PyTypeObject BPyPersistent_Type = {
|
||||
|
||||
static PyObject *py_cb_array[BKE_CB_EVT_TOT] = {nullptr};
|
||||
|
||||
static PyObject *make_app_cb_info(void)
|
||||
static PyObject *make_app_cb_info()
|
||||
{
|
||||
PyObject *app_cb_info;
|
||||
int pos;
|
||||
@@ -239,7 +239,7 @@ static PyObject *make_app_cb_info(void)
|
||||
return app_cb_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_handlers_struct(void)
|
||||
PyObject *BPY_app_handlers_struct()
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
@@ -344,7 +344,7 @@ static PyObject *choose_arguments(PyObject *func, PyObject *args_all, PyObject *
|
||||
}
|
||||
|
||||
/* the actual callback - not necessarily called from py */
|
||||
void bpy_app_generic_callback(struct Main * /*main*/,
|
||||
void bpy_app_generic_callback(Main * /*main*/,
|
||||
PointerRNA **pointers,
|
||||
const int pointers_num,
|
||||
void *arg)
|
||||
|
||||
@@ -75,7 +75,7 @@ static PyObject *bpy_app_icons_new_triangles(PyObject * /*self*/, PyObject *args
|
||||
memcpy(coords, PyBytes_AS_STRING(py_coords), coords_size);
|
||||
memcpy(colors, PyBytes_AS_STRING(py_colors), colors_size);
|
||||
|
||||
struct Icon_Geom *geom = static_cast<Icon_Geom *>(MEM_mallocN(sizeof(*geom), __func__));
|
||||
Icon_Geom *geom = static_cast<Icon_Geom *>(MEM_mallocN(sizeof(*geom), __func__));
|
||||
geom->coords_len = tris_len;
|
||||
geom->coords_range[0] = coords_range[0];
|
||||
geom->coords_range[1] = coords_range[1];
|
||||
@@ -113,7 +113,7 @@ static PyObject *bpy_app_icons_new_triangles_from_file(PyObject * /*self*/,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct Icon_Geom *geom = BKE_icon_geom_from_file(filepath);
|
||||
Icon_Geom *geom = BKE_icon_geom_from_file(filepath);
|
||||
if (geom == nullptr) {
|
||||
PyErr_SetString(PyExc_ValueError, "Unable to load from file");
|
||||
return nullptr;
|
||||
@@ -175,7 +175,7 @@ static PyModuleDef M_AppIcons_module_def = {
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
PyObject *BPY_app_icons_module(void)
|
||||
PyObject *BPY_app_icons_module()
|
||||
{
|
||||
PyObject *sys_modules = PyImport_GetModuleDict();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ static PyStructSequence_Desc app_ocio_info_desc = {
|
||||
ARRAY_SIZE(app_ocio_info_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *make_ocio_info(void)
|
||||
static PyObject *make_ocio_info()
|
||||
{
|
||||
PyObject *ocio_info;
|
||||
int pos = 0;
|
||||
@@ -80,7 +80,7 @@ static PyObject *make_ocio_info(void)
|
||||
return ocio_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_ocio_struct(void)
|
||||
PyObject *BPY_app_ocio_struct()
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ static PyStructSequence_Desc app_oiio_info_desc = {
|
||||
ARRAY_SIZE(app_oiio_info_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *make_oiio_info(void)
|
||||
static PyObject *make_oiio_info()
|
||||
{
|
||||
PyObject *oiio_info;
|
||||
int pos = 0;
|
||||
@@ -62,7 +62,7 @@ static PyObject *make_oiio_info(void)
|
||||
return oiio_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_oiio_struct(void)
|
||||
PyObject *BPY_app_oiio_struct()
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ static PyStructSequence_Desc app_opensubdiv_info_desc = {
|
||||
ARRAY_SIZE(app_opensubdiv_info_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *make_opensubdiv_info(void)
|
||||
static PyObject *make_opensubdiv_info()
|
||||
{
|
||||
PyObject *opensubdiv_info;
|
||||
int pos = 0;
|
||||
@@ -73,7 +73,7 @@ static PyObject *make_opensubdiv_info(void)
|
||||
return opensubdiv_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_opensubdiv_struct(void)
|
||||
PyObject *BPY_app_opensubdiv_struct()
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ static PyStructSequence_Desc app_openvdb_info_desc = {
|
||||
ARRAY_SIZE(app_openvdb_info_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *make_openvdb_info(void)
|
||||
static PyObject *make_openvdb_info()
|
||||
{
|
||||
PyObject *openvdb_info;
|
||||
int pos = 0;
|
||||
@@ -77,7 +77,7 @@ static PyObject *make_openvdb_info(void)
|
||||
return openvdb_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_openvdb_struct(void)
|
||||
PyObject *BPY_app_openvdb_struct()
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ static PyStructSequence_Desc app_sdl_info_desc = {
|
||||
ARRAY_SIZE(app_sdl_info_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *make_sdl_info(void)
|
||||
static PyObject *make_sdl_info()
|
||||
{
|
||||
PyObject *sdl_info;
|
||||
int pos = 0;
|
||||
@@ -113,7 +113,7 @@ static PyObject *make_sdl_info(void)
|
||||
return sdl_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_sdl_struct(void)
|
||||
PyObject *BPY_app_sdl_struct()
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ static PyObject *bpy_app_timers_register(PyObject * /*self*/, PyObject *args, Py
|
||||
|
||||
Py_INCREF(function);
|
||||
BLI_timer_register(
|
||||
(intptr_t)function, py_timer_execute, function, py_timer_free, first_interval, persistent);
|
||||
intptr_t(function), py_timer_execute, function, py_timer_free, first_interval, persistent);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ PyDoc_STRVAR(bpy_app_timers_unregister_doc,
|
||||
" :type function: function\n");
|
||||
static PyObject *bpy_app_timers_unregister(PyObject * /*self*/, PyObject *function)
|
||||
{
|
||||
if (!BLI_timer_unregister((intptr_t)function)) {
|
||||
if (!BLI_timer_unregister(intptr_t(function))) {
|
||||
PyErr_SetString(PyExc_ValueError, "Error: function is not registered");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ PyDoc_STRVAR(bpy_app_timers_is_registered_doc,
|
||||
" :rtype: bool\n");
|
||||
static PyObject *bpy_app_timers_is_registered(PyObject * /*self*/, PyObject *function)
|
||||
{
|
||||
const bool ret = BLI_timer_is_registered((intptr_t)function);
|
||||
const bool ret = BLI_timer_is_registered(intptr_t(function));
|
||||
return PyBool_FromLong(ret);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ static PyModuleDef M_AppTimers_module_def = {
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
PyObject *BPY_app_timers_module(void)
|
||||
PyObject *BPY_app_timers_module()
|
||||
{
|
||||
PyObject *sys_modules = PyImport_GetModuleDict();
|
||||
PyObject *mod = PyModule_Create(&M_AppTimers_module_def);
|
||||
|
||||
@@ -124,7 +124,7 @@ static void _ghashutil_keyfree(void *ptr)
|
||||
*/
|
||||
static GHash *_translations_cache = nullptr;
|
||||
|
||||
static void _clear_translations_cache(void)
|
||||
static void _clear_translations_cache()
|
||||
{
|
||||
if (_translations_cache) {
|
||||
BLI_ghash_free(_translations_cache, _ghashutil_keyfree, _ghashutil_valfree);
|
||||
@@ -421,7 +421,7 @@ static PyStructSequence_Desc app_translations_contexts_desc = {
|
||||
ARRAY_SIZE(app_translations_contexts_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *app_translations_contexts_make(void)
|
||||
static PyObject *app_translations_contexts_make()
|
||||
{
|
||||
PyObject *translations_contexts;
|
||||
BLT_i18n_contexts_descriptor *ctxt;
|
||||
@@ -837,7 +837,7 @@ static PyTypeObject BlenderAppTranslationsType = {
|
||||
/*tp_vectorcall*/ nullptr,
|
||||
};
|
||||
|
||||
PyObject *BPY_app_translations_struct(void)
|
||||
PyObject *BPY_app_translations_struct()
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
@@ -872,7 +872,7 @@ PyObject *BPY_app_translations_struct(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void BPY_app_translations_end(void)
|
||||
void BPY_app_translations_end()
|
||||
{
|
||||
/* In case the object remains in a module's name-space, see #44127. */
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
|
||||
@@ -34,7 +34,7 @@ static PyStructSequence_Desc app_usd_info_desc = {
|
||||
ARRAY_SIZE(app_usd_info_fields) - 1,
|
||||
};
|
||||
|
||||
static PyObject *make_usd_info(void)
|
||||
static PyObject *make_usd_info()
|
||||
{
|
||||
PyObject *usd_info = PyStructSequence_New(&BlenderAppUSDType);
|
||||
|
||||
@@ -76,7 +76,7 @@ static PyObject *make_usd_info(void)
|
||||
return usd_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_usd_struct(void)
|
||||
PyObject *BPY_app_usd_struct()
|
||||
{
|
||||
PyStructSequence_InitType(&BlenderAppUSDType, &app_usd_info_desc);
|
||||
|
||||
|
||||
@@ -98,13 +98,13 @@ bool BPy_errors_to_report_ex(ReportList *reports,
|
||||
/* Location (when available). */
|
||||
"Location: %s:%d",
|
||||
err_prefix,
|
||||
(int)err_str_len,
|
||||
int(err_str_len),
|
||||
err_str,
|
||||
location_filepath,
|
||||
location_line_number);
|
||||
}
|
||||
else {
|
||||
BKE_reportf(reports, RPT_ERROR, "%s: %.*s", err_prefix, (int)err_str_len, err_str);
|
||||
BKE_reportf(reports, RPT_ERROR, "%s: %.*s", err_prefix, int(err_str_len), err_str);
|
||||
}
|
||||
|
||||
/* Ensure this is _always_ printed to the output so developers don't miss exceptions. */
|
||||
|
||||
@@ -50,7 +50,7 @@ PyObject *bpy_pydriver_Dict = nullptr;
|
||||
static PyObject *bpy_pydriver_Dict__whitelist = nullptr;
|
||||
#endif
|
||||
|
||||
int bpy_pydriver_create_dict(void)
|
||||
int bpy_pydriver_create_dict()
|
||||
{
|
||||
PyObject *d, *mod;
|
||||
|
||||
@@ -192,7 +192,7 @@ static void bpy_pydriver_namespace_update_self(PathResolvedRNA *anim_rna)
|
||||
}
|
||||
}
|
||||
|
||||
static void bpy_pydriver_namespace_clear_self(void)
|
||||
static void bpy_pydriver_namespace_clear_self()
|
||||
{
|
||||
if (g_pydriver_state_prev.self) {
|
||||
PyDict_DelItem(bpy_pydriver_Dict, bpy_intern_str_self);
|
||||
@@ -201,7 +201,7 @@ static void bpy_pydriver_namespace_clear_self(void)
|
||||
}
|
||||
}
|
||||
|
||||
static PyObject *bpy_pydriver_depsgraph_as_pyobject(struct Depsgraph *depsgraph)
|
||||
static PyObject *bpy_pydriver_depsgraph_as_pyobject(Depsgraph *depsgraph)
|
||||
{
|
||||
PointerRNA depsgraph_ptr;
|
||||
RNA_pointer_create(nullptr, &RNA_Depsgraph, depsgraph, &depsgraph_ptr);
|
||||
@@ -212,7 +212,7 @@ static PyObject *bpy_pydriver_depsgraph_as_pyobject(struct Depsgraph *depsgraph)
|
||||
* Adds a variable `depsgraph` to the name-space. This can then be used to obtain evaluated
|
||||
* data-blocks, and the current view layer and scene. See #75553.
|
||||
*/
|
||||
static void bpy_pydriver_namespace_update_depsgraph(struct Depsgraph *depsgraph)
|
||||
static void bpy_pydriver_namespace_update_depsgraph(Depsgraph *depsgraph)
|
||||
{
|
||||
/* This should never happen, but it's probably better to have None in Python
|
||||
* than a nullptr-wrapping Depsgraph Python struct. */
|
||||
@@ -234,7 +234,7 @@ static void bpy_pydriver_namespace_update_depsgraph(struct Depsgraph *depsgraph)
|
||||
}
|
||||
}
|
||||
|
||||
void BPY_driver_exit(void)
|
||||
void BPY_driver_exit()
|
||||
{
|
||||
if (bpy_pydriver_Dict) { /* Free the global dict used by python-drivers. */
|
||||
PyDict_Clear(bpy_pydriver_Dict);
|
||||
@@ -257,7 +257,7 @@ void BPY_driver_exit(void)
|
||||
g_pydriver_state_prev.depsgraph = nullptr;
|
||||
}
|
||||
|
||||
void BPY_driver_reset(void)
|
||||
void BPY_driver_reset()
|
||||
{
|
||||
PyGILState_STATE gilstate;
|
||||
const bool use_gil = true; /* !PyC_IsInterpreterActive(); */
|
||||
@@ -702,10 +702,10 @@ float BPY_driver_exec(PathResolvedRNA *anim_rna,
|
||||
else {
|
||||
/* No need to worry about overflow here, values from RNA are within limits. */
|
||||
if (PyFloat_CheckExact(driver_arg)) {
|
||||
dvar->curval = (float)PyFloat_AsDouble(driver_arg);
|
||||
dvar->curval = float(PyFloat_AsDouble(driver_arg));
|
||||
}
|
||||
else if (PyLong_CheckExact(driver_arg)) {
|
||||
dvar->curval = (float)PyLong_AsLong(driver_arg);
|
||||
dvar->curval = float(PyLong_AsLong(driver_arg));
|
||||
}
|
||||
else if (PyBool_Check(driver_arg)) {
|
||||
dvar->curval = (driver_arg == Py_True);
|
||||
@@ -720,7 +720,7 @@ float BPY_driver_exec(PathResolvedRNA *anim_rna,
|
||||
{
|
||||
/* Try to get variable value. */
|
||||
const float tval = driver_get_variable_value(anim_eval_context, driver, dvar);
|
||||
driver_arg = PyFloat_FromDouble((double)tval);
|
||||
driver_arg = PyFloat_FromDouble(double(tval));
|
||||
}
|
||||
|
||||
/* Try to add to dictionary. */
|
||||
@@ -808,5 +808,5 @@ retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
return (float)result;
|
||||
return float(result);
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ void BPY_text_free_code(Text *text)
|
||||
}
|
||||
}
|
||||
|
||||
void BPY_modules_update(void)
|
||||
void BPY_modules_update()
|
||||
{
|
||||
#if 0 /* slow, this runs all the time poll, draw etc 100's of time a sec. */
|
||||
PyObject *mod = PyImport_ImportModuleLevel("bpy", nullptr, nullptr, nullptr, 0);
|
||||
@@ -229,7 +229,7 @@ void BPY_modules_update(void)
|
||||
BPY_update_rna_module();
|
||||
}
|
||||
|
||||
bContext *BPY_context_get(void)
|
||||
bContext *BPY_context_get()
|
||||
{
|
||||
return static_cast<bContext *>(bpy_context_module->ptr.data);
|
||||
}
|
||||
@@ -251,13 +251,13 @@ extern "C" PyObject *AUD_initPython(void);
|
||||
|
||||
#ifdef WITH_CYCLES
|
||||
/* defined in cycles module */
|
||||
static PyObject *CCL_initPython(void)
|
||||
static PyObject *CCL_initPython()
|
||||
{
|
||||
return (PyObject *)CCL_python_module_init();
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct _inittab bpy_internal_modules[] = {
|
||||
static _inittab bpy_internal_modules[] = {
|
||||
{"mathutils", PyInit_mathutils},
|
||||
#if 0
|
||||
{"mathutils.geometry", PyInit_mathutils_geometry},
|
||||
@@ -520,7 +520,7 @@ void BPY_python_start(bContext *C, int argc, const char **argv)
|
||||
#endif
|
||||
}
|
||||
|
||||
void BPY_python_end(void)
|
||||
void BPY_python_end()
|
||||
{
|
||||
// fprintf(stderr, "Ending Python!\n");
|
||||
PyGILState_STATE gilstate;
|
||||
@@ -592,7 +592,7 @@ void BPY_python_reset(bContext *C)
|
||||
BPY_modules_load_user(C);
|
||||
}
|
||||
|
||||
void BPY_python_use_system_env(void)
|
||||
void BPY_python_use_system_env()
|
||||
{
|
||||
BLI_assert(!Py_IsInitialized());
|
||||
py_use_system_env = true;
|
||||
@@ -958,10 +958,10 @@ bool BPY_string_is_keyword(const char *str)
|
||||
/* EVIL: define `text.c` functions here (declared in `BKE_text.h`). */
|
||||
int text_check_identifier_unicode(const uint ch)
|
||||
{
|
||||
return (ch < 255 && text_check_identifier((char)ch)) || Py_UNICODE_ISALNUM(ch);
|
||||
return (ch < 255 && text_check_identifier(char(ch))) || Py_UNICODE_ISALNUM(ch);
|
||||
}
|
||||
|
||||
int text_check_identifier_nodigit_unicode(const uint ch)
|
||||
{
|
||||
return (ch < 255 && text_check_identifier_nodigit((char)ch)) || Py_UNICODE_ISALPHA(ch);
|
||||
return (ch < 255 && text_check_identifier_nodigit(char(ch))) || Py_UNICODE_ISALPHA(ch);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
static PyObject *bpy_atexit(PyObject * /*self*/, PyObject * /*args*/, PyObject * /*kw*/)
|
||||
{
|
||||
/* close down enough of blender at least not to crash */
|
||||
struct bContext *C = BPY_context_get();
|
||||
bContext *C = BPY_context_get();
|
||||
|
||||
WM_exit_ex(C, false, false);
|
||||
|
||||
@@ -59,7 +59,7 @@ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg)
|
||||
}
|
||||
}
|
||||
|
||||
void BPY_atexit_register(void)
|
||||
void BPY_atexit_register()
|
||||
{
|
||||
/* atexit module owns this new function reference */
|
||||
BLI_assert(func_bpy_atregister == nullptr);
|
||||
@@ -68,7 +68,7 @@ void BPY_atexit_register(void)
|
||||
atexit_func_call("register", func_bpy_atregister);
|
||||
}
|
||||
|
||||
void BPY_atexit_unregister(void)
|
||||
void BPY_atexit_unregister()
|
||||
{
|
||||
BLI_assert(func_bpy_atregister != nullptr);
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ bool BPY_run_string_exec(bContext *C, const char *imports[], const char *expr)
|
||||
* in code that doesn't deal with Python data-types.
|
||||
* \{ */
|
||||
|
||||
static void run_string_handle_error(struct BPy_RunErrInfo *err_info)
|
||||
static void run_string_handle_error(BPy_RunErrInfo *err_info)
|
||||
{
|
||||
if (err_info == nullptr) {
|
||||
PyErr_Print();
|
||||
@@ -363,7 +363,7 @@ static void run_string_handle_error(struct BPy_RunErrInfo *err_info)
|
||||
bool BPY_run_string_as_number(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
struct BPy_RunErrInfo *err_info,
|
||||
BPy_RunErrInfo *err_info,
|
||||
double *r_value)
|
||||
{
|
||||
PyGILState_STATE gilstate;
|
||||
@@ -390,7 +390,7 @@ bool BPY_run_string_as_number(bContext *C,
|
||||
bool BPY_run_string_as_string_and_len(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
struct BPy_RunErrInfo *err_info,
|
||||
BPy_RunErrInfo *err_info,
|
||||
char **r_value,
|
||||
size_t *r_value_len)
|
||||
{
|
||||
@@ -415,11 +415,8 @@ bool BPY_run_string_as_string_and_len(bContext *C,
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool BPY_run_string_as_string(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
struct BPy_RunErrInfo *err_info,
|
||||
char **r_value)
|
||||
bool BPY_run_string_as_string(
|
||||
bContext *C, const char *imports[], const char *expr, BPy_RunErrInfo *err_info, char **r_value)
|
||||
{
|
||||
size_t value_dummy_len;
|
||||
return BPY_run_string_as_string_and_len(C, imports, expr, err_info, r_value, &value_dummy_len);
|
||||
@@ -428,7 +425,7 @@ bool BPY_run_string_as_string(bContext *C,
|
||||
bool BPY_run_string_as_intptr(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
struct BPy_RunErrInfo *err_info,
|
||||
BPy_RunErrInfo *err_info,
|
||||
intptr_t *r_value)
|
||||
{
|
||||
PyGILState_STATE gilstate;
|
||||
|
||||
@@ -36,7 +36,7 @@ PyObject *bpy_intern_str_self;
|
||||
PyObject *bpy_intern_str_depsgraph;
|
||||
PyObject *bpy_intern_str_unregister;
|
||||
|
||||
void bpy_intern_string_init(void)
|
||||
void bpy_intern_string_init()
|
||||
{
|
||||
uint i = 0;
|
||||
|
||||
@@ -69,7 +69,7 @@ void bpy_intern_string_init(void)
|
||||
BLI_assert(i == ARRAY_SIZE(bpy_intern_str_arr));
|
||||
}
|
||||
|
||||
void bpy_intern_string_exit(void)
|
||||
void bpy_intern_string_exit()
|
||||
{
|
||||
uint i = ARRAY_SIZE(bpy_intern_str_arr);
|
||||
while (i--) {
|
||||
|
||||
@@ -395,8 +395,7 @@ static bool bpy_lib_exit_lapp_context_items_cb(BlendfileLinkAppendContext *lapp_
|
||||
BlendfileLinkAppendContextItem *item,
|
||||
void *userdata)
|
||||
{
|
||||
struct LibExitLappContextItemsIterData *data = static_cast<LibExitLappContextItemsIterData *>(
|
||||
userdata);
|
||||
LibExitLappContextItemsIterData *data = static_cast<LibExitLappContextItemsIterData *>(userdata);
|
||||
|
||||
/* Since `bpy_lib_exit` loops over all ID types, all items in `lapp_context` end up being looped
|
||||
* over for each ID type, so when it does not match the item can simply be skipped: it either has
|
||||
@@ -579,7 +578,7 @@ PyMethodDef BPY_library_load_method_def = {
|
||||
bpy_lib_load_doc,
|
||||
};
|
||||
|
||||
int BPY_library_load_type_ready(void)
|
||||
int BPY_library_load_type_ready()
|
||||
{
|
||||
if (PyType_Ready(&bpy_lib_Type) < 0) {
|
||||
return -1;
|
||||
|
||||
@@ -66,14 +66,14 @@ static PyObject *bpy_lib_write(BPy_PropertyRNA *self, PyObject *args, PyObject *
|
||||
char filepath_abs[FILE_MAX];
|
||||
PyObject *datablocks = nullptr;
|
||||
|
||||
const struct PyC_StringEnumItems path_remap_items[] = {
|
||||
const PyC_StringEnumItems path_remap_items[] = {
|
||||
{BLO_WRITE_PATH_REMAP_NONE, "NONE"},
|
||||
{BLO_WRITE_PATH_REMAP_RELATIVE, "RELATIVE"},
|
||||
{BLO_WRITE_PATH_REMAP_RELATIVE_ALL, "RELATIVE_ALL"},
|
||||
{BLO_WRITE_PATH_REMAP_ABSOLUTE, "ABSOLUTE"},
|
||||
{0, nullptr},
|
||||
};
|
||||
struct PyC_StringEnum path_remap = {path_remap_items, BLO_WRITE_PATH_REMAP_NONE};
|
||||
PyC_StringEnum path_remap = {path_remap_items, BLO_WRITE_PATH_REMAP_NONE};
|
||||
|
||||
bool use_fake_user = false, use_compress = false;
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject * /*self*/, PyObject *args, P
|
||||
|
||||
/* NOTE: we may want to have a way to pass this in. */
|
||||
bContext *C = BPY_context_get();
|
||||
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
|
||||
wmMsgBus *mbus = CTX_wm_message_bus(C);
|
||||
wmMsgParams_RNA msg_key_params = {{0}};
|
||||
|
||||
wmMsgSubscribeValue msg_val_params = {0};
|
||||
@@ -355,7 +355,7 @@ static PyObject *bpy_msgbus_publish_rna(PyObject * /*self*/, PyObject *args, PyO
|
||||
|
||||
/* NOTE: we may want to have a way to pass this in. */
|
||||
bContext *C = BPY_context_get();
|
||||
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
|
||||
wmMsgBus *mbus = CTX_wm_message_bus(C);
|
||||
wmMsgParams_RNA msg_key_params = {{0}};
|
||||
|
||||
if (py_msgbus_rna_key_from_py(py_sub, &msg_key_params, error_prefix) == -1) {
|
||||
@@ -374,7 +374,7 @@ PyDoc_STRVAR(bpy_msgbus_clear_by_owner_doc,
|
||||
static PyObject *bpy_msgbus_clear_by_owner(PyObject * /*self*/, PyObject *py_owner)
|
||||
{
|
||||
bContext *C = BPY_context_get();
|
||||
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
|
||||
wmMsgBus *mbus = CTX_wm_message_bus(C);
|
||||
WM_msgbus_clear_by_owner(mbus, py_owner);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
@@ -407,7 +407,7 @@ static PyModuleDef _bpy_msgbus_def = {
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
PyObject *BPY_msgbus_module(void)
|
||||
PyObject *BPY_msgbus_module()
|
||||
{
|
||||
PyObject *submodule;
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ static PyModuleDef bpy_ops_module = {
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
PyObject *BPY_operator_module(void)
|
||||
PyObject *BPY_operator_module()
|
||||
{
|
||||
PyObject *submodule;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ static PyModuleDef _bpy_path_module_def = {
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
PyObject *BPyInit__bpy_path(void)
|
||||
PyObject *BPyInit__bpy_path()
|
||||
{
|
||||
PyObject *submodule;
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
* - #BPY_rna_props_clear_all does this on exit for all dynamic properties.
|
||||
*/
|
||||
struct BPyPropStore {
|
||||
struct BPyPropStore *next, *prev;
|
||||
BPyPropStore *next, *prev;
|
||||
|
||||
/**
|
||||
* Only store #PyObject types, so this member can be cast to an array and iterated over.
|
||||
@@ -151,7 +151,7 @@ struct BPyPropStore {
|
||||
};
|
||||
|
||||
#define BPY_PROP_STORE_PY_DATA_SIZE \
|
||||
(sizeof(((struct BPyPropStore *)nullptr)->py_data) / sizeof(PyObject *))
|
||||
(sizeof(((BPyPropStore *)nullptr)->py_data) / sizeof(PyObject *))
|
||||
|
||||
#define ASSIGN_PYOBJECT_INCREF(a, b) \
|
||||
{ \
|
||||
@@ -167,9 +167,9 @@ struct BPyPropStore {
|
||||
*/
|
||||
static ListBase g_bpy_prop_store_list = {nullptr, nullptr};
|
||||
|
||||
static struct BPyPropStore *bpy_prop_py_data_ensure(PropertyRNA *prop)
|
||||
static BPyPropStore *bpy_prop_py_data_ensure(PropertyRNA *prop)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
if (prop_store == nullptr) {
|
||||
prop_store = static_cast<BPyPropStore *>(MEM_callocN(sizeof(*prop_store), __func__));
|
||||
RNA_def_py_data(prop, prop_store);
|
||||
@@ -183,7 +183,7 @@ static struct BPyPropStore *bpy_prop_py_data_ensure(PropertyRNA *prop)
|
||||
*/
|
||||
static void bpy_prop_py_data_remove(PropertyRNA *prop)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
if (prop_store == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ struct BPyPropArrayLength {
|
||||
*/
|
||||
static int bpy_prop_array_length_parse(PyObject *o, void *p)
|
||||
{
|
||||
struct BPyPropArrayLength *array_len_info = static_cast<BPyPropArrayLength *>(p);
|
||||
BPyPropArrayLength *array_len_info = static_cast<BPyPropArrayLength *>(p);
|
||||
|
||||
if (PyLong_CheckExact(o)) {
|
||||
int size;
|
||||
@@ -494,7 +494,7 @@ static int bpy_prop_array_length_parse(PyObject *o, void *p)
|
||||
static int bpy_prop_array_from_py_with_dims(void *values,
|
||||
size_t values_elem_size,
|
||||
PyObject *py_values,
|
||||
const struct BPyPropArrayLength *array_len_info,
|
||||
const BPyPropArrayLength *array_len_info,
|
||||
const PyTypeObject *type,
|
||||
const char *error_str)
|
||||
{
|
||||
@@ -508,7 +508,7 @@ static int bpy_prop_array_from_py_with_dims(void *values,
|
||||
}
|
||||
|
||||
static bool bpy_prop_array_is_matrix_compatible_ex(int subtype,
|
||||
const struct BPyPropArrayLength *array_len_info)
|
||||
const BPyPropArrayLength *array_len_info)
|
||||
{
|
||||
return ((subtype == PROP_MATRIX) && (array_len_info->dims_len == 2) &&
|
||||
((array_len_info->dims[0] >= 2) && (array_len_info->dims[0] >= 4)) &&
|
||||
@@ -516,7 +516,7 @@ static bool bpy_prop_array_is_matrix_compatible_ex(int subtype,
|
||||
}
|
||||
|
||||
static bool bpy_prop_array_is_matrix_compatible(PropertyRNA *prop,
|
||||
const struct BPyPropArrayLength *array_len_info)
|
||||
const BPyPropArrayLength *array_len_info)
|
||||
{
|
||||
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
|
||||
return bpy_prop_array_is_matrix_compatible_ex(RNA_property_subtype(prop), array_len_info);
|
||||
@@ -525,8 +525,9 @@ static bool bpy_prop_array_is_matrix_compatible(PropertyRNA *prop,
|
||||
/**
|
||||
* Needed since the internal storage of matrices swaps row/column.
|
||||
*/
|
||||
static void bpy_prop_array_matrix_swap_row_column_vn_vn(
|
||||
float *values_dst, const float *values_src, const struct BPyPropArrayLength *array_len_info)
|
||||
static void bpy_prop_array_matrix_swap_row_column_vn_vn(float *values_dst,
|
||||
const float *values_src,
|
||||
const BPyPropArrayLength *array_len_info)
|
||||
{
|
||||
BLI_assert(values_dst != values_src);
|
||||
const int dim0 = array_len_info->dims[0], dim1 = array_len_info->dims[1];
|
||||
@@ -538,8 +539,8 @@ static void bpy_prop_array_matrix_swap_row_column_vn_vn(
|
||||
}
|
||||
}
|
||||
|
||||
static void bpy_prop_array_matrix_swap_row_column_vn(
|
||||
float *values, const struct BPyPropArrayLength *array_len_info)
|
||||
static void bpy_prop_array_matrix_swap_row_column_vn(float *values,
|
||||
const BPyPropArrayLength *array_len_info)
|
||||
{
|
||||
const int dim0 = array_len_info->dims[0], dim1 = array_len_info->dims[1];
|
||||
BLI_assert(dim0 <= 4 && dim1 <= 4);
|
||||
@@ -557,9 +558,9 @@ static void bpy_prop_array_matrix_swap_row_column_vn(
|
||||
* \{ */
|
||||
|
||||
/* callbacks */
|
||||
static void bpy_prop_update_fn(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop)
|
||||
static void bpy_prop_update_fn(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyGILState_STATE gilstate;
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
@@ -615,7 +616,7 @@ static void bpy_prop_update_fn(struct bContext *C, PointerRNA *ptr, PropertyRNA
|
||||
|
||||
static bool bpy_prop_boolean_get_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -659,7 +660,7 @@ static bool bpy_prop_boolean_get_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
value = false;
|
||||
}
|
||||
else {
|
||||
value = (bool)value_i;
|
||||
value = bool(value_i);
|
||||
}
|
||||
|
||||
Py_DECREF(ret);
|
||||
@@ -678,7 +679,7 @@ static bool bpy_prop_boolean_get_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
|
||||
static void bpy_prop_boolean_set_fn(PointerRNA *ptr, PropertyRNA *prop, bool value)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -734,7 +735,7 @@ static void bpy_prop_boolean_set_fn(PointerRNA *ptr, PropertyRNA *prop, bool val
|
||||
|
||||
static void bpy_prop_boolean_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, bool *values)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -804,7 +805,7 @@ static void bpy_prop_boolean_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, bo
|
||||
|
||||
static void bpy_prop_boolean_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, const bool *values)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -878,7 +879,7 @@ static void bpy_prop_boolean_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, co
|
||||
|
||||
static int bpy_prop_int_get_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -938,7 +939,7 @@ static int bpy_prop_int_get_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
|
||||
static void bpy_prop_int_set_fn(PointerRNA *ptr, PropertyRNA *prop, int value)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -994,7 +995,7 @@ static void bpy_prop_int_set_fn(PointerRNA *ptr, PropertyRNA *prop, int value)
|
||||
|
||||
static void bpy_prop_int_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, int *values)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1064,7 +1065,7 @@ static void bpy_prop_int_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, int *v
|
||||
|
||||
static void bpy_prop_int_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, const int *values)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1139,7 +1140,7 @@ static void bpy_prop_int_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, const
|
||||
|
||||
static float bpy_prop_float_get_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1199,7 +1200,7 @@ static float bpy_prop_float_get_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
|
||||
static void bpy_prop_float_set_fn(PointerRNA *ptr, PropertyRNA *prop, float value)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1255,7 +1256,7 @@ static void bpy_prop_float_set_fn(PointerRNA *ptr, PropertyRNA *prop, float valu
|
||||
|
||||
static void bpy_prop_float_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, float *values)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1329,7 +1330,7 @@ static void bpy_prop_float_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, floa
|
||||
|
||||
static void bpy_prop_float_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, const float *values)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1404,7 +1405,7 @@ static void bpy_prop_float_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, cons
|
||||
|
||||
static void bpy_prop_string_get_fn(PointerRNA *ptr, PropertyRNA *prop, char *value)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1464,7 +1465,7 @@ static void bpy_prop_string_get_fn(PointerRNA *ptr, PropertyRNA *prop, char *val
|
||||
|
||||
static int bpy_prop_string_length_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1527,7 +1528,7 @@ static int bpy_prop_string_length_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
|
||||
static void bpy_prop_string_set_fn(PointerRNA *ptr, PropertyRNA *prop, const char *value)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1635,14 +1636,14 @@ static bool bpy_prop_string_visit_fn_call(PyObject *py_func,
|
||||
return true;
|
||||
}
|
||||
|
||||
static void bpy_prop_string_visit_for_search_fn(const struct bContext *C,
|
||||
static void bpy_prop_string_visit_for_search_fn(const bContext *C,
|
||||
PointerRNA *ptr,
|
||||
PropertyRNA *prop,
|
||||
const char *edit_text,
|
||||
StringPropertySearchVisitFunc visit_fn,
|
||||
void *visit_user_data)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1653,7 +1654,7 @@ static void bpy_prop_string_visit_for_search_fn(const struct bContext *C,
|
||||
BLI_assert(prop_store != nullptr);
|
||||
|
||||
if (C) {
|
||||
bpy_context_set((struct bContext *)C, &gilstate);
|
||||
bpy_context_set((bContext *)C, &gilstate);
|
||||
}
|
||||
else {
|
||||
gilstate = PyGILState_Ensure();
|
||||
@@ -1739,7 +1740,7 @@ static void bpy_prop_string_visit_for_search_fn(const struct bContext *C,
|
||||
}
|
||||
|
||||
if (C) {
|
||||
bpy_context_clear((struct bContext *)C, &gilstate);
|
||||
bpy_context_clear((bContext *)C, &gilstate);
|
||||
}
|
||||
else {
|
||||
PyGILState_Release(gilstate);
|
||||
@@ -1754,7 +1755,7 @@ static void bpy_prop_string_visit_for_search_fn(const struct bContext *C,
|
||||
|
||||
static bool bpy_prop_pointer_poll_fn(PointerRNA *self, PointerRNA candidate, PropertyRNA *prop)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_self;
|
||||
PyObject *py_candidate;
|
||||
PyObject *py_func;
|
||||
@@ -1807,7 +1808,7 @@ static bool bpy_prop_pointer_poll_fn(PointerRNA *self, PointerRNA candidate, Pro
|
||||
|
||||
static int bpy_prop_enum_get_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1867,7 +1868,7 @@ static int bpy_prop_enum_get_fn(PointerRNA *ptr, PropertyRNA *prop)
|
||||
|
||||
static void bpy_prop_enum_set_fn(PointerRNA *ptr, PropertyRNA *prop, int value)
|
||||
{
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func;
|
||||
PyObject *args;
|
||||
PyObject *self;
|
||||
@@ -1925,7 +1926,7 @@ static void bpy_prop_enum_set_fn(PointerRNA *ptr, PropertyRNA *prop, int value)
|
||||
static bool py_long_as_int(PyObject *py_long, int *r_int)
|
||||
{
|
||||
if (PyLong_CheckExact(py_long)) {
|
||||
*r_int = (int)PyLong_AS_LONG(py_long);
|
||||
*r_int = int(PyLong_AS_LONG(py_long));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2142,13 +2143,13 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast,
|
||||
return items;
|
||||
}
|
||||
|
||||
static const EnumPropertyItem *bpy_prop_enum_itemf_fn(struct bContext *C,
|
||||
static const EnumPropertyItem *bpy_prop_enum_itemf_fn(bContext *C,
|
||||
PointerRNA *ptr,
|
||||
PropertyRNA *prop,
|
||||
bool *r_free)
|
||||
{
|
||||
PyGILState_STATE gilstate;
|
||||
struct BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
BPyPropStore *prop_store = static_cast<BPyPropStore *>(RNA_property_py_data_get(prop));
|
||||
PyObject *py_func = prop_store->py_data.enum_data.itemf_fn;
|
||||
PyObject *self = nullptr;
|
||||
PyObject *args;
|
||||
@@ -2265,7 +2266,7 @@ static void bpy_prop_callback_assign_update(PropertyRNA *prop, PyObject *update_
|
||||
{
|
||||
/* assume this is already checked for type and arg length */
|
||||
if (update_fn && update_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
RNA_def_property_update_runtime(prop, reinterpret_cast<const void *>(bpy_prop_update_fn));
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.update_fn, update_fn);
|
||||
@@ -2277,7 +2278,7 @@ static void bpy_prop_callback_assign_update(PropertyRNA *prop, PyObject *update_
|
||||
static void bpy_prop_callback_assign_pointer(PropertyRNA *prop, PyObject *poll_fn)
|
||||
{
|
||||
if (poll_fn && poll_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
RNA_def_property_poll_runtime(prop, reinterpret_cast<const void *>(bpy_prop_pointer_poll_fn));
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.pointer_data.poll_fn, poll_fn);
|
||||
@@ -2290,14 +2291,14 @@ static void bpy_prop_callback_assign_boolean(PropertyRNA *prop, PyObject *get_fn
|
||||
BooleanPropertySetFunc rna_set_fn = nullptr;
|
||||
|
||||
if (get_fn && get_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_get_fn = bpy_prop_boolean_get_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn);
|
||||
}
|
||||
|
||||
if (set_fn && set_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_set_fn = bpy_prop_boolean_set_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn);
|
||||
@@ -2314,14 +2315,14 @@ static void bpy_prop_callback_assign_boolean_array(PropertyRNA *prop,
|
||||
BooleanArrayPropertySetFunc rna_set_fn = nullptr;
|
||||
|
||||
if (get_fn && get_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_get_fn = bpy_prop_boolean_array_get_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn);
|
||||
}
|
||||
|
||||
if (set_fn && set_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_set_fn = bpy_prop_boolean_array_set_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn);
|
||||
@@ -2336,14 +2337,14 @@ static void bpy_prop_callback_assign_int(PropertyRNA *prop, PyObject *get_fn, Py
|
||||
IntPropertySetFunc rna_set_fn = nullptr;
|
||||
|
||||
if (get_fn && get_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_get_fn = bpy_prop_int_get_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn);
|
||||
}
|
||||
|
||||
if (set_fn && set_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_set_fn = bpy_prop_int_set_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn);
|
||||
@@ -2360,14 +2361,14 @@ static void bpy_prop_callback_assign_int_array(PropertyRNA *prop,
|
||||
IntArrayPropertySetFunc rna_set_fn = nullptr;
|
||||
|
||||
if (get_fn && get_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_get_fn = bpy_prop_int_array_get_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn);
|
||||
}
|
||||
|
||||
if (set_fn && set_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_set_fn = bpy_prop_int_array_set_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn);
|
||||
@@ -2382,14 +2383,14 @@ static void bpy_prop_callback_assign_float(PropertyRNA *prop, PyObject *get_fn,
|
||||
FloatPropertySetFunc rna_set_fn = nullptr;
|
||||
|
||||
if (get_fn && get_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_get_fn = bpy_prop_float_get_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn);
|
||||
}
|
||||
|
||||
if (set_fn && set_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_set_fn = bpy_prop_float_set_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn);
|
||||
@@ -2406,14 +2407,14 @@ static void bpy_prop_callback_assign_float_array(PropertyRNA *prop,
|
||||
FloatArrayPropertySetFunc rna_set_fn = nullptr;
|
||||
|
||||
if (get_fn && get_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_get_fn = bpy_prop_float_array_get_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn);
|
||||
}
|
||||
|
||||
if (set_fn && set_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_set_fn = bpy_prop_float_array_set_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn);
|
||||
@@ -2434,7 +2435,7 @@ static void bpy_prop_callback_assign_string(PropertyRNA *prop,
|
||||
StringPropertySearchFunc rna_search_fn = nullptr;
|
||||
|
||||
if (get_fn && get_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_get_fn = bpy_prop_string_get_fn;
|
||||
rna_length_fn = bpy_prop_string_length_fn;
|
||||
@@ -2442,13 +2443,13 @@ static void bpy_prop_callback_assign_string(PropertyRNA *prop,
|
||||
}
|
||||
|
||||
if (set_fn && set_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_set_fn = bpy_prop_string_set_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn);
|
||||
}
|
||||
if (search_fn) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_search_fn = bpy_prop_string_visit_for_search_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.string_data.search_fn, search_fn);
|
||||
@@ -2470,21 +2471,21 @@ static void bpy_prop_callback_assign_enum(PropertyRNA *prop,
|
||||
EnumPropertySetFunc rna_set_fn = nullptr;
|
||||
|
||||
if (get_fn && get_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_get_fn = bpy_prop_enum_get_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn);
|
||||
}
|
||||
|
||||
if (set_fn && set_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
|
||||
rna_set_fn = bpy_prop_enum_set_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn);
|
||||
}
|
||||
|
||||
if (itemf_fn && itemf_fn != Py_None) {
|
||||
struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop);
|
||||
rna_itemf_fn = bpy_prop_enum_itemf_fn;
|
||||
ASSIGN_PYOBJECT_INCREF(prop_store->py_data.enum_data.itemf_fn, itemf_fn);
|
||||
}
|
||||
@@ -2579,7 +2580,7 @@ struct BPy_PropIDParse {
|
||||
*/
|
||||
static int bpy_prop_arg_parse_id(PyObject *o, void *p)
|
||||
{
|
||||
struct BPy_PropIDParse *parse_data = static_cast<BPy_PropIDParse *>(p);
|
||||
BPy_PropIDParse *parse_data = static_cast<BPy_PropIDParse *>(p);
|
||||
StructRNA *srna = parse_data->srna;
|
||||
|
||||
if (!PyUnicode_Check(o)) {
|
||||
@@ -2614,7 +2615,7 @@ static int bpy_prop_arg_parse_id(PyObject *o, void *p)
|
||||
* Needed so #RNA_struct_property_tag_defines can be called on the `srna`.
|
||||
*/
|
||||
struct BPy_EnumProperty_Parse_WithSRNA {
|
||||
struct BPy_EnumProperty_Parse base;
|
||||
BPy_EnumProperty_Parse base;
|
||||
StructRNA *srna;
|
||||
};
|
||||
|
||||
@@ -2624,8 +2625,7 @@ struct BPy_EnumProperty_Parse_WithSRNA {
|
||||
*/
|
||||
static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p)
|
||||
{
|
||||
struct BPy_EnumProperty_Parse_WithSRNA *parse_data =
|
||||
static_cast<BPy_EnumProperty_Parse_WithSRNA *>(p);
|
||||
BPy_EnumProperty_Parse_WithSRNA *parse_data = static_cast<BPy_EnumProperty_Parse_WithSRNA *>(p);
|
||||
parse_data->base.items = RNA_struct_property_tag_defines(parse_data->srna);
|
||||
if (parse_data->base.items == nullptr) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
@@ -4717,7 +4717,7 @@ static PyMethodDef props_methods[] = {
|
||||
|
||||
static int props_visit(PyObject * /*self*/, visitproc visit, void *arg)
|
||||
{
|
||||
LISTBASE_FOREACH (struct BPyPropStore *, prop_store, &g_bpy_prop_store_list) {
|
||||
LISTBASE_FOREACH (BPyPropStore *, prop_store, &g_bpy_prop_store_list) {
|
||||
PyObject **py_data = (PyObject **)&prop_store->py_data;
|
||||
for (int i = 0; i < BPY_PROP_STORE_PY_DATA_SIZE; i++) {
|
||||
Py_VISIT(py_data[i]);
|
||||
@@ -4728,7 +4728,7 @@ static int props_visit(PyObject * /*self*/, visitproc visit, void *arg)
|
||||
|
||||
static int props_clear(PyObject * /*self*/)
|
||||
{
|
||||
LISTBASE_FOREACH (struct BPyPropStore *, prop_store, &g_bpy_prop_store_list) {
|
||||
LISTBASE_FOREACH (BPyPropStore *, prop_store, &g_bpy_prop_store_list) {
|
||||
PyObject **py_data = (PyObject **)&prop_store->py_data;
|
||||
for (int i = 0; i < BPY_PROP_STORE_PY_DATA_SIZE; i++) {
|
||||
Py_CLEAR(py_data[i]);
|
||||
@@ -4758,7 +4758,7 @@ static PyModuleDef props_module = {
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
PyObject *BPY_rna_props(void)
|
||||
PyObject *BPY_rna_props()
|
||||
{
|
||||
PyObject *submodule;
|
||||
PyObject *submodule_dict;
|
||||
@@ -4794,7 +4794,7 @@ PyObject *BPY_rna_props(void)
|
||||
return submodule;
|
||||
}
|
||||
|
||||
void BPY_rna_props_clear_all(void)
|
||||
void BPY_rna_props_clear_all()
|
||||
{
|
||||
/* Remove all user counts, so this isn't considered a leak from Python's perspective. */
|
||||
props_clear(nullptr);
|
||||
|
||||
@@ -345,7 +345,7 @@ static bool rna_id_write_error(PointerRNA *ptr, PyObject *key)
|
||||
#endif /* USE_PEDANTIC_WRITE */
|
||||
|
||||
#ifdef USE_PEDANTIC_WRITE
|
||||
bool pyrna_write_check(void)
|
||||
bool pyrna_write_check()
|
||||
{
|
||||
return !rna_disallow_writes;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ void pyrna_write_set(bool val)
|
||||
rna_disallow_writes = !val;
|
||||
}
|
||||
#else /* USE_PEDANTIC_WRITE */
|
||||
bool pyrna_write_check(void)
|
||||
bool pyrna_write_check()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1612,7 +1612,7 @@ static int pyrna_py_to_prop(
|
||||
return -1;
|
||||
}
|
||||
|
||||
int param_i = (int)param;
|
||||
int param_i = int(param);
|
||||
if (data) {
|
||||
RNA_property_int_clamp(ptr, prop, ¶m_i);
|
||||
*((int *)data) = param_i;
|
||||
@@ -2282,7 +2282,7 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s
|
||||
}
|
||||
else {
|
||||
/* No callback defined, just iterate and find the nth item. */
|
||||
const int key = (int)keynum_abs;
|
||||
const int key = int(keynum_abs);
|
||||
PyObject *result = nullptr;
|
||||
bool found = false;
|
||||
CollectionPropertyIterator iter;
|
||||
@@ -3766,7 +3766,7 @@ static PyObject *pyrna_struct_is_property_overridable_library(BPy_StructRNA *sel
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return PyBool_FromLong((long)RNA_property_overridable_get(&self->ptr, prop));
|
||||
return PyBool_FromLong(long(RNA_property_overridable_get(&self->ptr, prop)));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(pyrna_struct_property_overridable_library_set_doc,
|
||||
@@ -3797,7 +3797,7 @@ static PyObject *pyrna_struct_property_overridable_library_set(BPy_StructRNA *se
|
||||
}
|
||||
|
||||
return PyBool_FromLong(
|
||||
(long)RNA_property_overridable_library_set(&self->ptr, prop, (bool)is_overridable));
|
||||
long(RNA_property_overridable_library_set(&self->ptr, prop, bool(is_overridable))));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(pyrna_struct_path_resolve_doc,
|
||||
@@ -5221,7 +5221,7 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key
|
||||
{
|
||||
Py_ssize_t key_len_ssize;
|
||||
const char *key = PyUnicode_AsUTF8AndSize(key_ob, &key_len_ssize);
|
||||
const int key_len = (int)key_len_ssize; /* Compare with same type. */
|
||||
const int key_len = int(key_len_ssize); /* Compare with same type. */
|
||||
|
||||
char name[256], *name_ptr;
|
||||
int name_len;
|
||||
@@ -5461,22 +5461,22 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
|
||||
item = PySequence_GetItem(seq, i);
|
||||
switch (raw_type) {
|
||||
case PROP_RAW_CHAR:
|
||||
((char *)array)[i] = (char)PyLong_AsLong(item);
|
||||
((char *)array)[i] = char(PyLong_AsLong(item));
|
||||
break;
|
||||
case PROP_RAW_SHORT:
|
||||
((short *)array)[i] = (short)PyLong_AsLong(item);
|
||||
((short *)array)[i] = short(PyLong_AsLong(item));
|
||||
break;
|
||||
case PROP_RAW_INT:
|
||||
((int *)array)[i] = (int)PyLong_AsLong(item);
|
||||
((int *)array)[i] = int(PyLong_AsLong(item));
|
||||
break;
|
||||
case PROP_RAW_BOOLEAN:
|
||||
((bool *)array)[i] = (int)PyLong_AsLong(item) != 0;
|
||||
((bool *)array)[i] = int(PyLong_AsLong(item)) != 0;
|
||||
break;
|
||||
case PROP_RAW_FLOAT:
|
||||
((float *)array)[i] = (float)PyFloat_AsDouble(item);
|
||||
((float *)array)[i] = float(PyFloat_AsDouble(item));
|
||||
break;
|
||||
case PROP_RAW_DOUBLE:
|
||||
((double *)array)[i] = (double)PyFloat_AsDouble(item);
|
||||
((double *)array)[i] = double(PyFloat_AsDouble(item));
|
||||
break;
|
||||
case PROP_RAW_UNSET:
|
||||
/* Should never happen. */
|
||||
@@ -5648,7 +5648,7 @@ static PyObject *pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self,
|
||||
if (do_set) {
|
||||
for (i = 0; i < size; i++) {
|
||||
item = PySequence_GetItem(seq, i);
|
||||
((int *)array)[i] = (int)PyLong_AsLong(item);
|
||||
((int *)array)[i] = int(PyLong_AsLong(item));
|
||||
Py_DECREF(item);
|
||||
}
|
||||
|
||||
@@ -5670,7 +5670,7 @@ static PyObject *pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self,
|
||||
if (do_set) {
|
||||
for (i = 0; i < size; i++) {
|
||||
item = PySequence_GetItem(seq, i);
|
||||
((float *)array)[i] = (float)PyFloat_AsDouble(item);
|
||||
((float *)array)[i] = float(PyFloat_AsDouble(item));
|
||||
Py_DECREF(item);
|
||||
}
|
||||
|
||||
@@ -7611,7 +7611,7 @@ bool pyrna_id_CheckPyObject(PyObject *obj)
|
||||
return BPy_StructRNA_Check(obj) && RNA_struct_is_ID(((BPy_StructRNA *)obj)->ptr.type);
|
||||
}
|
||||
|
||||
void BPY_rna_init(void)
|
||||
void BPY_rna_init()
|
||||
{
|
||||
#ifdef USE_MATHUTILS /* Register mathutils callbacks, ok to run more than once. */
|
||||
mathutils_rna_array_cb_index = Mathutils_RegisterCallback(&mathutils_rna_array_cb);
|
||||
@@ -7664,7 +7664,7 @@ void BPY_rna_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void BPY_rna_exit(void)
|
||||
void BPY_rna_exit()
|
||||
{
|
||||
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
|
||||
/* This can help track down which kinds of data were not released.
|
||||
@@ -7687,7 +7687,7 @@ void BPY_rna_exit(void)
|
||||
|
||||
/* 'bpy.data' from Python. */
|
||||
static PointerRNA *rna_module_ptr = nullptr;
|
||||
PyObject *BPY_rna_module(void)
|
||||
PyObject *BPY_rna_module()
|
||||
{
|
||||
BPy_StructRNA *pyrna;
|
||||
PointerRNA ptr;
|
||||
@@ -7700,7 +7700,7 @@ PyObject *BPY_rna_module(void)
|
||||
return (PyObject *)pyrna;
|
||||
}
|
||||
|
||||
void BPY_update_rna_module(void)
|
||||
void BPY_update_rna_module()
|
||||
{
|
||||
if (rna_module_ptr) {
|
||||
#if 0
|
||||
@@ -7714,7 +7714,7 @@ void BPY_update_rna_module(void)
|
||||
#if 0
|
||||
/* This is a way we can access doc-strings for RNA types
|
||||
* without having the data-types in Blender. */
|
||||
PyObject *BPY_rna_doc(void)
|
||||
PyObject *BPY_rna_doc()
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -7744,8 +7744,7 @@ struct BPy_TypesModule_State {
|
||||
|
||||
static PyObject *bpy_types_module_getattro(PyObject *self, PyObject *pyname)
|
||||
{
|
||||
struct BPy_TypesModule_State *state = static_cast<BPy_TypesModule_State *>(
|
||||
PyModule_GetState(self));
|
||||
BPy_TypesModule_State *state = static_cast<BPy_TypesModule_State *>(PyModule_GetState(self));
|
||||
PointerRNA newptr;
|
||||
PyObject *ret;
|
||||
const char *name = PyUnicode_AsUTF8(pyname);
|
||||
@@ -7778,8 +7777,7 @@ static PyObject *bpy_types_module_getattro(PyObject *self, PyObject *pyname)
|
||||
|
||||
static PyObject *bpy_types_module_dir(PyObject *self)
|
||||
{
|
||||
struct BPy_TypesModule_State *state = static_cast<BPy_TypesModule_State *>(
|
||||
PyModule_GetState(self));
|
||||
BPy_TypesModule_State *state = static_cast<BPy_TypesModule_State *>(PyModule_GetState(self));
|
||||
PyObject *ret = PyList_New(0);
|
||||
|
||||
RNA_PROP_BEGIN (&state->ptr, itemptr, state->prop) {
|
||||
@@ -7809,7 +7807,7 @@ static PyModuleDef bpy_types_module_def = {
|
||||
/*m_base*/ PyModuleDef_HEAD_INIT,
|
||||
/*m_name*/ "bpy.types",
|
||||
/*m_doc*/ bpy_types_module_doc,
|
||||
/*m_size*/ sizeof(struct BPy_TypesModule_State),
|
||||
/*m_size*/ sizeof(BPy_TypesModule_State),
|
||||
/*m_methods*/ bpy_types_module_methods,
|
||||
/*m_slots*/ nullptr,
|
||||
/*m_traverse*/ nullptr,
|
||||
@@ -7817,10 +7815,10 @@ static PyModuleDef bpy_types_module_def = {
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
PyObject *BPY_rna_types(void)
|
||||
PyObject *BPY_rna_types()
|
||||
{
|
||||
PyObject *submodule = PyModule_Create(&bpy_types_module_def);
|
||||
struct BPy_TypesModule_State *state = static_cast<BPy_TypesModule_State *>(
|
||||
BPy_TypesModule_State *state = static_cast<BPy_TypesModule_State *>(
|
||||
PyModule_GetState(submodule));
|
||||
|
||||
RNA_blender_rna_pointer_create(&state->ptr);
|
||||
@@ -7925,7 +7923,7 @@ const PointerRNA *pyrna_struct_as_ptr_or_null(PyObject *py_obj, const StructRNA
|
||||
|
||||
int pyrna_struct_as_ptr_parse(PyObject *o, void *p)
|
||||
{
|
||||
struct BPy_StructRNA_Parse *srna_parse = static_cast<BPy_StructRNA_Parse *>(p);
|
||||
BPy_StructRNA_Parse *srna_parse = static_cast<BPy_StructRNA_Parse *>(p);
|
||||
BLI_assert(srna_parse->type != nullptr);
|
||||
srna_parse->ptr = pyrna_struct_as_ptr(o, srna_parse->type);
|
||||
if (srna_parse->ptr == nullptr) {
|
||||
@@ -7936,7 +7934,7 @@ int pyrna_struct_as_ptr_parse(PyObject *o, void *p)
|
||||
|
||||
int pyrna_struct_as_ptr_or_null_parse(PyObject *o, void *p)
|
||||
{
|
||||
struct BPy_StructRNA_Parse *srna_parse = static_cast<BPy_StructRNA_Parse *>(p);
|
||||
BPy_StructRNA_Parse *srna_parse = static_cast<BPy_StructRNA_Parse *>(p);
|
||||
BLI_assert(srna_parse->type != nullptr);
|
||||
srna_parse->ptr = pyrna_struct_as_ptr_or_null(o, srna_parse->type);
|
||||
if (srna_parse->ptr == nullptr) {
|
||||
@@ -8793,7 +8791,7 @@ static void bpy_class_free(void *pyob_ptr)
|
||||
PyGILState_Release(gilstate);
|
||||
}
|
||||
|
||||
void pyrna_alloc_types(void)
|
||||
void pyrna_alloc_types()
|
||||
{
|
||||
/* NOTE: This isn't essential to run on startup, since sub-types will lazy initialize.
|
||||
* But keep running in debug mode so we get immediate notification of bad class hierarchy
|
||||
@@ -8829,7 +8827,7 @@ void pyrna_alloc_types(void)
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
void pyrna_free_types(void)
|
||||
void pyrna_free_types()
|
||||
{
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
struct ItemConvertArgData;
|
||||
|
||||
typedef void (*ItemConvertFunc)(const struct ItemConvertArgData *arg, PyObject *, char *);
|
||||
typedef void (*ItemConvertFunc)(const ItemConvertArgData *arg, PyObject *, char *);
|
||||
typedef int (*ItemTypeCheckFunc)(PyObject *);
|
||||
typedef void (*RNA_SetArrayFunc)(PointerRNA *, PropertyRNA *, const char *);
|
||||
typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *);
|
||||
@@ -57,7 +57,7 @@ struct ItemConvertArgData {
|
||||
*/
|
||||
struct ItemConvert_FuncArg {
|
||||
ItemConvertFunc func;
|
||||
struct ItemConvertArgData arg;
|
||||
ItemConvertArgData arg;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -550,7 +550,7 @@ static int py_to_array(PyObject *seq,
|
||||
if (prop_is_param_dyn_alloc) {
|
||||
/* not freeing allocated mem, RNA_parameter_list_free() will do this */
|
||||
ParameterDynAlloc *param_alloc = (ParameterDynAlloc *)param_data;
|
||||
param_alloc->array_tot = (int)totitem;
|
||||
param_alloc->array_tot = int(totitem);
|
||||
|
||||
/* freeing param list will free */
|
||||
param_alloc->array = MEM_callocN(item_size * totitem, "py_to_array dyn");
|
||||
@@ -660,15 +660,15 @@ static int py_to_array_index(PyObject *py,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void py_to_float(const struct ItemConvertArgData *arg, PyObject *py, char *data)
|
||||
static void py_to_float(const ItemConvertArgData *arg, PyObject *py, char *data)
|
||||
{
|
||||
const float *range = arg->float_data.range;
|
||||
float value = (float)PyFloat_AsDouble(py);
|
||||
float value = float(PyFloat_AsDouble(py));
|
||||
CLAMP(value, range[0], range[1]);
|
||||
*(float *)data = value;
|
||||
}
|
||||
|
||||
static void py_to_int(const struct ItemConvertArgData *arg, PyObject *py, char *data)
|
||||
static void py_to_int(const ItemConvertArgData *arg, PyObject *py, char *data)
|
||||
{
|
||||
const int *range = arg->int_data.range;
|
||||
int value = PyC_Long_AsI32(py);
|
||||
@@ -676,9 +676,9 @@ static void py_to_int(const struct ItemConvertArgData *arg, PyObject *py, char *
|
||||
*(int *)data = value;
|
||||
}
|
||||
|
||||
static void py_to_bool(const struct ItemConvertArgData * /*arg*/, PyObject *py, char *data)
|
||||
static void py_to_bool(const ItemConvertArgData * /*arg*/, PyObject *py, char *data)
|
||||
{
|
||||
*(bool *)data = (bool)PyObject_IsTrue(py);
|
||||
*(bool *)data = bool(PyObject_IsTrue(py));
|
||||
}
|
||||
|
||||
static int py_float_check(PyObject *py)
|
||||
|
||||
@@ -279,8 +279,8 @@ PyObject *pyrna_callback_classmethod_add(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
if (srna == &RNA_WindowManager) {
|
||||
struct {
|
||||
struct BPy_EnumProperty_Parse space_type_enum;
|
||||
struct BPy_EnumProperty_Parse region_type_enum;
|
||||
BPy_EnumProperty_Parse space_type_enum;
|
||||
BPy_EnumProperty_Parse region_type_enum;
|
||||
} params{};
|
||||
params.space_type_enum.items = rna_enum_space_type_items;
|
||||
params.space_type_enum.value = SPACE_TYPE_ANY;
|
||||
@@ -309,8 +309,8 @@ PyObject *pyrna_callback_classmethod_add(PyObject * /*self*/, PyObject *args)
|
||||
}
|
||||
else if (RNA_struct_is_a(srna, &RNA_Space)) {
|
||||
struct {
|
||||
struct BPy_EnumProperty_Parse region_type_enum;
|
||||
struct BPy_EnumProperty_Parse event_enum;
|
||||
BPy_EnumProperty_Parse region_type_enum;
|
||||
BPy_EnumProperty_Parse event_enum;
|
||||
} params{};
|
||||
params.region_type_enum.items = rna_enum_region_type_items;
|
||||
params.event_enum.items = region_draw_mode_items;
|
||||
@@ -402,7 +402,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject * /*self*/, PyObject *args)
|
||||
else if (RNA_struct_is_a(srna, &RNA_Space)) {
|
||||
const char *error_prefix = "Space.draw_handler_remove";
|
||||
struct {
|
||||
struct BPy_EnumProperty_Parse region_type_enum;
|
||||
BPy_EnumProperty_Parse region_type_enum;
|
||||
} params{};
|
||||
params.region_type_enum.items = rna_enum_region_type_items;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ struct BPyContextTempOverride {
|
||||
ContextStore ctx_init;
|
||||
ContextStore ctx_temp;
|
||||
/** Bypass Python overrides set when calling an operator from Python. */
|
||||
struct bContext_PyState py_state;
|
||||
bContext_PyState py_state;
|
||||
/**
|
||||
* This dictionary is used to store members that don't have special handling,
|
||||
* see: #bpy_context_temp_override_extract_known_args,
|
||||
@@ -356,7 +356,7 @@ PyMethodDef BPY_rna_context_temp_override_method_def = {
|
||||
bpy_context_temp_override_doc,
|
||||
};
|
||||
|
||||
void bpy_rna_context_types_init(void)
|
||||
void bpy_rna_context_types_init()
|
||||
{
|
||||
if (PyType_Ready(&BPyContextTempOverride_Type) < 0) {
|
||||
BLI_assert_unreachable();
|
||||
|
||||
@@ -177,7 +177,7 @@ PyMethodDef BPY_rna_data_context_method_def = {
|
||||
bpy_rna_data_context_load_doc,
|
||||
};
|
||||
|
||||
int BPY_rna_data_context_type_ready(void)
|
||||
int BPY_rna_data_context_type_ready()
|
||||
{
|
||||
if (PyType_Ready(&bpy_rna_data_context_Type) < 0) {
|
||||
return -1;
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
#include "bpy_rna_driver.h" /* own include */
|
||||
|
||||
PyObject *pyrna_driver_get_variable_value(const struct AnimationEvalContext *anim_eval_context,
|
||||
struct ChannelDriver *driver,
|
||||
struct DriverVar *dvar,
|
||||
struct DriverTarget *dtar)
|
||||
PyObject *pyrna_driver_get_variable_value(const AnimationEvalContext *anim_eval_context,
|
||||
ChannelDriver *driver,
|
||||
DriverVar *dvar,
|
||||
DriverTarget *dtar)
|
||||
{
|
||||
PyObject *driver_arg = nullptr;
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -61,7 +61,7 @@ static int py_rna_gizmo_parse(PyObject *o, void *p)
|
||||
|
||||
static int py_rna_gizmo_target_id_parse(PyObject *o, void *p)
|
||||
{
|
||||
struct BPyGizmoWithTarget *gizmo_with_target = static_cast<BPyGizmoWithTarget *>(p);
|
||||
BPyGizmoWithTarget *gizmo_with_target = static_cast<BPyGizmoWithTarget *>(p);
|
||||
/* Must be set by `py_rna_gizmo_parse`. */
|
||||
wmGizmo *gz = gizmo_with_target->gz;
|
||||
BLI_assert(gz != nullptr);
|
||||
@@ -88,7 +88,7 @@ static int py_rna_gizmo_target_id_parse_and_ensure_is_valid(PyObject *o, void *p
|
||||
if (py_rna_gizmo_target_id_parse(o, p) == 0) {
|
||||
return 0;
|
||||
}
|
||||
struct BPyGizmoWithTarget *gizmo_with_target = static_cast<BPyGizmoWithTarget *>(p);
|
||||
BPyGizmoWithTarget *gizmo_with_target = static_cast<BPyGizmoWithTarget *>(p);
|
||||
wmGizmo *gz = gizmo_with_target->gz;
|
||||
wmGizmoProperty *gz_prop = gizmo_with_target->gz_prop;
|
||||
if (!WM_gizmo_target_property_is_valid(gz_prop)) {
|
||||
@@ -105,7 +105,7 @@ static int py_rna_gizmo_target_id_parse_and_ensure_is_valid(PyObject *o, void *p
|
||||
|
||||
static int py_rna_gizmo_target_type_id_parse(PyObject *o, void *p)
|
||||
{
|
||||
struct BPyGizmoWithTargetType *gizmo_with_target = static_cast<BPyGizmoWithTargetType *>(p);
|
||||
BPyGizmoWithTargetType *gizmo_with_target = static_cast<BPyGizmoWithTargetType *>(p);
|
||||
/* Must be set first. */
|
||||
wmGizmo *gz = gizmo_with_target->gz;
|
||||
BLI_assert(gz != nullptr);
|
||||
@@ -152,7 +152,7 @@ static void py_rna_gizmo_handler_get_cb(const wmGizmo * /*gz*/,
|
||||
{
|
||||
const PyGILState_STATE gilstate = PyGILState_Ensure();
|
||||
|
||||
struct BPyGizmoHandlerUserData *data = static_cast<BPyGizmoHandlerUserData *>(
|
||||
BPyGizmoHandlerUserData *data = static_cast<BPyGizmoHandlerUserData *>(
|
||||
gz_prop->custom_func.user_data);
|
||||
PyObject *ret = PyObject_CallObject(data->fn_slots[BPY_GIZMO_FN_SLOT_GET], nullptr);
|
||||
if (ret == nullptr) {
|
||||
@@ -203,7 +203,7 @@ static void py_rna_gizmo_handler_set_cb(const wmGizmo * /*gz*/,
|
||||
{
|
||||
const PyGILState_STATE gilstate = PyGILState_Ensure();
|
||||
|
||||
struct BPyGizmoHandlerUserData *data = static_cast<BPyGizmoHandlerUserData *>(
|
||||
BPyGizmoHandlerUserData *data = static_cast<BPyGizmoHandlerUserData *>(
|
||||
gz_prop->custom_func.user_data);
|
||||
|
||||
PyObject *args = PyTuple_New(1);
|
||||
@@ -251,7 +251,7 @@ static void py_rna_gizmo_handler_range_get_cb(const wmGizmo * /*gz*/,
|
||||
wmGizmoProperty *gz_prop,
|
||||
void *value_p)
|
||||
{
|
||||
struct BPyGizmoHandlerUserData *data = static_cast<BPyGizmoHandlerUserData *>(
|
||||
BPyGizmoHandlerUserData *data = static_cast<BPyGizmoHandlerUserData *>(
|
||||
gz_prop->custom_func.user_data);
|
||||
|
||||
const PyGILState_STATE gilstate = PyGILState_Ensure();
|
||||
@@ -304,7 +304,7 @@ fail:
|
||||
|
||||
static void py_rna_gizmo_handler_free_cb(const wmGizmo * /*gz*/, wmGizmoProperty *gz_prop)
|
||||
{
|
||||
struct BPyGizmoHandlerUserData *data = static_cast<BPyGizmoHandlerUserData *>(
|
||||
BPyGizmoHandlerUserData *data = static_cast<BPyGizmoHandlerUserData *>(
|
||||
gz_prop->custom_func.user_data);
|
||||
|
||||
const PyGILState_STATE gilstate = PyGILState_Ensure();
|
||||
@@ -335,7 +335,7 @@ static PyObject *bpy_gizmo_target_set_handler(PyObject * /*self*/, PyObject *arg
|
||||
const PyGILState_STATE gilstate = PyGILState_Ensure();
|
||||
|
||||
struct {
|
||||
struct BPyGizmoWithTargetType gz_with_target_type;
|
||||
BPyGizmoWithTargetType gz_with_target_type;
|
||||
PyObject *py_fn_slots[BPY_GIZMO_FN_SLOT_LEN];
|
||||
} params = {
|
||||
{nullptr, nullptr},
|
||||
@@ -443,7 +443,7 @@ PyDoc_STRVAR(bpy_gizmo_target_get_value_doc,
|
||||
static PyObject *bpy_gizmo_target_get_value(PyObject * /*self*/, PyObject *args, PyObject *kw)
|
||||
{
|
||||
struct {
|
||||
struct BPyGizmoWithTarget gz_with_target;
|
||||
BPyGizmoWithTarget gz_with_target;
|
||||
} params = {
|
||||
{nullptr, nullptr},
|
||||
};
|
||||
@@ -511,7 +511,7 @@ PyDoc_STRVAR(bpy_gizmo_target_set_value_doc,
|
||||
static PyObject *bpy_gizmo_target_set_value(PyObject * /*self*/, PyObject *args, PyObject *kw)
|
||||
{
|
||||
struct {
|
||||
struct BPyGizmoWithTarget gz_with_target;
|
||||
BPyGizmoWithTarget gz_with_target;
|
||||
PyObject *value;
|
||||
} params = {
|
||||
{nullptr, nullptr},
|
||||
@@ -596,7 +596,7 @@ PyDoc_STRVAR(bpy_gizmo_target_get_range_doc,
|
||||
static PyObject *bpy_gizmo_target_get_range(PyObject * /*self*/, PyObject *args, PyObject *kw)
|
||||
{
|
||||
struct {
|
||||
struct BPyGizmoWithTarget gz_with_target;
|
||||
BPyGizmoWithTarget gz_with_target;
|
||||
} params = {
|
||||
{nullptr, nullptr},
|
||||
};
|
||||
|
||||
@@ -59,7 +59,7 @@ struct IDUserMapData {
|
||||
|
||||
static int id_code_as_index(const short idcode)
|
||||
{
|
||||
return (int)*((ushort *)&idcode);
|
||||
return int(*((ushort *)&idcode));
|
||||
}
|
||||
|
||||
static bool id_check_type(const ID *id, const BLI_bitmap *types_bitmap)
|
||||
|
||||
@@ -263,7 +263,7 @@ static PyMethodDef pyrna_space_methods[] = {
|
||||
/** \name Public API
|
||||
* \{ */
|
||||
|
||||
void BPY_rna_types_extend_capi(void)
|
||||
void BPY_rna_types_extend_capi()
|
||||
{
|
||||
/* BlendData */
|
||||
ARRAY_SET_ITEMS(pyrna_blenddata_methods,
|
||||
|
||||
@@ -85,7 +85,7 @@ static int parse_syntax_error(PyObject *err,
|
||||
if (hold < 0 && PyErr_Occurred()) {
|
||||
goto finally;
|
||||
}
|
||||
*lineno = (int)hold;
|
||||
*lineno = int(hold);
|
||||
|
||||
v = _PyObject_GetAttrId(err, &PyId_offset);
|
||||
if (!v) {
|
||||
@@ -101,7 +101,7 @@ static int parse_syntax_error(PyObject *err,
|
||||
if (hold < 0 && PyErr_Occurred()) {
|
||||
goto finally;
|
||||
}
|
||||
*offset = (int)hold;
|
||||
*offset = int(hold);
|
||||
}
|
||||
|
||||
if (Py_TYPE(err) == (PyTypeObject *)PyExc_SyntaxError) {
|
||||
|
||||
@@ -178,7 +178,7 @@ static PyModuleDef bpy_utils_previews_module = {
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
PyObject *BPY_utils_previews_module(void)
|
||||
PyObject *BPY_utils_previews_module()
|
||||
{
|
||||
PyObject *submodule;
|
||||
|
||||
|
||||
@@ -198,10 +198,10 @@ static PyObject *bpyunits_to_value(PyObject * /*self*/, PyObject *args, PyObject
|
||||
}
|
||||
|
||||
str_len = str_len * 2 + 64;
|
||||
str = static_cast<char *>(PyMem_MALLOC(sizeof(*str) * (size_t)str_len));
|
||||
BLI_strncpy(str, inpt, (size_t)str_len);
|
||||
str = static_cast<char *>(PyMem_MALLOC(sizeof(*str) * size_t(str_len)));
|
||||
BLI_strncpy(str, inpt, size_t(str_len));
|
||||
|
||||
BKE_unit_replace_string(str, (int)str_len, uref, scale, usys, ucat);
|
||||
BKE_unit_replace_string(str, int(str_len), uref, scale, usys, ucat);
|
||||
|
||||
if (!PyC_RunString_AsNumber(nullptr, str, "<bpy_units_api>", &result)) {
|
||||
if (PyErr_Occurred()) {
|
||||
@@ -308,7 +308,7 @@ static PyObject *bpyunits_to_string(PyObject * /*self*/, PyObject *args, PyObjec
|
||||
PyObject *result;
|
||||
|
||||
BKE_unit_value_as_string_adaptive(
|
||||
buf1, sizeof(buf1), value, precision, usys, ucat, (bool)split_unit, false);
|
||||
buf1, sizeof(buf1), value, precision, usys, ucat, bool(split_unit), false);
|
||||
|
||||
if (compatible_unit) {
|
||||
BKE_unit_name_to_alt(buf2, sizeof(buf2), buf1, usys, ucat);
|
||||
@@ -350,7 +350,7 @@ static PyModuleDef bpyunits_module = {
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
PyObject *BPY_utils_units(void)
|
||||
PyObject *BPY_utils_units()
|
||||
{
|
||||
PyObject *submodule, *item;
|
||||
|
||||
|
||||
@@ -13,16 +13,14 @@
|
||||
/* python, will come back */
|
||||
// void BPY_script_exec(void) {}
|
||||
// void BPY_python_start(void) {}
|
||||
void BPY_pyconstraint_exec(struct bPythonConstraint * /*con*/,
|
||||
struct bConstraintOb * /*cob*/,
|
||||
struct ListBase * /*targets*/)
|
||||
void BPY_pyconstraint_exec(bPythonConstraint * /*con*/,
|
||||
bConstraintOb * /*cob*/,
|
||||
ListBase * /*targets*/)
|
||||
{
|
||||
}
|
||||
void BPY_pyconstraint_target(struct bPythonConstraint * /*con*/, struct bConstraintTarget * /*ct*/)
|
||||
{
|
||||
}
|
||||
bool BPY_is_pyconstraint(struct Text * /*text*/)
|
||||
void BPY_pyconstraint_target(bPythonConstraint * /*con*/, bConstraintTarget * /*ct*/) {}
|
||||
bool BPY_is_pyconstraint(Text * /*text*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void BPY_pyconstraint_update(struct Object * /*owner*/, struct bConstraint * /*con*/) {}
|
||||
void BPY_pyconstraint_update(Object * /*owner*/, bConstraint * /*con*/) {}
|
||||
|
||||
@@ -77,7 +77,7 @@ Py_hash_t mathutils_array_hash(const float *array, size_t array_len)
|
||||
x = 0x345678UL;
|
||||
i = 0;
|
||||
while (--len >= 0) {
|
||||
y = _Py_HashDouble(nullptr, (double)(array[i++]));
|
||||
y = _Py_HashDouble(nullptr, double(array[i++]));
|
||||
if (y == -1) {
|
||||
return -1;
|
||||
}
|
||||
@@ -395,7 +395,7 @@ int mathutils_array_parse_alloc_viseq(
|
||||
start = 0;
|
||||
for (i = 0; i < size; i++) {
|
||||
subseq = value_fast_items[i];
|
||||
if ((subseq_len = (int)PySequence_Size(subseq)) == -1) {
|
||||
if ((subseq_len = int(PySequence_Size(subseq))) == -1) {
|
||||
PyErr_Format(
|
||||
PyExc_ValueError, "%.200s: sequence expected to have subsequences", error_prefix);
|
||||
PyMem_Free(*start_table);
|
||||
@@ -495,7 +495,7 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error
|
||||
* [3] https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
|
||||
* instead.
|
||||
*/
|
||||
#define SIGNMASK(i) (-(int)(((uint)(i)) >> 31))
|
||||
#define SIGNMASK(i) (-int((uint(i)) >> 31))
|
||||
|
||||
int EXPP_FloatsAreEqual(float af, float bf, int maxDiff)
|
||||
{
|
||||
@@ -792,7 +792,7 @@ static PyModuleDef M_Mathutils_module_def = {
|
||||
# include "mathutils_noise.h"
|
||||
#endif
|
||||
|
||||
PyMODINIT_FUNC PyInit_mathutils(void)
|
||||
PyMODINIT_FUNC PyInit_mathutils()
|
||||
{
|
||||
PyObject *mod;
|
||||
PyObject *submodule;
|
||||
|
||||
@@ -42,7 +42,7 @@ static PyObject *Color_to_tuple_ex(ColorObject *self, int ndigits)
|
||||
|
||||
if (ndigits >= 0) {
|
||||
for (i = 0; i < COLOR_SIZE; i++) {
|
||||
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->col[i], ndigits)));
|
||||
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round(double(self->col[i]), ndigits)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -76,7 +76,7 @@ static PyObject *Euler_to_tuple_ex(EulerObject *self, int ndigits)
|
||||
|
||||
if (ndigits >= 0) {
|
||||
for (i = 0; i < EULER_SIZE; i++) {
|
||||
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->eul[i], ndigits)));
|
||||
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round(double(self->eul[i]), ndigits)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -228,7 +228,7 @@ static PyObject *Euler_rotate_axis(EulerObject *self, PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rotate_eulO(self->eul, self->order, (char)axis, angle);
|
||||
rotate_eulO(self->eul, self->order, char(axis), angle);
|
||||
|
||||
(void)BaseMath_WriteCallback(self);
|
||||
|
||||
|
||||
@@ -1592,7 +1592,7 @@ static bool matrix_invert_args_check(const MatrixObject *self, PyObject *args, b
|
||||
}
|
||||
}
|
||||
|
||||
static void matrix_invert_raise_degenerate(void)
|
||||
static void matrix_invert_raise_degenerate()
|
||||
{
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"Matrix.invert(ed): "
|
||||
@@ -1804,7 +1804,7 @@ static PyObject *Matrix_adjugate(MatrixObject *self)
|
||||
}
|
||||
else {
|
||||
PyErr_Format(
|
||||
PyExc_ValueError, "Matrix adjugate(d): size (%d) unsupported", (int)self->col_num);
|
||||
PyExc_ValueError, "Matrix adjugate(d): size (%d) unsupported", int(self->col_num));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1992,7 +1992,7 @@ static PyObject *Matrix_determinant(MatrixObject *self)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return PyFloat_FromDouble((double)matrix_determinant_internal(self));
|
||||
return PyFloat_FromDouble(double(matrix_determinant_internal(self)));
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -2869,9 +2869,9 @@ static PyObject *Matrix_matmul(PyObject *m1, PyObject *m2)
|
||||
for (row = 0; row < mat1->row_num; row++) {
|
||||
double dot = 0.0f;
|
||||
for (item = 0; item < mat1->col_num; item++) {
|
||||
dot += (double)(MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col));
|
||||
dot += double(MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col));
|
||||
}
|
||||
mat[(col * mat1->row_num) + row] = (float)dot;
|
||||
mat[(col * mat1->row_num) + row] = float(dot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2942,11 +2942,11 @@ static PyObject *Matrix_imatmul(PyObject *m1, PyObject *m2)
|
||||
for (row = 0; row < mat1->row_num; row++) {
|
||||
double dot = 0.0f;
|
||||
for (item = 0; item < mat1->col_num; item++) {
|
||||
dot += (double)(MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col));
|
||||
dot += double(MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col));
|
||||
}
|
||||
/* store in new matrix as overwriting original at this point will cause
|
||||
* subsequent iterations to use incorrect values */
|
||||
mat[(col * mat1->row_num) + row] = (float)dot;
|
||||
mat[(col * mat1->row_num) + row] = float(dot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits)
|
||||
|
||||
if (ndigits >= 0) {
|
||||
for (i = 0; i < QUAT_SIZE; i++) {
|
||||
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->quat[i], ndigits)));
|
||||
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round(double(self->quat[i]), ndigits)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -923,7 +923,7 @@ static int Quaternion_ass_item(QuaternionObject *self, Py_ssize_t i, PyObject *o
|
||||
return -1;
|
||||
}
|
||||
|
||||
f = (float)PyFloat_AsDouble(ob);
|
||||
f = float(PyFloat_AsDouble(ob));
|
||||
|
||||
if (f == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
|
||||
@@ -81,9 +81,9 @@ static int row_vector_multiplication(float r_vec[MAX_DIMENSIONS],
|
||||
for (col = 0; col < mat->col_num; col++) {
|
||||
double dot = 0.0;
|
||||
for (row = 0; row < mat->row_num; row++) {
|
||||
dot += (double)(MATRIX_ITEM(mat, row, col) * vec_cpy[row]);
|
||||
dot += double(MATRIX_ITEM(mat, row, col) * vec_cpy[row]);
|
||||
}
|
||||
r_vec[z++] = (float)dot;
|
||||
r_vec[z++] = float(dot);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ static PyObject *Vector_to_tuple_ex(VectorObject *self, int ndigits)
|
||||
|
||||
if (ndigits >= 0) {
|
||||
for (i = 0; i < self->vec_num; i++) {
|
||||
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->vec[i], ndigits)));
|
||||
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round(double(self->vec[i]), ndigits)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -288,7 +288,7 @@ static PyObject *C_Vector_Range(PyObject *cls, PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
range_vn_fl(vec, vec_num, (float)start, (float)step);
|
||||
range_vn_fl(vec, vec_num, float(start), float(step));
|
||||
|
||||
return Vector_CreatePyObject_alloc(vec, vec_num, (PyTypeObject *)cls);
|
||||
}
|
||||
@@ -320,7 +320,7 @@ static PyObject *C_Vector_Linspace(PyObject *cls, PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
step = (end - start) / (float)(vec_num - 1);
|
||||
step = (end - start) / float(vec_num - 1);
|
||||
|
||||
vec = static_cast<float *>(PyMem_Malloc(vec_num * sizeof(float)));
|
||||
|
||||
@@ -1110,9 +1110,9 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
for (x = 0; x < vec_num; x++) {
|
||||
dot_self += (double)self->vec[x] * (double)self->vec[x];
|
||||
dot_other += (double)tvec[x] * (double)tvec[x];
|
||||
dot += (double)self->vec[x] * (double)tvec[x];
|
||||
dot_self += double(self->vec[x]) * double(self->vec[x]);
|
||||
dot_other += double(tvec[x]) * double(tvec[x]);
|
||||
dot += double(self->vec[x]) * double(tvec[x]);
|
||||
}
|
||||
|
||||
if (!dot_self || !dot_other) {
|
||||
@@ -1273,13 +1273,13 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value)
|
||||
|
||||
/* get dot products */
|
||||
for (x = 0; x < vec_num; x++) {
|
||||
dot += (double)(self->vec[x] * tvec[x]);
|
||||
dot2 += (double)(tvec[x] * tvec[x]);
|
||||
dot += double(self->vec[x] * tvec[x]);
|
||||
dot2 += double(tvec[x] * tvec[x]);
|
||||
}
|
||||
/* projection */
|
||||
dot /= dot2;
|
||||
for (x = 0; x < vec_num; x++) {
|
||||
tvec[x] *= (float)dot;
|
||||
tvec[x] *= float(dot);
|
||||
}
|
||||
return Vector_CreatePyObject_alloc(tvec, vec_num, Py_TYPE(self));
|
||||
}
|
||||
@@ -1395,7 +1395,7 @@ static PyObject *Vector_slerp(VectorObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
/* We have sane state, execute slerp */
|
||||
cosom = (float)dot_vn_vn(self_vec, other_vec, vec_num);
|
||||
cosom = float(dot_vn_vn(self_vec, other_vec, vec_num));
|
||||
|
||||
/* direct opposite, can't slerp */
|
||||
if (UNLIKELY(cosom < (-1.0f + FLT_EPSILON))) {
|
||||
@@ -2081,9 +2081,9 @@ int column_vector_multiplication(float r_vec[MAX_DIMENSIONS], VectorObject *vec,
|
||||
for (row = 0; row < mat->row_num; row++) {
|
||||
double dot = 0.0f;
|
||||
for (col = 0; col < mat->col_num; col++) {
|
||||
dot += (double)(MATRIX_ITEM(mat, row, col) * vec_cpy[col]);
|
||||
dot += double(MATRIX_ITEM(mat, row, col) * vec_cpy[col]);
|
||||
}
|
||||
r_vec[z++] = (float)dot;
|
||||
r_vec[z++] = float(dot);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -2694,7 +2694,7 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
|
||||
}
|
||||
else if ((void)PyErr_Clear(), /* run but ignore the result */
|
||||
(size_from = (size_t)mathutils_array_parse(
|
||||
vec_assign, 2, 4, value, "Vector.**** = swizzle assignment")) == (size_t)-1)
|
||||
vec_assign, 2, 4, value, "Vector.**** = swizzle assignment")) == size_t(-1))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1103,7 +1103,7 @@ struct PointsInPlanes_UserData {
|
||||
|
||||
static void points_in_planes_fn(const float co[3], int i, int j, int k, void *user_data_p)
|
||||
{
|
||||
struct PointsInPlanes_UserData *user_data = static_cast<PointsInPlanes_UserData *>(user_data_p);
|
||||
PointsInPlanes_UserData *user_data = static_cast<PointsInPlanes_UserData *>(user_data_p);
|
||||
PyList_APPEND(user_data->py_verts, Vector_CreatePyObject(co, 3, nullptr));
|
||||
user_data->planes_used[i] = true;
|
||||
user_data->planes_used[j] = true;
|
||||
@@ -1377,8 +1377,8 @@ static int boxPack_FromPyObject(PyObject *value, BoxPack **r_boxarray)
|
||||
item_1 = PyList_GET_ITEM(list_item, 2);
|
||||
item_2 = PyList_GET_ITEM(list_item, 3);
|
||||
|
||||
box->w = (float)PyFloat_AsDouble(item_1);
|
||||
box->h = (float)PyFloat_AsDouble(item_2);
|
||||
box->w = float(PyFloat_AsDouble(item_1));
|
||||
box->h = float(PyFloat_AsDouble(item_2));
|
||||
box->index = i;
|
||||
|
||||
/* accounts for error case too and overwrites with own error */
|
||||
@@ -1656,7 +1656,7 @@ static PyObject *M_Geometry_delaunay_2d_cdt(PyObject * /*self*/, PyObject *args)
|
||||
goto exit_cdt;
|
||||
}
|
||||
|
||||
in.verts_len = (int)vert_coords_len;
|
||||
in.verts_len = int(vert_coords_len);
|
||||
in.vert_coords = in_coords;
|
||||
in.edges_len = edges_len;
|
||||
in.faces_len = faces_len;
|
||||
@@ -1686,8 +1686,8 @@ static PyObject *M_Geometry_delaunay_2d_cdt(PyObject * /*self*/, PyObject *args)
|
||||
out_edges = PyList_New(res->edges_len);
|
||||
for (i = 0; i < res->edges_len; i++) {
|
||||
item = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(item, 0, PyLong_FromLong((long)res->edges[i][0]));
|
||||
PyTuple_SET_ITEM(item, 1, PyLong_FromLong((long)res->edges[i][1]));
|
||||
PyTuple_SET_ITEM(item, 0, PyLong_FromLong(long(res->edges[i][0])));
|
||||
PyTuple_SET_ITEM(item, 1, PyLong_FromLong(long(res->edges[i][1])));
|
||||
PyList_SET_ITEM(out_edges, i, item);
|
||||
}
|
||||
PyTuple_SET_ITEM(ret_value, 1, out_edges);
|
||||
@@ -1844,7 +1844,7 @@ static PyModuleDef M_Geometry_module_def = {
|
||||
|
||||
/*----------------------------MODULE INIT-------------------------*/
|
||||
|
||||
PyMODINIT_FUNC PyInit_mathutils_geometry(void)
|
||||
PyMODINIT_FUNC PyInit_mathutils_geometry()
|
||||
{
|
||||
PyObject *submodule = PyModule_Create(&M_Geometry_module_def);
|
||||
return submodule;
|
||||
|
||||
@@ -104,7 +104,7 @@ static PyModuleDef M_Interpolate_module_def = {
|
||||
|
||||
/*----------------------------MODULE INIT-------------------------*/
|
||||
|
||||
PyMODINIT_FUNC PyInit_mathutils_interpolate(void)
|
||||
PyMODINIT_FUNC PyInit_mathutils_interpolate()
|
||||
{
|
||||
PyObject *submodule = PyModule_Create(&M_Interpolate_module_def);
|
||||
return submodule;
|
||||
|
||||
@@ -171,7 +171,7 @@ static int py_find_nearest_cb(void *user_data, int index, const float co[3], flo
|
||||
{
|
||||
UNUSED_VARS(co, dist_sq);
|
||||
|
||||
struct PyKDTree_NearestData *data = static_cast<PyKDTree_NearestData *>(user_data);
|
||||
PyKDTree_NearestData *data = static_cast<PyKDTree_NearestData *>(user_data);
|
||||
|
||||
PyObject *py_args = PyTuple_New(1);
|
||||
PyTuple_SET_ITEM(py_args, 0, PyLong_FromLong(index));
|
||||
@@ -183,7 +183,7 @@ static int py_find_nearest_cb(void *user_data, int index, const float co[3], flo
|
||||
const int ok = PyC_ParseBool(result, &use_node);
|
||||
Py_DECREF(result);
|
||||
if (ok) {
|
||||
return (int)use_node;
|
||||
return int(use_node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ static PyObject *py_kdtree_find(PyKDTree *self, PyObject *args, PyObject *kwargs
|
||||
BLI_kdtree_3d_find_nearest(self->obj, co, &nearest);
|
||||
}
|
||||
else {
|
||||
struct PyKDTree_NearestData data = {0};
|
||||
PyKDTree_NearestData data = {0};
|
||||
|
||||
data.py_filter = py_filter;
|
||||
data.is_error = false;
|
||||
@@ -441,7 +441,7 @@ static PyModuleDef kdtree_moduledef = {
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC PyInit_mathutils_kdtree(void)
|
||||
PyMODINIT_FUNC PyInit_mathutils_kdtree()
|
||||
{
|
||||
PyObject *m = PyModule_Create(&kdtree_moduledef);
|
||||
|
||||
|
||||
@@ -81,12 +81,12 @@ static void init_genrand(ulong s)
|
||||
const float range = 32; /* range in both pos/neg direction */
|
||||
for (j = 0; j < ARRAY_SIZE(state_offset_vector); j++, state_offset++) {
|
||||
/* overflow is fine here */
|
||||
state_offset_vector[j] = (float)(int)(*state_offset) * (1.0f / ((float)INT_MAX / range));
|
||||
state_offset_vector[j] = float(int(*state_offset)) * (1.0f / (float(INT_MAX) / range));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void next_state(void)
|
||||
static void next_state()
|
||||
{
|
||||
ulong *p = state;
|
||||
int j;
|
||||
@@ -123,7 +123,7 @@ static void setRndSeed(int seed)
|
||||
}
|
||||
|
||||
/* Float number in range [0, 1) using the mersenne twister random number generator. */
|
||||
static float frand(void)
|
||||
static float frand()
|
||||
{
|
||||
ulong y;
|
||||
|
||||
@@ -138,7 +138,7 @@ static float frand(void)
|
||||
y ^= (y << 15) & 0xefc60000UL;
|
||||
y ^= (y >> 18);
|
||||
|
||||
return (float)y / 4294967296.0f;
|
||||
return float(y) / 4294967296.0f;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------*/
|
||||
@@ -218,7 +218,7 @@ static float turb(
|
||||
float amp, out, t;
|
||||
int i;
|
||||
amp = 1.0f;
|
||||
out = (float)(2.0f * BLI_noise_generic_noise(1.0f, x, y, z, false, nb) - 1.0f);
|
||||
out = float(2.0f * BLI_noise_generic_noise(1.0f, x, y, z, false, nb) - 1.0f);
|
||||
if (hard) {
|
||||
out = fabsf(out);
|
||||
}
|
||||
@@ -227,7 +227,7 @@ static float turb(
|
||||
x *= freqscale;
|
||||
y *= freqscale;
|
||||
z *= freqscale;
|
||||
t = (float)(amp * (2.0f * BLI_noise_generic_noise(1.0f, x, y, z, false, nb) - 1.0f));
|
||||
t = float(amp * (2.0f * BLI_noise_generic_noise(1.0f, x, y, z, false, nb) - 1.0f));
|
||||
if (hard) {
|
||||
t = fabsf(t);
|
||||
}
|
||||
@@ -1112,7 +1112,7 @@ static PyModuleDef M_Noise_module_def = {
|
||||
|
||||
/*----------------------------MODULE INIT-------------------------*/
|
||||
|
||||
PyMODINIT_FUNC PyInit_mathutils_noise(void)
|
||||
PyMODINIT_FUNC PyInit_mathutils_noise()
|
||||
{
|
||||
PyObject *submodule = PyModule_Create(&M_Noise_module_def);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user