diff options
Diffstat (limited to 'magic_uv')
-rw-r--r-- | magic_uv/common.py | 7 | ||||
-rw-r--r-- | magic_uv/op/copy_paste_uv_object.py | 9 | ||||
-rw-r--r-- | magic_uv/utils/graph.py | 2 |
3 files changed, 11 insertions, 7 deletions
diff --git a/magic_uv/common.py b/magic_uv/common.py index fccce1c4..f76fcc67 100644 --- a/magic_uv/common.py +++ b/magic_uv/common.py @@ -1242,11 +1242,14 @@ def __is_points_in_polygon(points, subject_points): def get_uv_editable_objects(context): if compat.check_version(2, 80, 0) < 0: - objs = [context.active_object] + objs = [] else: objs = [o for o in bpy.data.objects if compat.get_object_select(o) and o.type == 'MESH'] - objs.append(context.active_object) + + ob = context.active_object + if ob is not None: + objs.append(ob) objs = list(set(objs)) return objs diff --git a/magic_uv/op/copy_paste_uv_object.py b/magic_uv/op/copy_paste_uv_object.py index 39795b52..897891e4 100644 --- a/magic_uv/op/copy_paste_uv_object.py +++ b/magic_uv/op/copy_paste_uv_object.py @@ -30,15 +30,16 @@ def _is_valid_context(context): if not common.is_valid_space(context, ['VIEW_3D']): return False + # Only object mode is allowed to execute. + ob = context.object + if ob is not None and ob.mode != 'OBJECT': + return False + # Multiple objects editing mode is not supported in this feature. objs = common.get_uv_editable_objects(context) if len(objs) != 1: return False - # only object mode is allowed to execute - if context.object.mode != 'OBJECT': - return False - return True diff --git a/magic_uv/utils/graph.py b/magic_uv/utils/graph.py index bebabf63..277800bc 100644 --- a/magic_uv/utils/graph.py +++ b/magic_uv/utils/graph.py @@ -29,7 +29,7 @@ class Edge: raise RuntimeError("Loop edge in {} is not supported." .format(node.key)) if node not in (self.node_1, self.node_2): - raise RuntimeError("Node {} does not belog this edge." + raise RuntimeError("Node {} does not belong to this edge." .format(node.key)) if self.node_1 == node: return self.node_2 |