diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-12-11 08:13:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-12-11 08:13:44 +0300 |
commit | f52d60a21d4d3551190305549dbb2a647a1ae0c9 (patch) | |
tree | 67f13ede052ec89aa4a63521ffe8bb45d94be13f /release | |
parent | 5cd6aa4bc9a7f852bc3221ff4b62863d399be042 (diff) |
Fix bpy.extras.object_data_add use without an active space
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bpy_extras/object_utils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index 9db86782d02..8c009a77d3d 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -130,7 +130,10 @@ def object_data_add(context, obdata, operator=None, name=None): obj_new.matrix_world = add_object_align_init(context, operator) space_data = context.space_data - if space_data.type == 'VIEW_3D': + if space_data and space_data.type != 'VIEW_3D': + space_data = None + + if space_data: if space_data.local_view: obj_new.local_view_set(space_data, True) |