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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'magic_uv/op/copy_paste_uv_uvedit.py')
-rw-r--r--magic_uv/op/copy_paste_uv_uvedit.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/magic_uv/op/copy_paste_uv_uvedit.py b/magic_uv/op/copy_paste_uv_uvedit.py
index f12851dd..abfb69a8 100644
--- a/magic_uv/op/copy_paste_uv_uvedit.py
+++ b/magic_uv/op/copy_paste_uv_uvedit.py
@@ -20,8 +20,8 @@
__author__ = "imdjs, Nutti <nutti.metro@gmail.com>"
__status__ = "production"
-__version__ = "6.3"
-__date__ = "10 Aug 2020"
+__version__ = "6.4"
+__date__ = "23 Oct 2020"
import math
from math import atan2, sin, cos
@@ -36,23 +36,19 @@ from ..utils.property_class_registry import PropertyClassRegistry
def _is_valid_context(context):
- obj = context.object
+ # Multiple objects editing mode is not supported in this feature.
+ objs = common.get_uv_editable_objects(context)
+ if len(objs) != 1:
+ return False
# only edit mode is allowed to execute
- if obj is None:
- return False
- if obj.type != 'MESH':
- return False
if context.object.mode != 'EDIT':
return False
# 'IMAGE_EDITOR' and 'VIEW_3D' space is allowed to execute.
# If 'View_3D' space is not allowed, you can't find option in Tool-Shelf
# after the execution
- for space in context.area.spaces:
- if (space.type == 'IMAGE_EDITOR') or (space.type == 'VIEW_3D'):
- break
- else:
+ if not common.is_valid_space(context, ['IMAGE_EDITOR', 'VIEW_3D']):
return False
return True
@@ -94,7 +90,10 @@ class MUV_OT_CopyPasteUVUVEdit_CopyUV(bpy.types.Operator):
def execute(self, context):
props = context.scene.muv_props.copy_paste_uv_uvedit
- obj = context.active_object
+
+ objs = common.get_uv_editable_objects(context)
+ # poll() method ensures that only one object is selected.
+ obj = objs[0]
bm = bmesh.from_edit_mesh(obj.data)
uv_layer = bm.loops.layers.uv.verify()
if common.check_version(2, 73, 0) >= 0:
@@ -140,7 +139,10 @@ class MUV_OT_CopyPasteUVUVEdit_PasteUV(bpy.types.Operator):
def execute(self, context):
props = context.scene.muv_props.copy_paste_uv_uvedit
- obj = context.active_object
+
+ objs = common.get_uv_editable_objects(context)
+ # poll() method ensures that only one object is selected.
+ obj = objs[0]
bm = bmesh.from_edit_mesh(obj.data)
uv_layer = bm.loops.layers.uv.verify()
if common.check_version(2, 73, 0) >= 0: