diff options
Diffstat (limited to 'source/blender/python/intern')
-rw-r--r-- | source/blender/python/intern/bpy.c | 6 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_handlers.c | 8 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 4 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 67 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_array.c | 74 |
5 files changed, 84 insertions, 75 deletions
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index e0e3dd5519c..0f5ca13586c 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -227,9 +227,9 @@ static PyObject *bpy_import_test(const char *modname) return mod; } -/***************************************************************************** -* Description: Creates the bpy module and adds it to sys.modules for importing -*****************************************************************************/ +/****************************************************************************** + * Description: Creates the bpy module and adds it to sys.modules for importing + ******************************************************************************/ void BPy_init_modules(void) { extern BPy_StructRNA *bpy_context_module; diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index 721bce51693..f4962cd39b6 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -68,11 +68,11 @@ static PyStructSequence_Desc app_cb_info_desc = { (sizeof(app_cb_info_fields) / sizeof(PyStructSequence_Field)) - 1 }; -/* -#if (BLI_CB_EVT_TOT != ((sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field)))) -# error "Callbacks are out of sync" +#if 0 +# if (BLI_CB_EVT_TOT != ((sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field)))) +# error "Callbacks are out of sync" +# endif #endif -*/ /* --------------------------------------------------------------------------*/ /* permanent tagging code */ diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 413b29e7e2d..2f03fd6974f 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -671,11 +671,11 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult * PyObject *list_item = PySequence_Fast_GET_ITEM(seq_fast, i); if (BPy_StructRNA_Check(list_item)) { - /* +#if 0 CollectionPointerLink *link = MEM_callocN(sizeof(CollectionPointerLink), "bpy_context_get"); link->ptr = ((BPy_StructRNA *)item)->ptr; BLI_addtail(&result->list, link); - */ +#endif ptr = &(((BPy_StructRNA *)list_item)->ptr); CTX_data_list_add(result, ptr->id.data, ptr->type, ptr->data); } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index ab6d23ba4db..5fbfb75555f 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1309,11 +1309,11 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) if (free) MEM_freeN(enum_item); - /* +#if 0 PyErr_Format(PyExc_AttributeError, "RNA Error: Current value \"%d\" matches no enum", val); ret = NULL; - */ +#endif } } @@ -2549,10 +2549,12 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject { PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self); - /*if (PyUnicode_Check(key)) { +#if 0 + if (PyUnicode_Check(key)) { return pyrna_prop_array_subscript_str(self, _PyUnicode_AsString(key)); } - else */ + else +#endif if (PyIndex_Check(key)) { Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError); if (i == -1 && PyErr_Occurred()) @@ -3576,14 +3578,14 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb if (srna == NULL) { /* allow setting on unregistered classes which can be registered later on */ - /* +#if 0 if (value && is_deferred_prop) { PyErr_Format(PyExc_AttributeError, "pyrna_struct_meta_idprop_setattro() unable to get srna from class '%.200s'", ((PyTypeObject *)cls)->tp_name); return -1; } - */ +#endif /* srna_from_self may set an error */ PyErr_Clear(); return PyType_Type.tp_setattro(cls, attr, value); @@ -4571,14 +4573,14 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject * else if (PyType_IsSubtype(Py_TYPE(base), &pyrna_struct_Type)) { /* this almost never runs, only when using user defined subclasses of built-in object. * this isn't common since its NOT related to registerable subclasses. eg: - - >>> class MyObSubclass(bpy.types.Object): - ... def test_func(self): - ... print(100) - ... - >>> myob = MyObSubclass(bpy.context.object) - >>> myob.test_func() - 100 + * + * >>> class MyObSubclass(bpy.types.Object): + * ... def test_func(self): + * ... print(100) + * ... + * >>> myob = MyObSubclass(bpy.context.object) + * >>> myob.test_func() + * 100 * * Keep this since it could be useful. */ @@ -4866,7 +4868,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject } /* for testing */ - /* +#if 0 { const char *fn; int lineno; @@ -4874,7 +4876,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject printf("pyrna_func_call > %.200s.%.200s : %.200s:%d\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), fn, lineno); } - */ +#endif /* include the ID pointer for pyrna_param_to_py() so we can include the * ID pointer on return values, this only works when returned values have @@ -5104,14 +5106,14 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject #ifdef DEBUG_STRING_FREE - /* +#if 0 if (PyList_GET_SIZE(string_free_ls)) { printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_GET_SIZE(string_free_ls)); } - */ +#endif Py_DECREF(string_free_ls); #undef DEBUG_STRING_FREE #endif @@ -6018,10 +6020,10 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna) * mainly for the purposing of matching the C/rna type hierarchy */ else { /* subclass equivalents - - class myClass(myBase): - some = 'value' # or ... - - myClass = type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'}) - */ + * - class myClass(myBase): + * some = 'value' # or ... + * - myClass = type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'}) + */ /* Assume RNA_struct_py_type_get(srna) was already checked */ PyObject *py_base = pyrna_srna_PyBase(srna); @@ -6523,8 +6525,10 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item /* Since this is a class dict, ignore args that can't be passed */ /* for testing only */ - /* PyC_ObSpit("Why doesn't this work??", item); - PyErr_Print(); */ +#if 0 + PyC_ObSpit("Why doesn't this work??", item); + PyErr_Print(); +#endif PyErr_Clear(); } } @@ -6886,9 +6890,12 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param rna_disallow_writes = TRUE; /* 'almost' all the time calling the class isn't needed. - * We could just do... + * We could just do... */ +#if 0 py_class_instance = py_srna; Py_INCREF(py_class_instance); +#endif + /* * This would work fine but means __init__ functions wouldnt run. * none of blenders default scripts use __init__ but its nice to call it * for general correctness. just to note why this is here when it could be safely removed. @@ -7230,14 +7237,14 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class return NULL; /* fails in cases, cant use this check but would like to :| */ - /* +#if 0 if (RNA_struct_py_type_get(srna)) { PyErr_Format(PyExc_ValueError, "register_class(...): %.200s's parent class %.200s is already registered, this is not allowed", ((PyTypeObject *)py_class)->tp_name, RNA_struct_identifier(srna)); return NULL; } - */ +#endif /* check that we have a register callback for this type */ reg = RNA_struct_register(srna); @@ -7352,11 +7359,13 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla return NULL; } - /*if (PyDict_GetItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna) == NULL) { +#if 0 + if (PyDict_GetItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna) == NULL) { PWM_cursor_wait(0); PyErr_SetString(PyExc_ValueError, "unregister_class(): not a registered as a subclass"); return NULL; - }*/ + } +#endif if (!pyrna_write_check()) { PyErr_Format(PyExc_RuntimeError, diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index a74d0417ca2..187db194c36 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -50,17 +50,17 @@ typedef void (*RNA_SetArrayFunc)(PointerRNA *, PropertyRNA *, const char *); typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *); /* - arr[3][4][5] - 0 1 2 <- dimension index -*/ + * arr[3][4][5] + * 0 1 2 <- dimension index + */ /* - arr[2] = x - - py_to_array_index(arraydim=0, arrayoffset=0, index=2) - validate_array(lvalue_dim=0) - ... make real index ... -*/ + * arr[2] = x + * + * py_to_array_index(arraydim=0, arrayoffset=0, index=2) + * validate_array(lvalue_dim=0) + * ... make real index ... + */ /* arr[3] = x, self->arraydim is 0, lvalue_dim is 1 */ /* Ensures that a python sequence has expected number of items/sub-items and items are of desired type. */ @@ -101,8 +101,8 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[] * dim = 0 */ else if (PySequence_Size(item) != dimsize[dim + 1]) { /* BLI_snprintf(error_str, error_str_size, - "sequences of dimension %d should contain %d items", - (int)dim + 1, (int)dimsize[dim + 1]); */ + * "sequences of dimension %d should contain %d items", + * (int)dim + 1, (int)dimsize[dim + 1]); */ PyErr_Format(PyExc_ValueError, "%s sequences of dimension %d should contain %d items", error_prefix, (int)dim + 1, (int)dimsize[dim + 1]); ok = 0; @@ -205,8 +205,8 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA /* length is flexible */ if (!RNA_property_dynamic_array_set_length(ptr, prop, tot)) { /* BLI_snprintf(error_str, error_str_size, - "%s.%s: array length cannot be changed to %d", - RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */ + * "%s.%s: array length cannot be changed to %d", + * RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */ PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); return -1; @@ -232,18 +232,18 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA len = 1; /* arr[3][4][5] - - arr[2] = x - dimsize = {4, 5} - 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 */ + * + * arr[2] = x + * dimsize = {4, 5} + * 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++) len *= dimsize[i]; } @@ -462,12 +462,12 @@ static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, /* convert index */ /* arr[3][4][5] - - arr[2] = x - lvalue_dim = 0, index = 0 + 2 * 4 * 5 - - arr[2][3] = x - lvalue_dim = 1, index = 40 + 3 * 5 */ + * + * arr[2] = x + * lvalue_dim = 0, index = 0 + 2 * 4 * 5 + * + * arr[2][3] = x + * lvalue_dim = 1, index = 40 + 3 * 5 */ lvalue_dim++; @@ -677,12 +677,12 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr, ret->arraydim = arraydim + 1; /* arr[3][4][5] - - x = arr[2] - index = 0 + 2 * 4 * 5 - - x = arr[2][3] - index = offset + 3 * 5 */ + * + * x = arr[2] + * index = 0 + 2 * 4 * 5 + * + * x = arr[2][3] + * index = offset + 3 * 5 */ for (i = arraydim + 1; i < totdim; i++) index *= dimsize[i]; |