Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-07-17 05:29:37 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-07-17 05:29:37 +0300
commita11808a248200a7ee5a9fca0ae16581fee1c249b (patch)
tree4612e03b48ba2a30a5000ea2b6987e17f3ae1e40 /source/blender/python
parenta3d9ef2ea50671267792df4a2c220ae157ea7a4c (diff)
Manipulator: allow py manipulators w/o properties
These could be used for manipulators that run operators.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_manipulator_wrap.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/source/blender/python/intern/bpy_manipulator_wrap.c b/source/blender/python/intern/bpy_manipulator_wrap.c
index 7d02c2963d7..db9fcdb377a 100644
--- a/source/blender/python/intern/bpy_manipulator_wrap.c
+++ b/source/blender/python/intern/bpy_manipulator_wrap.c
@@ -143,27 +143,32 @@ static void manipulator_properties_init(wmManipulatorType *wt)
* 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);
- PyObject *bl_target_properties_fast;
- if (!(bl_target_properties_fast = PySequence_Fast(bl_target_properties, "bl_target_properties sequence"))) {
- /* PySequence_Fast sets the error */
- PyErr_Print();
- PyErr_Clear();
- return;
- }
-
- const uint items_len = PySequence_Fast_GET_SIZE(bl_target_properties_fast);
- PyObject **items = PySequence_Fast_ITEMS(bl_target_properties_fast);
-
- for (uint i = 0; i < items_len; i++) {
- if (!bpy_manipulatortype_target_property_def(wt, items[i])) {
+ /* Some widgets may only exist to activate operators. */
+ if (bl_target_properties != NULL) {
+ PyObject *bl_target_properties_fast;
+ if (!(bl_target_properties_fast = PySequence_Fast(
+ bl_target_properties, "bl_target_properties sequence")))
+ {
+ /* PySequence_Fast sets the error */
PyErr_Print();
PyErr_Clear();
- break;
+ return;
}
- }
- Py_DECREF(bl_target_properties_fast);
+ const uint items_len = PySequence_Fast_GET_SIZE(bl_target_properties_fast);
+ PyObject **items = PySequence_Fast_ITEMS(bl_target_properties_fast);
+
+ for (uint i = 0; i < items_len; i++) {
+ if (!bpy_manipulatortype_target_property_def(wt, items[i])) {
+ PyErr_Print();
+ PyErr_Clear();
+ break;
+ }
+ }
+
+ Py_DECREF(bl_target_properties_fast);
+ }
}
}