diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-29 12:59:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-29 13:01:10 +0300 |
commit | 778542fd8fe80f87286d36bb4005314a8343e038 (patch) | |
tree | 272d34c618e9cc07b0bac3fc87b6801e3908daa4 /source/blender/python/intern | |
parent | c7f67d60fbe24df942bcde49aadf480ac6622e71 (diff) |
Cleanup: comments (long lines) in python
Diffstat (limited to 'source/blender/python/intern')
-rw-r--r-- | source/blender/python/intern/bpy.c | 3 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_ocio.c | 10 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_translations.c | 22 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_driver.c | 16 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_gizmo_wrap.c | 5 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 3 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_operator.c | 5 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_operator_wrap.c | 8 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 5 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 74 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.h | 11 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_array.c | 8 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_id_collection.c | 15 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_utils_units.c | 12 |
14 files changed, 129 insertions, 68 deletions
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 08f4df543a8..92ba7704b19 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -177,7 +177,8 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj return NULL; } - /* same logic as BKE_appdir_folder_id_create(), but best leave it up to the script author to create */ + /* same logic as BKE_appdir_folder_id_create(), + * but best leave it up to the script author to create */ path = BKE_appdir_folder_id_user_notest(folder_id, subdir); return PyC_UnicodeFromByte(path ? path : ""); diff --git a/source/blender/python/intern/bpy_app_ocio.c b/source/blender/python/intern/bpy_app_ocio.c index 2a56075e00e..9dcadbac2af 100644 --- a/source/blender/python/intern/bpy_app_ocio.c +++ b/source/blender/python/intern/bpy_app_ocio.c @@ -40,10 +40,12 @@ static PyStructSequence_Field app_ocio_info_fields[] = { }; static PyStructSequence_Desc app_ocio_info_desc = { - (char *)"bpy.app.ocio", /* name */ - (char - *)"This module contains information about OpenColorIO blender is linked against", /* doc */ - app_ocio_info_fields, /* fields */ + /* name */ + (char *)"bpy.app.ocio", + /* doc */ + (char *)"This module contains information about OpenColorIO blender is linked against", + /* fields */ + app_ocio_info_fields, ARRAY_SIZE(app_ocio_info_fields) - 1, }; diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c index 56de6dd1405..a48cd742448 100644 --- a/source/blender/python/intern/bpy_app_translations.c +++ b/source/blender/python/intern/bpy_app_translations.c @@ -47,13 +47,16 @@ typedef struct { PyObject_HEAD - /* The string used to separate context from actual message in PY_TRANSLATE RNA props. */ + /** The string used to separate context from actual message in PY_TRANSLATE RNA props. */ const char *context_separator; - /* A "named tuple" (StructSequence actually...) containing all C-defined contexts. */ + /** A "named tuple" (StructSequence actually...) containing all C-defined contexts. */ PyObject *contexts; - /* A readonly mapping {C context id: python id} (actually, a MappingProxy). */ + /** A readonly mapping {C context id: python id} (actually, a MappingProxy). */ PyObject *contexts_C_to_py; - /* A py dict containing all registered py dicts (order is more or less random, first match wins!). */ + /** + * A py dict containing all registered py dicts + * (order is more or less random, first match wins!). + */ PyObject *py_messages; } BlenderAppTranslations; @@ -111,8 +114,8 @@ static void _ghashutil_keyfree(void *ptr) /***** Python's messages cache *****/ /* We cache all messages available for a given locale from all py dicts into a single ghash. - * Changing of locale is not so common, while looking for a message translation is, so let's try to optimize - * the later as much as we can! + * Changing of locale is not so common, while looking for a message translation is, + * so let's try to optimize the later as much as we can! * Note changing of locale, as well as (un)registering a message dict, invalidate that cache. */ static GHash *_translations_cache = NULL; @@ -148,7 +151,8 @@ static void _build_translations_cache(PyObject *py_messages, const char *locale) printf("\n"); # endif - /* Try to get first complete locale, then language+country, then language+variant, then only language */ + /* Try to get first complete locale, then language+country, + * then language+variant, then only language. */ lang_dict = PyDict_GetItemString(uuid_dict, locale); if (!lang_dict && language_country) { lang_dict = PyDict_GetItemString(uuid_dict, language_country); @@ -393,8 +397,8 @@ static PyTypeObject BlenderAppTranslationsContextsType; static BLT_i18n_contexts_descriptor _contexts[] = BLT_I18NCONTEXTS_DESC; /* These fields are just empty placeholders, actual values get set in app_translations_struct(). - * This allows us to avoid many handwriting, and above all, to keep all context definition stuff in BLT_translation.h! - */ + * This allows us to avoid many handwriting, and above all, + * to keep all context definition stuff in BLT_translation.h! */ static PyStructSequence_Field app_translations_contexts_fields[ARRAY_SIZE(_contexts)] = {{NULL}}; static PyStructSequence_Desc app_translations_contexts_desc = { diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 3457e614708..726599ff06e 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -54,7 +54,10 @@ extern void BPY_update_rna_module(void); # include <opcode.h> #endif -/* for pydrivers (drivers using one-line Python expressions to express relationships between targets) */ +/** + * For PyDrivers + * (drivers using one-line Python expressions to express relationships between targets). + */ PyObject *bpy_pydriver_Dict = NULL; #ifdef USE_BYTECODE_WHITELIST @@ -399,8 +402,10 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, { PyObject *driver_vars = NULL; PyObject *retval = NULL; - PyObject * - expr_vars; /* speed up by pre-hashing string & avoids re-converting unicode strings for every execution */ + + /* Speed up by pre-hashing string & avoids re-converting unicode strings for every execution. */ + PyObject *expr_vars; + PyObject *expr_code; PyGILState_STATE gilstate; bool use_gil; @@ -475,8 +480,9 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, PyTuple_SET_ITEM(((PyObject *)driver_orig->expr_comp), 0, expr_code); driver_orig->flag &= ~DRIVER_FLAG_RECOMPILE; - driver_orig->flag |= - DRIVER_FLAG_RENAMEVAR; /* maybe this can be removed but for now best keep until were sure */ + + /* Maybe this can be removed but for now best keep until were sure. */ + driver_orig->flag |= DRIVER_FLAG_RENAMEVAR; #ifdef USE_BYTECODE_WHITELIST is_recompile = true; #endif diff --git a/source/blender/python/intern/bpy_gizmo_wrap.c b/source/blender/python/intern/bpy_gizmo_wrap.c index 41ff630753f..c66cad5f4a3 100644 --- a/source/blender/python/intern/bpy_gizmo_wrap.c +++ b/source/blender/python/intern/bpy_gizmo_wrap.c @@ -116,8 +116,9 @@ static void gizmo_properties_init(wmGizmoType *gzt) /* Extract target property definitions from 'bl_target_properties' */ { - /* picky developers will notice that 'bl_targets' won't work with inheritance - * get direct from the dict to avoid raising a load of attribute errors (yes this isnt ideal) - campbell */ + /* Picky developers will notice that 'bl_targets' won't work with inheritance + * get direct from the dict to avoid raising a load of attribute errors + * (yes this isnt ideal) - campbell. */ PyObject *py_class_dict = py_class->tp_dict; PyObject *bl_target_properties = PyDict_GetItem(py_class_dict, bpy_intern_str_bl_target_properties); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 90dfdcd33b7..ebcb4085597 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -80,7 +80,8 @@ CLG_LOGREF_DECLARE_GLOBAL(BPY_LOG_RNA, "bpy.rna"); /* for internal use, when starting and ending python scripts */ -/* in case a python script triggers another python call, stop bpy_context_clear from invalidating */ +/* In case a python script triggers another python call, + * stop bpy_context_clear from invalidating. */ static int py_call_level = 0; // #define TIME_PY_RUN // simple python tests. prints on exit. diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 0f66a9cbeb9..aef4ab6667a 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -314,8 +314,9 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) return NULL; } - /* when calling bpy.ops.wm.read_factory_settings() bpy.data's main pointer is freed by clear_globals(), - * further access will crash blender. setting context is not needed in this case, only calling because this + /* When calling bpy.ops.wm.read_factory_settings() bpy.data's main pointer + * is freed by clear_globals(), further access will crash blender. + * Setting context is not needed in this case, only calling because this * function corrects bpy.data (internal Main pointer) */ BPY_modules_update(C); diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index 976ed4611b0..8f2f08c7c37 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -45,7 +45,8 @@ static void operator_properties_init(wmOperatorType *ot) /* Only call this so pyrna_deferred_register_class gives a useful error * WM_operatortype_append_ptr will call RNA_def_struct_identifier later. * - * Note the 'no_struct_map' function is used since the actual struct name is already used by the operator. + * Note the 'no_struct_map' function is used since the actual struct name + * is already used by the operator. */ RNA_def_struct_identifier_no_struct_map(ot->srna, ot->idname); @@ -56,8 +57,9 @@ static void operator_properties_init(wmOperatorType *ot) /* set the default property: ot->prop */ { - /* picky developers will notice that 'bl_property' won't work with inheritance - * get direct from the dict to avoid raising a load of attribute errors (yes this isnt ideal) - campbell */ + /* Picky developers will notice that 'bl_property' won't work with inheritance + * get direct from the dict to avoid raising a load of attribute errors (yes this isnt ideal) + * - campbell. */ PyObject *py_class_dict = py_class->tp_dict; PyObject *bl_property = PyDict_GetItem(py_class_dict, bpy_intern_str_bl_property); const char *prop_id; diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index a0a6c73fe1f..074d72f094f 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -2277,7 +2277,10 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject return NULL; } - // prop = RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name ? name : id, description); +#if 0 + prop = RNA_def_boolean_array( + srna, id, size, pydef ? def : NULL, name ? name : id, description); +#endif prop = RNA_def_property(srna, id, PROP_BOOLEAN, subtype); RNA_def_property_array(prop, size); if (pydef) { diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 0ca96071ee0..98124464835 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -189,7 +189,8 @@ static void id_weakref_pool_add(ID *id, BPy_DummyPointerRNA *pyrna) PyObject *weakref_capsule; PyObject *weakref_cb_py; - /* create a new function instance and insert the list as 'self' so we can remove ourself from it */ + /* Create a new function instance and insert the list as 'self' + * so we can remove ourself from it. */ GHash *weakinfo_hash = id_weakref_pool_get(id); /* new or existing */ weakref_capsule = PyCapsule_New(weakinfo_hash, NULL, NULL); @@ -704,7 +705,8 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) case PROP_QUATERNION: if (len == 3) { /* euler */ if (is_thick) { - /* attempt to get order, only needed for thick types since wrapped with update via callbacks */ + /* Attempt to get order, + * only needed for thick types since wrapped with update via callbacks. */ PropertyRNA *prop_eul_order = NULL; short order = pyrna_rotation_euler_order_get(ptr, EULER_ORDER_XYZ, &prop_eul_order); @@ -1433,7 +1435,8 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) RNA_property_enum_items_ex(NULL, ptr, prop, true, &enum_item, NULL, &free_dummy); BLI_assert(!free_dummy); - /* Do not print warning in case of DummyRNA_NULL_items, this one will never match any value... */ + /* Do not print warning in case of DummyRNA_NULL_items, + * this one will never match any value... */ if (enum_item != DummyRNA_NULL_items) { const char *ptr_name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL); @@ -1846,7 +1849,8 @@ static int pyrna_py_to_prop( } else { /* same as bytes */ - /* XXX, this is suspect but needed for function calls, need to see if theres a better way */ + /* XXX, this is suspect but needed for function calls, + * need to see if theres a better way. */ if (data) { *((char **)data) = (char *)param; } @@ -1902,7 +1906,8 @@ static int pyrna_py_to_prop( * if the prop is not an operator type and the pyobject is an operator, * use its properties in place of its self. * - * this is so bad that its almost a good reason to do away with fake 'self.properties -> self' + * This is so bad that its almost a good reason to do away with fake + * 'self.properties -> self' * class mixing if this causes problems in the future it should be removed. */ if ((ptr_type == &RNA_AnyType) && (BPy_StructRNA_Check(value))) { @@ -1997,8 +2002,9 @@ static int pyrna_py_to_prop( } } else { - /* for function calls, we sometimes want to pass the 'ptr' directly, - * watch out that it remains valid!, possibly we could support this later if needed */ + /* For function calls, we sometimes want to pass the 'ptr' directly, + * watch out that it remains valid!, + * possibly we could support this later if needed. */ BLI_assert(value_new == NULL); if (value == Py_None) { *((void **)data) = NULL; @@ -4187,8 +4193,8 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) ret = NULL; } else if ( - name[0] == - '_') { /* rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups */ + /* rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups */ + name[0] == '_') { /* annoying exception, maybe we need to have different types for this... */ if (STR_ELEM(name, "__getitem__", "__setitem__") && !RNA_struct_idprops_check(self->ptr.type)) { @@ -4312,9 +4318,11 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr * >>> bpy.types.Scene.foo = BoolProperty() * >>> bpy.types.Scene.foo * <bpy_struct, BoolProperty("foo")> - * ...rather than returning the deferred class register tuple as checked by pyrna_is_deferred_prop() + * ...rather than returning the deferred class register tuple + * as checked by pyrna_is_deferred_prop() * - * Disable for now, this is faking internal behavior in a way that's too tricky to maintain well. */ + * Disable for now, + * this is faking internal behavior in a way that's too tricky to maintain well. */ # if 0 if (ret == NULL) { // || pyrna_is_deferred_prop(ret) StructRNA *srna = srna_from_self(cls, "StructRNA.__getattr__"); @@ -4424,7 +4432,8 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject } } else if (self->ptr.type == &RNA_Context) { - /* code just raises correct error, context prop's cant be set, unless its apart of the py class */ + /* Code just raises correct error, context prop's cant be set, + * unless its apart of the py class. */ bContext *C = self->ptr.data; if (C == NULL) { PyErr_Format(PyExc_AttributeError, @@ -5105,7 +5114,8 @@ static int foreach_parse_args(BPy_PropertyRNA *self, } *size = RNA_raw_type_sizeof(*raw_type); -#if 0 /* works fine but not strictly needed, we could allow RNA_property_collection_raw_* to do the checks */ +#if 0 /* works fine but not strictly needed, + * we could allow RNA_property_collection_raw_* to do the checks */ if ((*attr_tot) < 1) { *attr_tot = 1; } @@ -5130,8 +5140,9 @@ static int foreach_parse_args(BPy_PropertyRNA *self, #endif } - /* check 'attr_tot' otherwise we don't know if any values were set - * this isn't ideal because it means running on an empty list may fail silently when its not compatible. */ + /* Check 'attr_tot' otherwise we don't know if any values were set + * this isn't ideal because it means running on an empty list may + * fail silently when its not compatible. */ if (*size == 0 && *attr_tot != 0) { PyErr_SetString(PyExc_AttributeError, "attribute does not support foreach method"); return -1; @@ -5997,7 +6008,8 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject /* Check if we gave args that don't exist in the function * printing the error is slow but it should only happen when developing. * the if below is quick, checking if it passed less keyword args then we gave. - * (Don't overwrite the error if we have one, otherwise can skip important messages and confuse with args) + * (Don't overwrite the error if we have one, + * otherwise can skip important messages and confuse with args). */ if (err == 0 && kw && (pykw_len > kw_tot)) { PyObject *key, *value; @@ -6894,7 +6906,8 @@ static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA * if ((PyObject *)pyrna != Py_None) { /* hold a reference to the iterator since it may have * allocated memory 'pyrna' needs. eg: introspecting dynamic enum's */ - /* TODO, we could have an api call to know if this is needed since most collections don't */ + /* TODO, we could have an api call to know if this is + * needed since most collections don't */ pyrna_struct_reference_set(pyrna, (PyObject *)self); } } @@ -7025,8 +7038,10 @@ static PyObject *pyrna_srna_ExternalType(StructRNA *srna) /* sanity check, could skip this unless in debug mode */ if (newclass) { PyObject *base_compare = pyrna_srna_PyBase(srna); - //PyObject *slots = PyObject_GetAttrString(newclass, "__slots__"); // cant do this because it gets superclasses values! - //PyObject *bases = PyObject_GetAttrString(newclass, "__bases__"); // can do this but faster not to. + /* Can't do this because it gets superclasses values! */ + // PyObject *slots = PyObject_GetAttrString(newclass, "__slots__"); + /* Can do this but faster not to. */ + // PyObject *bases = PyObject_GetAttrString(newclass, "__bases__"); PyObject *tp_bases = ((PyTypeObject *)newclass)->tp_bases; PyObject *tp_slots = PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict, bpy_intern_str___slots__); @@ -7077,7 +7092,10 @@ static PyObject *pyrna_srna_Subtype(StructRNA *srna) /* subclass equivalents * - class myClass(myBase): * some = 'value' # or ... - * - myClass = type(name='myClass', bases=(myBase,), dict={'__module__': 'bpy.types', '__slots__': ()}) + * - myClass = type( + * name='myClass', + * bases=(myBase,), dict={'__module__': 'bpy.types', '__slots__': ()} + * ) */ /* Assume RNA_struct_py_type_get(srna) was already checked */ @@ -7132,7 +7150,8 @@ static PyObject *pyrna_srna_Subtype(StructRNA *srna) } #endif - /* newclass will now have 2 ref's, ???, probably 1 is internal since decrefing here segfaults */ + /* Newclass will now have 2 ref's, ???, + * probably 1 is internal since decrefing here segfaults. */ /* PyC_ObSpit("new class ref", newclass); */ @@ -7884,7 +7903,8 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, const int flag = RNA_function_flag(func); /* TODO(campbell): this is used for classmethod's too, * even though class methods should have 'FUNC_USE_SELF_TYPE' set, see Operator.poll for eg. - * Keep this as-is since its working but we should be using 'FUNC_USE_SELF_TYPE' for many functions. */ + * Keep this as-is since its working but we should be using + * 'FUNC_USE_SELF_TYPE' for many functions. */ const bool is_staticmethod = (flag & FUNC_NO_SELF) && !(flag & FUNC_USE_SELF_TYPE); if (!(flag & FUNC_REGISTER)) { @@ -7909,8 +7929,9 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, PyErr_Clear(); } else { - Py_DECREF( - item); /* no need to keep a ref, the class owns it (technically we should keep a ref but...) */ + /* No need to keep a ref, the class owns it (technically we should keep a ref but...). */ + Py_DECREF(item); + if (is_staticmethod) { if (PyMethod_Check(item) == 0) { PyErr_Format(PyExc_TypeError, @@ -8198,7 +8219,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param else { arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount; } - // args = PyTuple_New(rna_function_arg_count(func)); /* first arg is included in 'item' */ +#if 0 + /* First arg is included in 'item'. */ + args = PyTuple_New(rna_function_arg_count(func)); +#endif args = PyTuple_New(arg_count); /* first arg is included in 'item' */ if (is_staticmethod) { diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 588c3cbf171..cf6bd54d8a5 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -24,7 +24,10 @@ /* --- bpy build options --- */ #ifdef WITH_PYTHON_SAFETY -/* play it safe and keep optional for now, need to test further now this affects looping on 10000's of verts for eg. */ +/** + * Play it safe and keep optional for now, + * need to test further now this affects looping on 10000's of verts for eg. + */ # define USE_WEAKREFS /* method to invalidate removed py data, XXX, slow to remove objects, otherwise no overhead */ @@ -146,8 +149,10 @@ typedef struct { PropertyRNA *prop; /* Arystan: this is a hack to allow sub-item r/w access like: face.uv[n][m] */ - int arraydim; /* array dimension, e.g: 0 for face.uv, 2 for face.uv[n][m], etc. */ - int arrayoffset; /* array first item offset, e.g. if face.uv is [4][2], arrayoffset for face.uv[n] is 2n */ + /** Array dimension, e.g: 0 for face.uv, 2 for face.uv[n][m], etc. */ + int arraydim; + /** Array first item offset, e.g. if face.uv is [4][2], arrayoffset for face.uv[n] is 2n. */ + int arrayoffset; } BPy_PropertyArrayRNA; typedef struct { diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index 847ecde354a..9d8fff5dfe4 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -86,7 +86,8 @@ typedef struct ItemConvert_FuncArg { */ /* 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. */ +/* Ensures that a python sequence has expected number of + * items/sub-items and items are of desired type. */ static int validate_array_type(PyObject *seq, int dim, int totdim, @@ -203,7 +204,10 @@ static int validate_array_type(PyObject *seq, else if (!check_item_type(item)) { Py_DECREF(item); - /* BLI_snprintf(error_str, error_str_size, "sequence items should be of type %s", item_type_str); */ +#if 0 + BLI_snprintf( + error_str, error_str_size, "sequence items should be of type %s", item_type_str); +#endif PyErr_Format(PyExc_TypeError, "%s expected sequence items of type %s, not %s", error_prefix, diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c index 78dae50efe6..dfd7624bd3d 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.c +++ b/source/blender/python/intern/bpy_rna_id_collection.c @@ -34,7 +34,8 @@ #include "BKE_main.h" #include "DNA_ID.h" -/* Those folowing are only to support hack of not listing some internal 'backward' pointers in generated user_map... */ +/* Those folowing are only to support hack of not listing some internal + * 'backward' pointers in generated user_map. */ #include "DNA_object_types.h" #include "DNA_key_types.h" @@ -97,11 +98,13 @@ static int foreach_libblock_id_user_map_callback(void *user_data, } if ((GS(self_id->name) == ID_OB) && (id_p == (ID **)&((Object *)self_id)->proxy_from)) { - /* We skip proxy_from here, since it's some internal pointer which is not relevant info for py/API level. */ + /* We skip proxy_from here, + * since it's some internal pointer which is not relevant info for py/API level. */ return IDWALK_RET_NOP; } else if ((GS(self_id->name) == ID_KE) && (id_p == (ID **)&((Key *)self_id)->from)) { - /* We skip from here, since it's some internal pointer which is not relevant info for py/API level. */ + /* We skip from here, + * since it's some internal pointer which is not relevant info for py/API level. */ return IDWALK_RET_NOP; } @@ -245,14 +248,16 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject * if (!data_cb.is_subset && /* We do not want to pre-add keys of flitered out types. */ (key_types_bitmap == NULL || id_check_type(id, key_types_bitmap)) && - /* We do not want to pre-add keys when we have filter on value types, but not on key types. */ + /* We do not want to pre-add keys when we have filter on value types, + * but not on key types. */ (val_types_bitmap == NULL || key_types_bitmap != NULL)) { PyObject *key = data_cb.py_id_key_lookup_only; PyObject *set; RNA_id_pointer_create(id, &((BPy_StructRNA *)key)->ptr); - /* We have to insert the key now, otherwise ID unused would be missing from final dict... */ + /* We have to insert the key now, + * otherwise ID unused would be missing from final dict... */ if ((set = PyDict_GetItem(data_cb.user_map, key)) == NULL) { /* Cannot use our placeholder key here! */ key = pyrna_id_CreatePyObject(id); diff --git a/source/blender/python/intern/bpy_utils_units.c b/source/blender/python/intern/bpy_utils_units.c index b80ea50dd09..645b7e1c7af 100644 --- a/source/blender/python/intern/bpy_utils_units.c +++ b/source/blender/python/intern/bpy_utils_units.c @@ -66,8 +66,8 @@ static const char *bpyunits_ucategorie_items[] = { /** * These fields are just empty placeholders, actual values get set in initializations functions. - * This allows us to avoid many handwriting, and above all, to keep all systems/categories definition stuff in - * ``BKE_unit.h``. + * This allows us to avoid many handwriting, and above all, + * to keep all systems/categories definition stuff in ``BKE_unit.h``. */ static PyStructSequence_Field bpyunits_systems_fields[ARRAY_SIZE(bpyunits_usystem_items)]; static PyStructSequence_Field bpyunits_categories_fields[ARRAY_SIZE(bpyunits_ucategorie_items)]; @@ -281,9 +281,11 @@ static PyObject *bpyunits_to_string(PyObject *UNUSED(self), PyObject *args, PyOb { /* Maximum expected length of string result: - * - number itself: precision + decimal dot + up to four 'above dot' digits. - * - unit: up to ten chars (six currently, let's be conservative, also because we use some utf8 chars). - * This can be repeated twice (e.g. 1m20cm), and we add ten more spare chars (spaces, trailing '\0'...). + * - Number itself: precision + decimal dot + up to four 'above dot' digits. + * - Unit: up to ten chars + * (six currently, let's be conservative, also because we use some utf8 chars). + * This can be repeated twice (e.g. 1m20cm), and we add ten more spare chars + * (spaces, trailing '\0'...). * So in practice, 64 should be more than enough. */ char buf1[64], buf2[64], *str; |