diff options
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/generic/bgl.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app.c | 29 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_capi_utils.h | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 364 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_anim.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_id_collection.c | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Matrix.c | 11 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Quaternion.c | 13 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Vector.c | 17 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_geometry.c | 6 |
11 files changed, 264 insertions, 186 deletions
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 5471fc25f37..2ad2794c76f 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -487,7 +487,7 @@ static int gl_buffer_type_from_py_buffer(Py_buffer *pybuffer) return -1; /* UNKNOWN */ } -static bool compare_dimensions(int ndim, int *dim1, Py_ssize_t *dim2) +static bool compare_dimensions(int ndim, const int *dim1, const Py_ssize_t *dim2) { for (int i = 0; i < ndim; i++) { if (dim1[i] != dim2[i]) { diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 957d49eb04e..4ee936aff91 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -50,7 +50,6 @@ #include "BKE_appdir.h" #include "BKE_blender_version.h" #include "BKE_global.h" -#include "BKE_lib_override.h" #include "DNA_ID.h" @@ -392,29 +391,6 @@ static PyObject *bpy_app_autoexec_fail_message_get(PyObject *UNUSED(self), void return PyC_UnicodeFromByte(G.autoexec_fail); } -PyDoc_STRVAR(bpy_app_use_override_library_doc, - "Boolean, whether library override is exposed in UI or not."); -static PyObject *bpy_app_use_override_library_get(PyObject *UNUSED(self), void *UNUSED(closure)) -{ - return PyBool_FromLong((long)BKE_lib_override_library_is_enabled()); -} - -static int bpy_app_use_override_library_set(PyObject *UNUSED(self), - PyObject *value, - void *UNUSED(closure)) -{ - const int param = PyC_Long_AsBool(value); - - if (param == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "bpy.app.use_override_library must be a boolean"); - return -1; - } - - BKE_lib_override_library_enable((const bool)param); - - return 0; -} - static PyGetSetDef bpy_app_getsets[] = { {"debug", bpy_app_debug_get, bpy_app_debug_set, bpy_app_debug_doc, (void *)G_DEBUG}, {"debug_ffmpeg", @@ -485,11 +461,6 @@ static PyGetSetDef bpy_app_getsets[] = { (void *)G_DEBUG_GPU_MEM}, {"debug_io", bpy_app_debug_get, bpy_app_debug_set, bpy_app_debug_doc, (void *)G_DEBUG_IO}, - {"use_override_library", - bpy_app_use_override_library_get, - bpy_app_use_override_library_set, - bpy_app_use_override_library_doc, - NULL}, {"use_event_simulate", bpy_app_global_flag_get, bpy_app_global_flag_set__only_disable, diff --git a/source/blender/python/intern/bpy_capi_utils.h b/source/blender/python/intern/bpy_capi_utils.h index fe086b61097..97344ce1326 100644 --- a/source/blender/python/intern/bpy_capi_utils.h +++ b/source/blender/python/intern/bpy_capi_utils.h @@ -48,6 +48,6 @@ struct bContext *BPy_GetContext(void); void BPy_SetContext(struct bContext *C); extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate); -extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate); +extern void bpy_context_clear(struct bContext *C, const PyGILState_STATE *gilstate); #endif /* __BPY_CAPI_UTILS_H__ */ diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 6da1715b02d..be5a92309f2 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -136,7 +136,7 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate) } /* context should be used but not now because it causes some bugs */ -void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate) +void bpy_context_clear(bContext *UNUSED(C), const PyGILState_STATE *gilstate) { py_call_level--; diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 3df0d805c5b..a1f9d4afc51 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -88,6 +88,37 @@ static const EnumPropertyItem property_flag_enum_items[] = { "'LIBRARY_EDITABLE'].\n" \ " :type options: set\n" +static const EnumPropertyItem property_flag_override_items[] = { + {PROPOVERRIDE_OVERRIDABLE_LIBRARY, + "LIBRARY_OVERRIDABLE", + 0, + "Library Overridable", + "Allow that property to be overridable from library linked data-blocks"}, + {0, NULL, 0, NULL, NULL}, +}; + +#define BPY_PROPDEF_OPTIONS_OVERRIDE_DOC \ + " :arg options: Enumerator in ['LIBRARY_OVERRIDE'].\n" \ + " :type options: set\n" + +static const EnumPropertyItem property_flag_override_collection_items[] = { + {PROPOVERRIDE_OVERRIDABLE_LIBRARY, + "LIBRARY_OVERRIDABLE", + 0, + "Library Overridable", + "Make that property editable in library overrides of linked data-blocks"}, + {PROPOVERRIDE_NO_PROP_NAME, + "NO_PROPERTY_NAME", + 0, + "No Name", + "Do not use the names of the items, only their indices in the collection"}, + {0, NULL, 0, NULL, NULL}, +}; + +#define BPY_PROPDEF_OPTIONS_OVERRIDE_COLLECTION_DOC \ + " :arg options: Enumerator in ['LIBRARY_OVERRIDE', 'NO_PROPERTY_NAME'].\n" \ + " :type options: set\n" + /* subtypes */ /* XXX Keep in sync with rna_rna.c's rna_enum_property_subtype_items ??? * Currently it is not... @@ -202,6 +233,11 @@ static void bpy_prop_assign_flag(PropertyRNA *prop, const int flag) } } +static void bpy_prop_assign_flag_override(PropertyRNA *prop, const int flag_override) +{ + RNA_def_property_override_flag(prop, flag_override); +} + /* operators and classes use this so it can store the args given but defer * running it until the operator runs where these values are used to setup * the default args for that operator instance */ @@ -1959,7 +1995,7 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, /* terse macros for error checks shared between all funcs cant use function * calls because of static strings passed to pyrna_set_to_enum_bitfield */ -#define BPY_PROPDEF_CHECK(_func, _property_flag_items) \ +#define BPY_PROPDEF_CHECK(_func, _property_flag_items, _property_flag_override_items) \ if (UNLIKELY(id_len >= MAX_IDPROP_NAME)) { \ PyErr_Format(PyExc_TypeError, \ #_func "(): '%.200s' too long, max length is %d", \ @@ -1975,6 +2011,12 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, _property_flag_items, pyopts, &opts, #_func "(options={ ...}):"))) { \ return NULL; \ } \ + if (UNLIKELY(pyopts_override && pyrna_set_to_enum_bitfield(_property_flag_override_items, \ + pyopts_override, \ + &opts_override, \ + #_func "(override={ ...}):"))) { \ + return NULL; \ + } \ { \ const EnumPropertyItem *tag_defines = RNA_struct_property_tag_defines(srna); \ if (py_tags && !tag_defines) { \ @@ -1990,8 +2032,9 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, } \ (void)0 -#define BPY_PROPDEF_SUBTYPE_CHECK(_func, _property_flag_items, _subtype) \ - BPY_PROPDEF_CHECK(_func, _property_flag_items); \ +#define BPY_PROPDEF_SUBTYPE_CHECK( \ + _func, _property_flag_items, _property_flag_override_items, _subtype) \ + BPY_PROPDEF_CHECK(_func, _property_flag_items, _property_flag_override_items); \ if (UNLIKELY(pysubtype && RNA_enum_value_from_id(_subtype, pysubtype, &subtype) == 0)) { \ const char *enum_str = BPy_enum_as_string(_subtype); \ PyErr_Format(PyExc_TypeError, \ @@ -2099,7 +2142,8 @@ PyDoc_STRVAR(BPy_BoolProperty_doc, "description=\"\", " "default=False, " "options={'ANIMATABLE'}, " - "tags={}, " + "override=set(), " + "tags=set(), " "subtype='NONE', " "update=None, " "get=None, " @@ -2107,8 +2151,9 @@ PyDoc_STRVAR(BPy_BoolProperty_doc, "\n" " Returns a new boolean property definition.\n" "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_OPTIONS_DOC - BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC BPY_PROPDEF_UPDATE_DOC - BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); + BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC + BPY_PROPDEF_SUBTYPE_NUMBER_DOC BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC + BPY_PROPDEF_SET_DOC); static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -2121,7 +2166,9 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) bool def = false; PropertyRNA *prop; PyObject *pyopts = NULL; + PyObject *pyopts_override = NULL; int opts = 0; + int opts_override = 0; int prop_tags = 0; const char *pysubtype = NULL; int subtype = PROP_NONE; @@ -2136,6 +2183,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) "description", "default", "options", + "override", "tags", "subtype", "update", @@ -2143,7 +2191,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) "set", NULL, }; - static _PyArg_Parser _parser = {"s#|ssO&O!O!sOOO:BoolProperty", _keywords, 0}; + static _PyArg_Parser _parser = {"s#|ssO&O!O!O!sOOO:BoolProperty", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, @@ -2156,6 +2204,8 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) &PySet_Type, &pyopts, &PySet_Type, + &pyopts_override, + &PySet_Type, &py_tags, &pysubtype, &update_cb, @@ -2164,7 +2214,10 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - BPY_PROPDEF_SUBTYPE_CHECK(BoolProperty, property_flag_items, property_subtype_number_items); + BPY_PROPDEF_SUBTYPE_CHECK(BoolProperty, + property_flag_items, + property_flag_override_items, + property_subtype_number_items); if (bpy_prop_callback_check(update_cb, "update", 2) == -1) { return NULL; @@ -2186,6 +2239,9 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) if (pyopts) { bpy_prop_assign_flag(prop, opts); } + if (pyopts_override) { + bpy_prop_assign_flag_override(prop, opts_override); + } bpy_prop_callback_assign_update(prop, update_cb); bpy_prop_callback_assign_boolean(prop, get_cb, set_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -2194,24 +2250,26 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) Py_RETURN_NONE; } -PyDoc_STRVAR(BPy_BoolVectorProperty_doc, - ".. function:: BoolVectorProperty(name=\"\", " - "description=\"\", " - "default=(False, False, False), " - "options={'ANIMATABLE'}, " - "tags={}, " - "subtype='NONE', " - "size=3, " - "update=None, " - "get=None, " - "set=None)\n" - "\n" - " Returns a new vector boolean property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC - " :arg default: sequence of booleans the length of *size*.\n" - " :type default: sequence\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_TAGS_DOC - BPY_PROPDEF_SUBTYPE_ARRAY_DOC BPY_PROPDEF_VECSIZE_DOC BPY_PROPDEF_UPDATE_DOC - BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); +PyDoc_STRVAR( + BPy_BoolVectorProperty_doc, + ".. function:: BoolVectorProperty(name=\"\", " + "description=\"\", " + "default=(False, False, False), " + "options={'ANIMATABLE'}, " + "override=set(), " + "tags=set(), " + "subtype='NONE', " + "size=3, " + "update=None, " + "get=None, " + "set=None)\n" + "\n" + " Returns a new vector boolean property definition.\n" + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC + " :arg default: sequence of booleans the length of *size*.\n" + " :type default: sequence\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC + BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_ARRAY_DOC BPY_PROPDEF_VECSIZE_DOC + BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -2226,7 +2284,9 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject PropertyRNA *prop; PyObject *pydef = NULL; PyObject *pyopts = NULL; + PyObject *pyopts_override = NULL; int opts = 0; + int opts_override = 0; int prop_tags = 0; const char *pysubtype = NULL; int subtype = PROP_NONE; @@ -2241,6 +2301,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject "description", "default", "options", + "override", "tags", "subtype", "size", @@ -2249,7 +2310,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject "set", NULL, }; - static _PyArg_Parser _parser = {"s#|ssOO!O!siOOO:BoolVectorProperty", _keywords, 0}; + static _PyArg_Parser _parser = {"s#|ssOO!O!O!siOOO:BoolVectorProperty", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, @@ -2261,6 +2322,8 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject &PySet_Type, &pyopts, &PySet_Type, + &pyopts_override, + &PySet_Type, &py_tags, &pysubtype, &size, @@ -2270,8 +2333,10 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject return NULL; } - BPY_PROPDEF_SUBTYPE_CHECK( - BoolVectorProperty, property_flag_items, property_subtype_array_items); + BPY_PROPDEF_SUBTYPE_CHECK(BoolVectorProperty, + property_flag_items, + property_flag_override_items, + property_subtype_array_items); if (size < 1 || size > PYRNA_STACK_ARRAY) { PyErr_Format( @@ -2314,6 +2379,9 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject if (pyopts) { bpy_prop_assign_flag(prop, opts); } + if (pyopts_override) { + bpy_prop_assign_flag_override(prop, opts_override); + } bpy_prop_callback_assign_update(prop, update_cb); bpy_prop_callback_assign_boolean_array(prop, get_cb, set_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -2322,28 +2390,29 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject Py_RETURN_NONE; } -PyDoc_STRVAR(BPy_IntProperty_doc, - ".. function:: IntProperty(name=\"\", " - "description=\"\", " - "default=0, " - "min=-2**31, max=2**31-1, " - "soft_min=-2**31, soft_max=2**31-1, " - "step=1, " - "options={'ANIMATABLE'}, " - "tags={}, " - "subtype='NONE', " - "update=None, " - "get=None, " - "set=None)\n" - "\n" - " Returns a new int property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_NUM_MIN_DOC - " :type min: int\n" BPY_PROPDEF_NUM_MAX_DOC - " :type max: int\n" BPY_PROPDEF_NUM_SOFTMAX_DOC - " :type soft_min: int\n" BPY_PROPDEF_NUM_SOFTMIN_DOC - " :type soft_max: int\n" BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC - BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC BPY_PROPDEF_UPDATE_DOC - BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); +PyDoc_STRVAR( + BPy_IntProperty_doc, + ".. function:: IntProperty(name=\"\", " + "description=\"\", " + "default=0, " + "min=-2**31, max=2**31-1, " + "soft_min=-2**31, soft_max=2**31-1, " + "step=1, " + "options={'ANIMATABLE'}, " + "override=set(), " + "tags=set(), " + "subtype='NONE', " + "update=None, " + "get=None, " + "set=None)\n" + "\n" + " Returns a new int property definition.\n" + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_NUM_MIN_DOC + " :type min: int\n" BPY_PROPDEF_NUM_MAX_DOC " :type max: int\n" BPY_PROPDEF_NUM_SOFTMAX_DOC + " :type soft_min: int\n" BPY_PROPDEF_NUM_SOFTMIN_DOC + " :type soft_max: int\n" BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC + BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC + BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -2357,6 +2426,8 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) PropertyRNA *prop; PyObject *pyopts = NULL; int opts = 0; + PyObject *pyopts_override = NULL; + int opts_override = 0; int prop_tags = 0; const char *pysubtype = NULL; int subtype = PROP_NONE; @@ -2376,6 +2447,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) "soft_max", "step", "options", + "override", "tags", "subtype", "update", @@ -2383,7 +2455,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) "set", NULL, }; - static _PyArg_Parser _parser = {"s#|ssiiiiiiO!O!sOOO:IntProperty", _keywords, 0}; + static _PyArg_Parser _parser = {"s#|ssiiiiiiO!O!O!sOOO:IntProperty", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, @@ -2400,6 +2472,8 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) &PySet_Type, &pyopts, &PySet_Type, + &pyopts_override, + &PySet_Type, &py_tags, &pysubtype, &update_cb, @@ -2408,7 +2482,10 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - BPY_PROPDEF_SUBTYPE_CHECK(IntProperty, property_flag_items, property_subtype_number_items); + BPY_PROPDEF_SUBTYPE_CHECK(IntProperty, + property_flag_items, + property_flag_override_items, + property_subtype_number_items); if (bpy_prop_callback_check(update_cb, "update", 2) == -1) { return NULL; @@ -2432,6 +2509,9 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) if (pyopts) { bpy_prop_assign_flag(prop, opts); } + if (pyopts_override) { + bpy_prop_assign_flag_override(prop, opts_override); + } bpy_prop_callback_assign_update(prop, update_cb); bpy_prop_callback_assign_int(prop, get_cb, set_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -2447,7 +2527,8 @@ PyDoc_STRVAR(BPy_IntVectorProperty_doc, "soft_max=2**31-1, " "step=1, " "options={'ANIMATABLE'}, " - "tags={}, " + "override=set(), " + "tags=set(), " "subtype='NONE', " "size=3, " "update=None, " @@ -2462,8 +2543,9 @@ PyDoc_STRVAR(BPy_IntVectorProperty_doc, " :type max: int\n" BPY_PROPDEF_NUM_SOFTMIN_DOC " :type soft_min: int\n" BPY_PROPDEF_NUM_SOFTMAX_DOC " :type soft_max: int\n" BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC - BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_ARRAY_DOC BPY_PROPDEF_VECSIZE_DOC - BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); + BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC + BPY_PROPDEF_SUBTYPE_ARRAY_DOC BPY_PROPDEF_VECSIZE_DOC BPY_PROPDEF_UPDATE_DOC + BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -2480,6 +2562,8 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject PyObject *pydef = NULL; PyObject *pyopts = NULL; int opts = 0; + PyObject *pyopts_override = NULL; + int opts_override = 0; int prop_tags = 0; const char *pysubtype = NULL; int subtype = PROP_NONE; @@ -2499,6 +2583,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject "soft_max", "step", "options", + "override", "tags", "subtype", "size", @@ -2507,7 +2592,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject "set", NULL, }; - static _PyArg_Parser _parser = {"s#|ssOiiiiiO!O!siOOO:IntVectorProperty", _keywords, 0}; + static _PyArg_Parser _parser = {"s#|ssOiiiiiO!O!O!siOOO:IntVectorProperty", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, @@ -2524,6 +2609,8 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject &PySet_Type, &pyopts, &PySet_Type, + &pyopts_override, + &PySet_Type, &py_tags, &pysubtype, &size, @@ -2533,8 +2620,10 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject return NULL; } - BPY_PROPDEF_SUBTYPE_CHECK( - IntVectorProperty, property_flag_items, property_subtype_array_items); + BPY_PROPDEF_SUBTYPE_CHECK(IntVectorProperty, + property_flag_items, + property_flag_override_items, + property_subtype_array_items); if (size < 1 || size > PYRNA_STACK_ARRAY) { PyErr_Format( @@ -2575,6 +2664,9 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject if (pyopts) { bpy_prop_assign_flag(prop, opts); } + if (pyopts_override) { + bpy_prop_assign_flag_override(prop, opts_override); + } bpy_prop_callback_assign_update(prop, update_cb); bpy_prop_callback_assign_int_array(prop, get_cb, set_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -2591,7 +2683,8 @@ PyDoc_STRVAR(BPy_FloatProperty_doc, "step=3, " "precision=2, " "options={'ANIMATABLE'}, " - "tags={}, " + "override=set(), " + "tags=set(), " "subtype='NONE', " "unit='NONE', " "update=None, " @@ -2604,9 +2697,9 @@ PyDoc_STRVAR(BPy_FloatProperty_doc, " :type max: float\n" BPY_PROPDEF_NUM_SOFTMIN_DOC " :type soft_min: float\n" BPY_PROPDEF_NUM_SOFTMAX_DOC " :type soft_max: float\n" BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC - BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC - BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC - BPY_PROPDEF_SET_DOC); + BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC + BPY_PROPDEF_SUBTYPE_NUMBER_DOC BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_UPDATE_DOC + BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -2622,6 +2715,8 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) PropertyRNA *prop; PyObject *pyopts = NULL; int opts = 0; + PyObject *pyopts_override = NULL; + int opts_override = 0; int prop_tags = 0; const char *pysubtype = NULL; int subtype = PROP_NONE; @@ -2633,26 +2728,11 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) PyObject *py_tags = NULL; static const char *_keywords[] = { - "attr", - "name", - "description", - "default", - "min", - "max", - "soft_min", - "soft_max", - "step", - "precision", - "options", - "tags", - "subtype", - "unit", - "update", - "get", - "set", - NULL, + "attr", "name", "description", "default", "min", "max", "soft_min", + "soft_max", "step", "precision", "options", "override", "tags", "subtype", + "unit", "update", "get", "set", NULL, }; - static _PyArg_Parser _parser = {"s#|ssffffffiO!O!ssOOO:FloatProperty", _keywords, 0}; + static _PyArg_Parser _parser = {"s#|ssffffffiO!O!O!ssOOO:FloatProperty", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, @@ -2670,6 +2750,8 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) &PySet_Type, &pyopts, &PySet_Type, + &pyopts_override, + &PySet_Type, &py_tags, &pysubtype, &pyunit, @@ -2679,7 +2761,10 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - BPY_PROPDEF_SUBTYPE_CHECK(FloatProperty, property_flag_items, property_subtype_number_items); + BPY_PROPDEF_SUBTYPE_CHECK(FloatProperty, + property_flag_items, + property_flag_override_items, + property_subtype_number_items); if (pyunit && RNA_enum_value_from_id(rna_enum_property_unit_items, pyunit, &unit) == 0) { PyErr_Format(PyExc_TypeError, "FloatProperty(unit='%s'): invalid unit", pyunit); @@ -2708,6 +2793,9 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) if (pyopts) { bpy_prop_assign_flag(prop, opts); } + if (pyopts_override) { + bpy_prop_assign_flag_override(prop, opts_override); + } bpy_prop_callback_assign_update(prop, update_cb); bpy_prop_callback_assign_float(prop, get_cb, set_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -2724,7 +2812,8 @@ PyDoc_STRVAR(BPy_FloatVectorProperty_doc, "step=3, " "precision=2, " "options={'ANIMATABLE'}, " - "tags={}, " + "override=set(), " + "tags=set(), " "subtype='NONE', " "unit='NONE', " "size=3, " @@ -2739,8 +2828,8 @@ PyDoc_STRVAR(BPy_FloatVectorProperty_doc, " :type min: float\n" BPY_PROPDEF_NUM_MAX_DOC " :type max: float\n" BPY_PROPDEF_NUM_SOFTMIN_DOC " :type soft_min: float\n" BPY_PROPDEF_NUM_SOFTMAX_DOC - " :type soft_max: float\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_TAGS_DOC - BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC + " :type soft_max: float\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC + BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC BPY_PROPDEF_SUBTYPE_ARRAY_DOC BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_VECSIZE_DOC BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw) @@ -2759,6 +2848,8 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec PyObject *pydef = NULL; PyObject *pyopts = NULL; int opts = 0; + PyObject *pyopts_override = NULL; + int opts_override = 0; int prop_tags = 0; const char *pysubtype = NULL; int subtype = PROP_NONE; @@ -2770,11 +2861,11 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec PyObject *py_tags = NULL; static const char *_keywords[] = { - "attr", "name", "description", "default", "min", "max", "soft_min", - "soft_max", "step", "precision", "options", "tags", "subtype", "unit", - "size", "update", "get", "set", NULL, + "attr", "name", "description", "default", "min", "max", "soft_min", + "soft_max", "step", "precision", "options", "override", "tags", "subtype", + "unit", "size", "update", "get", "set", NULL, }; - static _PyArg_Parser _parser = {"s#|ssOfffffiO!O!ssiOOO:FloatVectorProperty", _keywords, 0}; + static _PyArg_Parser _parser = {"s#|ssOfffffiO!O!O!ssiOOO:FloatVectorProperty", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, @@ -2792,6 +2883,8 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec &PySet_Type, &pyopts, &PySet_Type, + &pyopts_override, + &PySet_Type, &py_tags, &pysubtype, &pyunit, @@ -2802,8 +2895,10 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec return NULL; } - BPY_PROPDEF_SUBTYPE_CHECK( - FloatVectorProperty, property_flag_items, property_subtype_array_items); + BPY_PROPDEF_SUBTYPE_CHECK(FloatVectorProperty, + property_flag_items, + property_flag_override_items, + property_subtype_array_items); if (pyunit && RNA_enum_value_from_id(rna_enum_property_unit_items, pyunit, &unit) == 0) { PyErr_Format(PyExc_TypeError, "FloatVectorProperty(unit='%s'): invalid unit", pyunit); @@ -2850,6 +2945,9 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec if (pyopts) { bpy_prop_assign_flag(prop, opts); } + if (pyopts_override) { + bpy_prop_assign_flag_override(prop, opts_override); + } bpy_prop_callback_assign_update(prop, update_cb); bpy_prop_callback_assign_float_array(prop, get_cb, set_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -2863,7 +2961,8 @@ PyDoc_STRVAR(BPy_StringProperty_doc, "default=\"\", " "maxlen=0, " "options={'ANIMATABLE'}, " - "tags={}, " + "options=set(), " + "tags=set(), " "subtype='NONE', " "update=None, " "get=None, " @@ -2874,9 +2973,9 @@ PyDoc_STRVAR(BPy_StringProperty_doc, " :arg default: initializer string.\n" " :type default: string\n" " :arg maxlen: maximum length of the string.\n" - " :type maxlen: int\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_TAGS_DOC - BPY_PROPDEF_SUBTYPE_STRING_DOC BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC - BPY_PROPDEF_SET_DOC); + " :type maxlen: int\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC + BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_STRING_DOC BPY_PROPDEF_UPDATE_DOC + BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -2890,6 +2989,8 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw PropertyRNA *prop; PyObject *pyopts = NULL; int opts = 0; + PyObject *pyopts_override = NULL; + int opts_override = 0; int prop_tags = 0; const char *pysubtype = NULL; int subtype = PROP_NONE; @@ -2905,6 +3006,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw "default", "maxlen", "options", + "override", "tags", "subtype", "update", @@ -2912,7 +3014,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw "set", NULL, }; - static _PyArg_Parser _parser = {"s#|sssiO!O!sOOO:StringProperty", _keywords, 0}; + static _PyArg_Parser _parser = {"s#|sssiO!O!O!sOOO:StringProperty", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, @@ -2925,6 +3027,8 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw &PySet_Type, &pyopts, &PySet_Type, + &pyopts_override, + &PySet_Type, &py_tags, &pysubtype, &update_cb, @@ -2933,7 +3037,10 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw return NULL; } - BPY_PROPDEF_SUBTYPE_CHECK(StringProperty, property_flag_items, property_subtype_string_items); + BPY_PROPDEF_SUBTYPE_CHECK(StringProperty, + property_flag_items, + property_flag_override_items, + property_subtype_string_items); if (bpy_prop_callback_check(update_cb, "update", 2) == -1) { return NULL; @@ -2961,6 +3068,9 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw if (pyopts) { bpy_prop_assign_flag(prop, opts); } + if (pyopts_override) { + bpy_prop_assign_flag_override(prop, opts_override); + } bpy_prop_callback_assign_update(prop, update_cb); bpy_prop_callback_assign_string(prop, get_cb, set_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -2975,7 +3085,8 @@ PyDoc_STRVAR( "description=\"\", " "default=None, " "options={'ANIMATABLE'}, " - "tags={}, " + "override=set(), " + "tags=set(), " "update=None, " "get=None, " "set=None)\n" @@ -3019,8 +3130,9 @@ PyDoc_STRVAR( "instead.\n" " WARNING: Strings can not be specified for dynamic enums\n" " (i.e. if a callback function is given as *items* parameter).\n" - " :type default: string, integer or set\n" BPY_PROPDEF_OPTIONS_ENUM_DOC BPY_PROPDEF_TAGS_DOC - BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); + " :type default: string, integer or set\n" BPY_PROPDEF_OPTIONS_ENUM_DOC + BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_UPDATE_DOC + BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -3037,6 +3149,8 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) PropertyRNA *prop; PyObject *pyopts = NULL; int opts = 0; + PyObject *pyopts_override = NULL; + int opts_override = 0; int prop_tags = 0; bool is_itemf = false; PyObject *update_cb = NULL; @@ -3051,13 +3165,14 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) "description", "default", "options", + "override", "tags", "update", "get", "set", NULL, }; - static _PyArg_Parser _parser = {"s#O|ssOO!O!OOO:EnumProperty", _keywords, 0}; + static _PyArg_Parser _parser = {"s#O|ssOO!O!O!OOO:EnumProperty", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, @@ -3070,6 +3185,8 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) &PySet_Type, &pyopts, &PySet_Type, + &pyopts_override, + &PySet_Type, &py_tags, &update_cb, &get_cb, @@ -3077,7 +3194,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - BPY_PROPDEF_CHECK(EnumProperty, property_flag_enum_items); + BPY_PROPDEF_CHECK(EnumProperty, property_flag_enum_items, property_flag_override_items); if (bpy_prop_callback_check(update_cb, "update", 2) == -1) { return NULL; @@ -3149,6 +3266,9 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) if (pyopts) { bpy_prop_assign_flag(prop, opts); } + if (pyopts_override) { + bpy_prop_assign_flag_override(prop, opts_override); + } bpy_prop_callback_assign_update(prop, update_cb); bpy_prop_callback_assign_enum(prop, get_cb, set_cb, (is_itemf ? items : NULL)); RNA_def_property_duplicate_pointers(srna, prop); @@ -3194,14 +3314,15 @@ PyDoc_STRVAR(BPy_PointerProperty_doc, "name=\"\", " "description=\"\", " "options={'ANIMATABLE'}, " - "tags={}, " + "override=set(), " + "tags=set(), " "poll=None, " "update=None)\n" "\n" " Returns a new pointer property definition.\n" "\n" BPY_PROPDEF_TYPE_DOC BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC - BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_POLL_DOC - BPY_PROPDEF_UPDATE_DOC); + BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC + BPY_PROPDEF_POLL_DOC BPY_PROPDEF_UPDATE_DOC); PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -3215,8 +3336,10 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) StructRNA *ptype; PyObject *type = Py_None; PyObject *pyopts = NULL; + PyObject *pyopts_override = NULL; PyObject *py_tags = NULL; int opts = 0; + int opts_override = 0; int prop_tags = 0; PyObject *update_cb = NULL, *poll_cb = NULL; @@ -3226,12 +3349,13 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) "name", "description", "options", + "override", "tags", "poll", "update", NULL, }; - static _PyArg_Parser _parser = {"s#O|ssO!O!OO:PointerProperty", _keywords, 0}; + static _PyArg_Parser _parser = {"s#O|ssO!O!O!OO:PointerProperty", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, @@ -3243,13 +3367,15 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) &PySet_Type, &pyopts, &PySet_Type, + &pyopts_override, + &PySet_Type, &py_tags, &poll_cb, &update_cb)) { return NULL; } - BPY_PROPDEF_CHECK(PointerProperty, property_flag_items); + BPY_PROPDEF_CHECK(PointerProperty, property_flag_items, property_flag_override_items); ptype = pointer_type_from_py(type, "PointerProperty(...)"); if (!ptype) { @@ -3275,6 +3401,9 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) if (pyopts) { bpy_prop_assign_flag(prop, opts); } + if (pyopts_override) { + bpy_prop_assign_flag_override(prop, opts_override); + } if (RNA_struct_idprops_contains_datablock(ptype)) { if (RNA_struct_is_a(srna, &RNA_PropertyGroup)) { @@ -3293,11 +3422,13 @@ PyDoc_STRVAR(BPy_CollectionProperty_doc, "name=\"\", " "description=\"\", " "options={'ANIMATABLE'}, " - "tags={})\n" + "override=set(), " + "tags=set())\n" "\n" " Returns a new collection property definition.\n" "\n" BPY_PROPDEF_TYPE_DOC BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC - BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_TAGS_DOC); + BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_COLLECTION_DOC + BPY_PROPDEF_TAGS_DOC); PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -3311,8 +3442,10 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) StructRNA *ptype; PyObject *type = Py_None; PyObject *pyopts = NULL; + PyObject *pyopts_override = NULL; PyObject *py_tags = NULL; int opts = 0; + int opts_override = 0; int prop_tags = 0; static const char *_keywords[] = { @@ -3321,10 +3454,11 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) "name", "description", "options", + "override", "tags", NULL, }; - static _PyArg_Parser _parser = {"s#O|ssO!O!:CollectionProperty", _keywords, 0}; + static _PyArg_Parser _parser = {"s#O|ssO!O!O!:CollectionProperty", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, @@ -3336,11 +3470,14 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) &PySet_Type, &pyopts, &PySet_Type, + &pyopts_override, + &PySet_Type, &py_tags)) { return NULL; } - BPY_PROPDEF_CHECK(CollectionProperty, property_flag_items); + BPY_PROPDEF_CHECK( + CollectionProperty, property_flag_items, property_flag_override_collection_items); ptype = pointer_type_from_py(type, "CollectionProperty(...):"); if (!ptype) { @@ -3362,6 +3499,9 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) if (pyopts) { bpy_prop_assign_flag(prop, opts); } + if (pyopts_override) { + bpy_prop_assign_flag_override(prop, opts_override); + } if (RNA_struct_idprops_contains_datablock(ptype)) { if (RNA_struct_is_a(srna, &RNA_PropertyGroup)) { diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index d792b2032b5..1c84e95672f 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -415,7 +415,7 @@ char pyrna_struct_keyframe_delete_doc[] = " :arg group: The name of the group the F-Curve should be added to if it doesn't exist " "yet.\n" " :type group: str\n" - " :return: Success of keyframe deleation.\n" + " :return: Success of keyframe deletion.\n" " :rtype: boolean\n"; PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw) { diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c index b607f1635e6..a4df8c3aef1 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.c +++ b/source/blender/python/intern/bpy_rna_id_collection.c @@ -132,7 +132,7 @@ static int foreach_libblock_id_user_map_callback(LibraryIDLinkCallbackData *cb_d PyDoc_STRVAR(bpy_user_map_doc, ".. method:: user_map([subset=(id1, id2, ...)], key_types={..}, value_types={..})\n" "\n" - " Returns a mapping of all ID datablocks in current ``bpy.data`` to a set of all " + " Returns a mapping of all ID data-blocks in current ``bpy.data`` to a set of all " "datablocks using them.\n" "\n" " For list of valid set members for key_types & value_types, see: " diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 63137e094b7..3e30c81c8c6 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -2526,7 +2526,6 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) } if (mat1 && mat2) { -#ifdef USE_MATHUTILS_ELEM_MUL /* MATRIX * MATRIX */ float mat[MATRIX_MAX_DIM * MATRIX_MAX_DIM]; @@ -2540,7 +2539,6 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) mul_vn_vnvn(mat, mat1->matrix, mat2->matrix, mat1->num_col * mat1->num_row); return Matrix_CreatePyObject(mat, mat2->num_col, mat1->num_row, Py_TYPE(mat1)); -#endif } else if (mat2) { /*FLOAT/INT * MATRIX */ @@ -2584,7 +2582,6 @@ static PyObject *Matrix_imul(PyObject *m1, PyObject *m2) } if (mat1 && mat2) { -#ifdef USE_MATHUTILS_ELEM_MUL /* MATRIX *= MATRIX */ if ((mat1->num_row != mat2->num_row) || (mat1->num_col != mat2->num_col)) { PyErr_SetString(PyExc_ValueError, @@ -2594,14 +2591,6 @@ static PyObject *Matrix_imul(PyObject *m1, PyObject *m2) } mul_vn_vn(mat1->matrix, mat2->matrix, mat1->num_col * mat1->num_row); -#else - PyErr_Format(PyExc_TypeError, - "In place element-wise multiplication: " - "not supported between '%.200s' and '%.200s' types", - Py_TYPE(m1)->tp_name, - Py_TYPE(m2)->tp_name); - return NULL; -#endif } else if (mat1 && (((scalar = PyFloat_AsDouble(m2)) == -1.0f && PyErr_Occurred()) == 0)) { /* MATRIX *= FLOAT/INT */ diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 7ce0ea5f249..2b7761b7678 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -962,11 +962,9 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) } if (quat1 && quat2) { /* QUAT * QUAT (element-wise product) */ -#ifdef USE_MATHUTILS_ELEM_MUL float quat[QUAT_SIZE]; mul_vn_vnvn(quat, quat1->quat, quat2->quat, QUAT_SIZE); return Quaternion_CreatePyObject(quat, Py_TYPE(q1)); -#endif } /* the only case this can happen (for a supported type is "FLOAT * QUAT") */ else if (quat2) { /* FLOAT * QUAT */ @@ -1007,17 +1005,8 @@ static PyObject *Quaternion_imul(PyObject *q1, PyObject *q2) } } - if (quat1 && quat2) { /* QUAT *= QUAT (inplace element-wise product) */ -#ifdef USE_MATHUTILS_ELEM_MUL + if (quat1 && quat2) { /* QUAT *= QUAT (in-place element-wise product). */ mul_vn_vn(quat1->quat, quat2->quat, QUAT_SIZE); -#else - PyErr_Format(PyExc_TypeError, - "In place element-wise multiplication: " - "not supported between '%.200s' and '%.200s' types", - Py_TYPE(q1)->tp_name, - Py_TYPE(q2)->tp_name); - return NULL; -#endif } else if (quat1 && (((scalar = PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred()) == 0)) { /* QUAT *= FLOAT */ diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 15ae811fd91..4b47440a530 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -1738,7 +1738,7 @@ static PyObject *vector_mul_float(VectorObject *vec, const float scalar) mul_vn_vn_fl(tvec, vec->vec, vec->size, scalar); return Vector_CreatePyObject_alloc(tvec, vec->size, Py_TYPE(vec)); } -#ifdef USE_MATHUTILS_ELEM_MUL + static PyObject *vector_mul_vec(VectorObject *vec1, VectorObject *vec2) { float *tvec = PyMem_Malloc(vec1->size * sizeof(float)); @@ -1752,7 +1752,7 @@ static PyObject *vector_mul_vec(VectorObject *vec1, VectorObject *vec2) mul_vn_vnvn(tvec, vec1->vec, vec2->vec, vec1->size); return Vector_CreatePyObject_alloc(tvec, vec1->size, Py_TYPE(vec1)); } -#endif + static PyObject *Vector_mul(PyObject *v1, PyObject *v2) { VectorObject *vec1 = NULL, *vec2 = NULL; @@ -1775,7 +1775,6 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) /* make sure v1 is always the vector */ if (vec1 && vec2) { -#ifdef USE_MATHUTILS_ELEM_MUL if (vec1->size != vec2->size) { PyErr_SetString(PyExc_ValueError, "Vector multiplication: " @@ -1785,7 +1784,6 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) /* element-wise product */ return vector_mul_vec(vec1, vec2); -#endif } else if (vec1) { if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* VEC * FLOAT */ @@ -1832,7 +1830,6 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) /* Intentionally don't support (Quaternion, Matrix) here, uses reverse order instead. */ if (vec1 && vec2) { -#ifdef USE_MATHUTILS_ELEM_MUL if (vec1->size != vec2->size) { PyErr_SetString(PyExc_ValueError, "Vector multiplication: " @@ -1840,16 +1837,8 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) return NULL; } - /* element-wise product inplace */ + /* Element-wise product in-place. */ mul_vn_vn(vec1->vec, vec2->vec, vec1->size); -#else - PyErr_Format(PyExc_TypeError, - "In place element-wise multiplication: " - "not supported between '%.200s' and '%.200s' types", - Py_TYPE(v1)->tp_name, - Py_TYPE(v2)->tp_name); - return NULL; -#endif } else if (vec1 && (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0)) { /* VEC *= FLOAT */ diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 59c0021e0f3..93dbac32c19 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1537,9 +1537,9 @@ static PyObject *M_Geometry_convex_hull_2d(PyObject *UNUSED(self), PyObject *poi * to fill values, with start_table and len_table giving the start index * and length of the toplevel_len sub-lists. */ -static PyObject *list_of_lists_from_arrays(int *array, - int *start_table, - int *len_table, +static PyObject *list_of_lists_from_arrays(const int *array, + const int *start_table, + const int *len_table, int toplevel_len) { PyObject *ret, *sublist; |