Cleanup: strip trailing space in Python module

This commit is contained in:
Campbell Barton 2018-06-04 08:54:17 +02:00
parent 854db8951b
commit 7719c11006
23 changed files with 112 additions and 112 deletions

View File

@ -18,7 +18,7 @@
#
# ***** END GPL LICENSE BLOCK *****
set(INC
set(INC
.
../../bmesh
../../blenkernel

View File

@ -2149,7 +2149,7 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
if (vert_array == NULL) {
return NULL;
}
if (BM_edge_exists(vert_array[0], vert_array[1])) {
PyErr_SetString(PyExc_ValueError,
"edges.new(): this edge exists");

View File

@ -18,7 +18,7 @@
#
# ***** END GPL LICENSE BLOCK *****
set(INC
set(INC
.
../../blenkernel
../../blenlib

View File

@ -862,7 +862,7 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end)
{
PyObject *list;
int count;
if (begin < 0) begin = 0;
if (end > self->dimensions[0]) end = self->dimensions[0];
if (begin > end) begin = end;
@ -910,11 +910,11 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
{
PyObject *item;
int count, err = 0;
if (begin < 0) begin = 0;
if (end > self->dimensions[0]) end = self->dimensions[0];
if (begin > end) begin = end;
if (!PySequence_Check(seq)) {
PyErr_Format(PyExc_TypeError,
"buffer[:] = value, invalid assignment. "
@ -930,7 +930,7 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
"Expected: %d (given: %d)", count, end - begin);
return -1;
}
for (count = begin; count < end; count++) {
item = PySequence_GetItem(seq, count - begin);
if (item) {
@ -3743,4 +3743,4 @@ static PyObject *Method_ShaderSource(PyObject *UNUSED(self), PyObject *args)
}
/** \} */
/** \} */

View File

@ -39,7 +39,7 @@ int BGL_typeSize(int type);
* For Python access to OpenGL functions requiring a pointer.
*/
typedef struct _Buffer {
PyObject_VAR_HEAD
PyObject_VAR_HEAD
PyObject *parent;
int type; /* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */

View File

@ -305,7 +305,7 @@ static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
if (!PyArg_ParseTuple(args, "if:blf.rotation", &fontid, &angle))
return NULL;
BLF_rotation(fontid, angle);
Py_RETURN_NONE;

View File

@ -187,7 +187,7 @@ PyObject *bpy_text_import_name(const char *name, int *found)
int namelen = strlen(name);
//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
Main *maggie = bpy_import_main;
*found = 0;
if (!maggie) {
@ -220,7 +220,7 @@ PyObject *bpy_text_import_name(const char *name, int *found)
return NULL;
else
*found = 1;
return bpy_text_import(text);
}
@ -236,14 +236,14 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
const char *filepath;
//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
Main *maggie = bpy_import_main;
if (!maggie) {
printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
return NULL;
}
*found = 0;
/* get name, filename from the module itself */
if ((name = PyModule_GetName(module)) == NULL)
return NULL;
@ -298,15 +298,15 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
/* import existing builtin modules or modules that have been imported already */
newmodule = PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
if (newmodule)
return newmodule;
PyErr_Fetch(&exception, &err, &tb); /* get the python error in case we cant import as blender text either */
/* importing from existing modules failed, see if we have this module as blender text */
newmodule = bpy_text_import_name(name, &found);
if (newmodule) { /* found module as blender text, ignore above exception */
PyErr_Clear();
Py_XDECREF(exception);

View File

@ -1,4 +1,4 @@
/*
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@ -47,7 +47,7 @@ bool bpy_text_compile(struct Text *text);
PyObject *bpy_text_import(struct Text *text);
PyObject *bpy_text_import_name(const char *name, int *found);
PyObject *bpy_text_reimport(PyObject *module, int *found);
/* void bpy_text_clear_modules(int clear_all);*/ /* Clear user modules */
/* void bpy_text_clear_modules(int clear_all);*/ /* Clear user modules */
void bpy_text_filename_get(char *fn, size_t fn_len, struct Text *text);

View File

@ -295,7 +295,7 @@ void PyC_LineSpit(void)
PyErr_Clear();
PyC_FileAndNum(&filename, &lineno);
fprintf(stderr, "%s:%d\n", filename, lineno);
}
@ -317,7 +317,7 @@ void PyC_StackSpit(void)
void PyC_FileAndNum(const char **filename, int *lineno)
{
PyFrameObject *frame;
if (filename) *filename = NULL;
if (lineno) *lineno = -1;
@ -375,22 +375,22 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
Py_ssize_t i;
PyObject *item = o;
const char *attr;
va_list vargs;
va_start(vargs, n);
for (i = 0; i < n; i++) {
attr = va_arg(vargs, char *);
item = PyObject_GetAttrString(item, attr);
if (item)
if (item)
Py_DECREF(item);
else /* python will set the error value here */
break;
}
va_end(vargs);
Py_XINCREF(item); /* final value has is increfed, to match PyObject_GetAttrString */
return item;
}
@ -839,7 +839,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
}
}
va_end(vargs);
/* set the value so we can access it */
PyDict_SetItemString(py_dict, "values", values);
Py_DECREF(values);
@ -865,7 +865,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
for (i = 0; i * 2 < n; i++) {
const char *format = va_arg(vargs, char *);
void *ptr = va_arg(vargs, void *);
PyObject *item;
PyObject *item_new;
/* prepend the string formatting and remake the tuple */

View File

@ -169,7 +169,7 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
PyErr_SetString(PyExc_ValueError, "invalid resource argument");
return NULL;
}
/* same logic as BKE_appdir_folder_id_create(), but best leave it up to the script author to create */
path = BKE_appdir_folder_id(folder_id, subdir);

View File

@ -243,10 +243,10 @@ static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *clos
PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False");
return -1;
}
if (param) G.debug |= flag;
else G.debug &= ~flag;
return 0;
}
@ -297,7 +297,7 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void
PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number");
return -1;
}
G.debug_value = param;
WM_main_add_notifier(NC_WINDOW, NULL);
@ -396,7 +396,7 @@ static void py_struct_seq_getset_init(void)
PyObject *BPY_app_struct(void)
{
PyObject *ret;
PyStructSequence_InitType(&BlenderAppType, &app_info_desc);
ret = make_app_info();

View File

@ -88,21 +88,21 @@ bool BPy_errors_to_report_ex(ReportList *reports, const bool use_full, const boo
if (!PyErr_Occurred())
return 1;
/* less hassle if we allow NULL */
if (reports == NULL) {
PyErr_Print();
PyErr_Clear();
return 1;
}
if (use_full) {
pystring = PyC_ExceptionBuffer();
}
else {
pystring = PyC_ExceptionBuffer_Simple();
}
if (pystring == NULL) {
BKE_report(reports, RPT_ERROR, "Unknown py-exception, could not convert");
return 0;

View File

@ -285,7 +285,7 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, c
for (dvar = driver->variables.first, i = 0; dvar; dvar = dvar->next) {
PyTuple_SET_ITEM(expr_vars, i++, PyUnicode_FromString(dvar->name));
}
driver->flag &= ~DRIVER_FLAG_RENAMEVAR;
}
else {
@ -342,7 +342,7 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, c
fprintf(stderr, "\nBPY_driver_eval() - Error while evaluating PyDriver:\n");
targets_ok = 0;
}
fprintf(stderr, "\tBPY_driver_eval() - couldn't add variable '%s' to namespace\n", dvar->name);
// BPy_errors_to_report(NULL); // TODO - reports
PyErr_Print();

View File

@ -289,7 +289,7 @@ void BPY_python_start(int argc, const char **argv)
PySys_SetObject("argv", py_argv);
Py_DECREF(py_argv);
}
/* Initialize thread support (also acquires lock) */
PyEval_InitThreads();
#else
@ -328,7 +328,7 @@ void BPY_python_start(int argc, const char **argv)
BPy_init_modules();
bpy_import_init(PyEval_GetBuiltins());
pyrna_alloc_types();
#ifndef WITH_PYTHON_MODULE
@ -347,7 +347,7 @@ void BPY_python_end(void)
/* finalizing, no need to grab the state, except when we are a module */
gilstate = PyGILState_Ensure();
/* free other python data. */
pyrna_free_types();
@ -693,7 +693,7 @@ bool BPY_execute_string_ex(bContext *C, const char *expr, bool use_eval)
PyC_MainModule_Restore(main_mod);
bpy_context_clear(C, &gilstate);
return ok;
}
@ -877,7 +877,7 @@ static void bpy_module_delay_init(PyObject *bpy_proxy)
argv[0] = filename_abs;
argv[1] = NULL;
// printf("module found %s\n", argv[0]);
main_python_enter(argc, argv);
@ -906,14 +906,14 @@ PyMODINIT_FUNC
PyInit_bpy(void)
{
PyObject *bpy_proxy = PyModule_Create(&bpy_proxy_def);
/* Problem:
* 1) this init function is expected to have a private member defined - 'md_def'
* but this is only set for C defined modules (not py packages)
* so we cant return 'bpy_package_py' as is.
*
* 2) there is a 'bpy' C module for python to load which is basically all of blender,
* and there is scripts/bpy/__init__.py,
* and there is scripts/bpy/__init__.py,
* we may end up having to rename this module so there is no naming conflict here eg:
* 'from blender import bpy'
*
@ -923,13 +923,13 @@ PyInit_bpy(void)
/* assign an object which is freed after __file__ is assigned */
dealloc_obj *dob;
/* assign dummy type */
dealloc_obj_Type.tp_name = "dealloc_obj";
dealloc_obj_Type.tp_basicsize = sizeof(dealloc_obj);
dealloc_obj_Type.tp_dealloc = dealloc_obj_dealloc;
dealloc_obj_Type.tp_flags = Py_TPFLAGS_DEFAULT;
if (PyType_Ready(&dealloc_obj_Type) < 0)
return NULL;

View File

@ -79,7 +79,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
/* XXX Todo, work out a better solution for passing on context,
* could make a tuple from self and pack the name and Context into it... */
bContext *C = (bContext *)BPy_GetContext();
if (C == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
return NULL;
@ -87,7 +87,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
if (!PyArg_ParseTuple(args, "s|Os:_bpy.ops.poll", &opname, &context_dict, &context_str))
return NULL;
ot = WM_operatortype_find(opname, true);
if (ot == NULL) {
@ -108,7 +108,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
}
if (context_dict == NULL || context_dict == Py_None) {
context_dict = NULL;
}
@ -123,10 +123,10 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
context_dict_back = CTX_py_dict_get(C);
CTX_py_dict_set(C, (void *)context_dict);
Py_XINCREF(context_dict); /* so we done loose it */
/* main purpose of thsi function */
ret = WM_operator_poll_context((bContext *)C, ot, context) ? Py_True : Py_False;
/* restore with original context dict, probably NULL but need this for nested operator calls */
Py_XDECREF(context_dict);
CTX_py_dict_set(C, (void *)context_dict_back);
@ -154,12 +154,12 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
/* XXX Todo, work out a better solution for passing on context,
* could make a tuple from self and pack the name and Context into it... */
bContext *C = (bContext *)BPy_GetContext();
if (C == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
return NULL;
}
if (!PyArg_ParseTuple(args, "sO|O!si:_bpy.ops.call",
&opname, &context_dict, &PyDict_Type, &kw, &context_str, &is_undo))
{
@ -174,7 +174,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
"could not be found", opname);
return NULL;
}
if (!pyrna_write_check()) {
PyErr_Format(PyExc_RuntimeError,
"Calling operator \"bpy.ops.%s\" error, "
@ -259,7 +259,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
PySys_WriteStdout("%s: %s\n", report->typestr, report->message);
}
}
BKE_reports_clear(reports);
if ((reports->flag & RPT_FREE) == 0) {
MEM_freeN(reports);
@ -330,7 +330,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant get the string representation of this object.");
return NULL;
}
if (!PyArg_ParseTuple(
args, "s|O!O&O&:_bpy.ops.as_string",
&opname, &PyDict_Type, &kw,
@ -400,7 +400,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
PointerRNA ptr;
const char *opname = _PyUnicode_AsString(value);
BPy_StructRNA *pyrna = NULL;
if (opname == NULL) {
PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument");
return NULL;
@ -410,7 +410,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname);
return NULL;
}
/* type */
//RNA_pointer_create(NULL, &RNA_Struct, ot->srna, &ptr);
@ -418,7 +418,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
WM_operator_properties_create_ptr(&ptr, ot);
WM_operator_properties_sanitize(&ptr, 0);
pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
#ifdef PYRNA_FREE_SUPPORT
pyrna->freeptr = true;

View File

@ -366,7 +366,7 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *
Py_DECREF(ret);
}
if (use_gil)
PyGILState_Release(gilstate);
@ -1329,7 +1329,7 @@ static int icon_id_from_name(const char *name)
}
}
}
return 0;
}
@ -1631,7 +1631,7 @@ static void bpy_prop_callback_assign_boolean(struct PropertyRNA *prop, PyObject
{
BooleanPropertyGetFunc rna_get_cb = NULL;
BooleanPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1653,7 +1653,7 @@ static void bpy_prop_callback_assign_boolean_array(struct PropertyRNA *prop, PyO
{
BooleanArrayPropertyGetFunc rna_get_cb = NULL;
BooleanArrayPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1675,7 +1675,7 @@ static void bpy_prop_callback_assign_int(struct PropertyRNA *prop, PyObject *get
{
IntPropertyGetFunc rna_get_cb = NULL;
IntPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1697,7 +1697,7 @@ static void bpy_prop_callback_assign_int_array(struct PropertyRNA *prop, PyObjec
{
IntArrayPropertyGetFunc rna_get_cb = NULL;
IntArrayPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1719,7 +1719,7 @@ static void bpy_prop_callback_assign_float(struct PropertyRNA *prop, PyObject *g
{
FloatPropertyGetFunc rna_get_cb = NULL;
FloatPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1741,7 +1741,7 @@ static void bpy_prop_callback_assign_float_array(struct PropertyRNA *prop, PyObj
{
FloatArrayPropertyGetFunc rna_get_cb = NULL;
FloatArrayPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1764,7 +1764,7 @@ static void bpy_prop_callback_assign_string(struct PropertyRNA *prop, PyObject *
StringPropertyGetFunc rna_get_cb = NULL;
StringPropertyLengthFunc rna_length_cb = NULL;
StringPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1788,7 +1788,7 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, PyObject *ge
EnumPropertyGetFunc rna_get_cb = NULL;
EnumPropertyItemFunc rna_itemf_cb = NULL;
EnumPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1815,7 +1815,7 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, PyObject *ge
RNA_def_property_enum_funcs_runtime(prop, rna_get_cb, rna_set_cb, rna_itemf_cb);
}
/* this define runs at the start of each function and deals with
/* this define runs at the start of each function and deals with
* returning a deferred property (to be registered later) */
#define BPY_PROPDEF_HEAD(_func) \
if (PyTuple_GET_SIZE(args) == 1) { \
@ -2166,7 +2166,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
bpy_prop_callback_assign_boolean_array(prop, get_cb, set_cb);
RNA_def_property_duplicate_pointers(srna, prop);
}
Py_RETURN_NONE;
}
@ -2801,7 +2801,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
BPY_PROPDEF_HEAD(EnumProperty);
if (srna) {
const char *id = NULL, *name = NULL, *description = "";
PyObject *def = NULL;
@ -3195,7 +3195,7 @@ PyObject *BPY_rna_props(void)
{
PyObject *submodule;
PyObject *submodule_dict;
submodule = PyModule_Create(&props_module);
PyDict_SetItemString(PyImport_GetModuleDict(), props_module.m_name, submodule);
@ -3203,7 +3203,7 @@ PyObject *BPY_rna_props(void)
* module with a new ref like PyDict_New, since they are passed to
* PyModule_AddObject which steals a ref */
Py_INCREF(submodule);
/* api needs the PyObjects internally */
submodule_dict = PyModule_GetDict(submodule);
@ -3220,6 +3220,6 @@ PyObject *BPY_rna_props(void)
ASSIGN_STATIC(PointerProperty);
ASSIGN_STATIC(CollectionProperty);
ASSIGN_STATIC(RemoveProperty);
return submodule;
}

View File

@ -233,13 +233,13 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
*/
ReportList reports;
short result = 0;
PointerRNA ptr = self->ptr;
PropertyRNA *prop = NULL;
const char *prop_name;
BKE_reports_init(&reports, RPT_STORE);
/* Retrieve the property identifier from the full path, since we can't get it any other way */
prop_name = strrchr(path_full, '.');
if ((prop_name >= path_full) &&
@ -247,21 +247,21 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
{
prop = RNA_struct_find_property(&ptr, prop_name + 1);
}
if (prop) {
NlaStrip *strip = (NlaStrip *)ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index);
result = insert_keyframe_direct(&reports, ptr, prop, fcu, cfra, keytype, options);
}
else {
BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
}
MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
return NULL;
return PyBool_FromLong(result);
}
else {
@ -320,13 +320,13 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
*/
ReportList reports;
short result = 0;
PointerRNA ptr = self->ptr;
PropertyRNA *prop = NULL;
const char *prop_name;
BKE_reports_init(&reports, RPT_STORE);
/* Retrieve the property identifier from the full path, since we can't get it any other way */
prop_name = strrchr(path_full, '.');
if ((prop_name >= path_full) &&
@ -334,14 +334,14 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
{
prop = RNA_struct_find_property(&ptr, prop_name + 1);
}
if (prop) {
ID *id = ptr.id.data;
NlaStrip *strip = (NlaStrip *)ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index);
BLI_assert(fcu != NULL); /* NOTE: This should be true, or else we wouldn't be able to get here */
if (BKE_fcurve_is_protected(fcu)) {
BKE_reportf(&reports, RPT_WARNING,
"Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'",
@ -354,7 +354,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
*/
bool found = false;
int i;
/* try to find index of beztriple to get rid of */
i = binarysearch_bezt_index(fcu->bezt, cfra, fcu->totvert, &found);
if (found) {
@ -368,10 +368,10 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
}
MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
return NULL;
return PyBool_FromLong(result);
}
else {
@ -423,7 +423,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
BKE_reports_init(&reports, RPT_STORE);
result = ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index,
result = ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index,
CREATEDRIVER_WITH_FMODIFIER, DRIVER_TYPE_PYTHON);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
@ -449,7 +449,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
ret = pyrna_struct_CreatePyObject(&tptr);
}
WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
}
else {
@ -502,7 +502,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
return NULL;
WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
return PyBool_FromLong(result);

View File

@ -277,10 +277,10 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
* dimsize[1] = 4
* dimsize[2] = 5
* lvalue_dim = 0, totdim = 3
*
*
* arr[2][3] = x
* lvalue_dim = 1
*
*
* arr[2][3][4] = x
* lvalue_dim = 2 */
for (i = lvalue_dim; i < totdim; i++)
@ -805,7 +805,7 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
*
* x = arr[2]
* index = 0 + 2 * 4 * 5
*
*
* x = arr[2][3]
* index = offset + 3 * 5 */

View File

@ -93,7 +93,7 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args)
if (!PyArg_ParseTuple(args, "OO!|s:bpy_struct.callback_add", &cb_func, &PyTuple_Type, &cb_args, &cb_event_str))
return NULL;
if (!PyCallable_Check(cb_func)) {
PyErr_SetString(PyExc_TypeError, "callback_add(): first argument isn't callable");
return NULL;

View File

@ -18,7 +18,7 @@
#
# ***** END GPL LICENSE BLOCK *****
set(INC
set(INC
.
../../blenlib
../../blenkernel

View File

@ -1,4 +1,4 @@
/*
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or

View File

@ -60,10 +60,10 @@ static PyObject *M_Interpolate_poly_3d_calc(PyObject *UNUSED(self), PyObject *ar
float fp[3];
float (*vecs)[3];
Py_ssize_t len;
PyObject *point, *veclist, *ret;
int i;
if (!PyArg_ParseTuple(
args, "OO!:poly_3d_calc",
&veclist,
@ -71,27 +71,27 @@ static PyObject *M_Interpolate_poly_3d_calc(PyObject *UNUSED(self), PyObject *ar
{
return NULL;
}
if (BaseMath_ReadCallback((VectorObject *)point) == -1)
return NULL;
fp[0] = ((VectorObject *)point)->vec[0];
fp[1] = ((VectorObject *)point)->vec[1];
if (((VectorObject *)point)->size > 2)
fp[2] = ((VectorObject *)point)->vec[2];
else
fp[2] = 0.0f; /* if its a 2d vector then set the z to be zero */
len = mathutils_array_parse_alloc_v(((float **)&vecs), 3, veclist, __func__);
if (len == -1) {
return NULL;
}
if (len) {
float *weights = MEM_mallocN(sizeof(float) * len, __func__);
interp_weights_poly_v3(weights, vecs, len, fp);
ret = PyList_New(len);
for (i = 0; i < len; i++) {
PyList_SET_ITEM(ret, i, PyFloat_FromDouble(weights[i]));

View File

@ -671,7 +671,7 @@ static PyObject *M_Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *
if (mathutils_array_parse(vec, 3, 3, value, "hybrid_multi_fractal: invalid 'position' arg") == -1)
return NULL;
return PyFloat_FromDouble(mg_HybridMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, nb));
}