From d2808959bb845ec945aa7fac494db42a9228021b Mon Sep 17 00:00:00 2001 From: Nutti Date: Sun, 19 May 2019 16:45:14 +0900 Subject: Magic UV: Release v6.1 [Update features] - World Scale UV - Add option "Texture" to allow the user to specify the texture for the density calculation [Other updates] - Fix bugs --- magic_uv/__init__.py | 6 +- magic_uv/common.py | 93 +++++++++++++++++++------ magic_uv/lib/__init__.py | 4 +- magic_uv/op/__init__.py | 4 +- magic_uv/op/align_uv.py | 45 ++++++++---- magic_uv/op/align_uv_cursor.py | 12 ++-- magic_uv/op/copy_paste_uv.py | 20 +++--- magic_uv/op/copy_paste_uv_object.py | 12 ++-- magic_uv/op/copy_paste_uv_uvedit.py | 8 +-- magic_uv/op/flip_rotate_uv.py | 8 +-- magic_uv/op/mirror_uv.py | 6 +- magic_uv/op/move_uv.py | 6 +- magic_uv/op/pack_uv.py | 6 +- magic_uv/op/preserve_uv_aspect.py | 6 +- magic_uv/op/select_uv.py | 8 +-- magic_uv/op/smooth_uv.py | 6 +- magic_uv/op/texture_lock.py | 12 ++-- magic_uv/op/texture_projection.py | 10 +-- magic_uv/op/texture_wrap.py | 8 +-- magic_uv/op/transfer_uv.py | 8 +-- magic_uv/op/unwrap_constraint.py | 6 +- magic_uv/op/uv_bounding_box.py | 8 +-- magic_uv/op/uv_inspection.py | 10 +-- magic_uv/op/uv_sculpt.py | 8 +-- magic_uv/op/uvw.py | 8 +-- magic_uv/op/world_scale_uv.py | 94 +++++++++++++++++++++---- magic_uv/preferences.py | 10 +-- magic_uv/properites.py | 4 +- magic_uv/ui/IMAGE_MT_uvs.py | 14 ++-- magic_uv/ui/VIEW3D_MT_object.py | 6 +- magic_uv/ui/VIEW3D_MT_uv_map.py | 20 +++--- magic_uv/ui/__init__.py | 4 +- magic_uv/ui/uvedit_copy_paste_uv.py | 5 +- magic_uv/ui/uvedit_editor_enhancement.py | 5 +- magic_uv/ui/uvedit_uv_manipulation.py | 5 +- magic_uv/ui/view3d_copy_paste_uv_editmode.py | 4 +- magic_uv/ui/view3d_copy_paste_uv_objectmode.py | 4 +- magic_uv/ui/view3d_uv_manipulation.py | 95 ++++++++++++++++++-------- magic_uv/ui/view3d_uv_mapping.py | 4 +- magic_uv/updater.py | 8 +-- magic_uv/utils/__init__.py | 4 +- magic_uv/utils/addon_updator.py | 4 +- magic_uv/utils/bl_class_registry.py | 11 ++- magic_uv/utils/compatibility.py | 6 +- magic_uv/utils/property_class_registry.py | 4 +- 45 files changed, 407 insertions(+), 232 deletions(-) (limited to 'magic_uv') diff --git a/magic_uv/__init__.py b/magic_uv/__init__.py index 5bac5fd2..e8a82c93 100644 --- a/magic_uv/__init__.py +++ b/magic_uv/__init__.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" bl_info = { @@ -29,7 +29,7 @@ bl_info = { "author": "Nutti, Mifth, Jace Priester, kgeogeo, mem, imdjs" "Keith (Wahooney) Boshoff, McBuff, MaxRobinot, " "Alexander Milovsky", - "version": (6, 0, 0), + "version": (6, 1, 0), "blender": (2, 80, 0), "location": "See Add-ons Preferences", "description": "UV Toolset. See Add-ons Preferences for details", diff --git a/magic_uv/common.py b/magic_uv/common.py index 78a88308..066fa969 100644 --- a/magic_uv/common.py +++ b/magic_uv/common.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from collections import defaultdict from pprint import pprint @@ -41,7 +41,7 @@ __DEBUG_MODE = False def is_console_mode(): if "MUV_CONSOLE_MODE" not in os.environ: return False - return os.environ["MUV_CONSOLE_MODE"] == "True" + return os.environ["MUV_CONSOLE_MODE"] == "true" def is_debug_mode(): @@ -382,6 +382,8 @@ def find_texture_layer(bm): def find_texture_nodes(obj): nodes = [] for mat in obj.material_slots: + if not mat.material: + continue if not mat.material.node_tree: continue for node in mat.material.node_tree.nodes: @@ -399,23 +401,34 @@ def find_texture_nodes(obj): def find_image(obj, face=None, tex_layer=None): + images = find_images(obj, face, tex_layer) + + if len(images) >= 2: + raise RuntimeError("Find more than 2 images") + if len(images) == 0: + return None + + return images[0] + + +def find_images(obj, face=None, tex_layer=None): + images = [] + # try to find from texture_layer - img = None if tex_layer and face: - img = face[tex_layer].image + if face[tex_layer].image is not None: + images.append(face[tex_layer].image) # not found, then try to search from node - if not img: + if not images: nodes = find_texture_nodes(obj) - if len(nodes) >= 2: - raise RuntimeError("Find more than 2 texture nodes") - if len(nodes) == 1: - img = nodes[0].image + for n in nodes: + images.append(n.image) - return img + return images -def measure_uv_area(obj, tex_size=None): +def measure_uv_area(obj, method='FIRST', tex_size=None): bm = bmesh.from_edit_mesh(obj.data) if check_version(2, 73, 0) >= 0: bm.verts.ensure_lookup_table() @@ -437,17 +450,53 @@ def measure_uv_area(obj, tex_size=None): f_uv_area = calc_polygon_2d_area(uvs) # user specified - if tex_size: - uv_area = uv_area + f_uv_area * tex_size[0] * tex_size[1] - continue - - img = find_image(obj, f, tex_layer) - - # can not find from node, so we can not get texture size - if not img: - return None + if method == 'USER_SPECIFIED' and tex_size is not None: + img_size = tex_size + # first texture if there are more than 2 textures assigned + # to the object + elif method == 'FIRST': + img = find_image(obj, f, tex_layer) + # can not find from node, so we can not get texture size + if not img: + return None + img_size = img.size + # average texture size + elif method == 'AVERAGE': + imgs = find_images(obj, f, tex_layer) + if not imgs: + return None + + img_size_total = [0.0, 0.0] + for img in imgs: + img_size_total = [img_size_total[0] + img.size[0], + img_size_total[1] + img.size[1]] + img_size = [img_size_total[0] / len(imgs), + img_size_total[1] / len(imgs)] + # max texture size + elif method == 'MAX': + imgs = find_images(obj, f, tex_layer) + if not imgs: + return None + + img_size_max = [-99999999.0, -99999999.0] + for img in imgs: + img_size_max = [max(img_size_max[0], img.size[0]), + max(img_size_max[1], img.size[1])] + img_size = img_size_max + # min texture size + elif method == 'MIN': + imgs = find_images(obj, f, tex_layer) + if not imgs: + return None + + img_size_min = [99999999.0, 99999999.0] + for img in imgs: + img_size_min = [min(img_size_min[0], img.size[0]), + min(img_size_min[1], img.size[1])] + img_size = img_size_min + else: + raise RuntimeError("Unexpected method: {}".format(method)) - img_size = img.size uv_area = uv_area + f_uv_area * img_size[0] * img_size[1] return uv_area diff --git a/magic_uv/lib/__init__.py b/magic_uv/lib/__init__.py index db6f9df9..8ba994d9 100644 --- a/magic_uv/lib/__init__.py +++ b/magic_uv/lib/__init__.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" if "bpy" in locals(): import importlib diff --git a/magic_uv/op/__init__.py b/magic_uv/op/__init__.py index d637e78a..25882d9c 100644 --- a/magic_uv/op/__init__.py +++ b/magic_uv/op/__init__.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" if "bpy" in locals(): import importlib diff --git a/magic_uv/op/align_uv.py b/magic_uv/op/align_uv.py index f8ea4176..92ce2a61 100644 --- a/magic_uv/op/align_uv.py +++ b/magic_uv/op/align_uv.py @@ -20,8 +20,8 @@ __author__ = "imdjs, Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import math from math import atan2, tan, sin, cos @@ -356,7 +356,7 @@ class _Properties: @compat.make_annotations class MUV_OT_AlignUV_Circle(bpy.types.Operator): - bl_idname = "uv.muv_ot_align_uv_circle" + bl_idname = "uv.muv_align_uv_circle" bl_label = "Align UV (Circle)" bl_description = "Align UV coordinates to Circle" bl_options = {'REGISTER', 'UNDO'} @@ -397,22 +397,39 @@ class MUV_OT_AlignUV_Circle(bpy.types.Operator): c, r = _get_circle(uvs[0:3]) new_uvs = _calc_v_on_circle(uvs, c, r) - # check center UV of circle + # check if center is identical + center_is_identical = False center = loop_seqs[0][-1][0].vert - for hseq in loop_seqs[1:]: - if len(hseq[-1]) != 1: - self.report({'WARNING'}, "Last face must be triangle") - return {'CANCELLED'} - if hseq[-1][0].vert != center: - self.report({'WARNING'}, "Center must be identical") - return {'CANCELLED'} + if (len(loop_seqs[0][-1]) == 1) and loop_seqs[0][-1][0].vert == center: + center_is_identical = True + + # check if topology is correct + if center_is_identical: + for hseq in loop_seqs[1:]: + if len(hseq[-1]) != 1: + self.report({'WARNING'}, "Last face must be triangle") + return {'CANCELLED'} + if hseq[-1][0].vert != center: + self.report({'WARNING'}, "Center must be identical") + return {'CANCELLED'} + else: + for hseq in loop_seqs[1:]: + if len(hseq[-1]) == 1: + self.report({'WARNING'}, "Last face must not be triangle") + return {'CANCELLED'} + if hseq[-1][0].vert == center: + self.report({'WARNING'}, "Center must not be identical") + return {'CANCELLED'} # align to circle if self.transmission: for hidx, hseq in enumerate(loop_seqs): for vidx, pair in enumerate(hseq): all_ = int((len(hseq) + 1) / 2) - r = (all_ - int((vidx + 1) / 2)) / all_ + if center_is_identical: + r = (all_ - int((vidx + 1) / 2)) / all_ + else: + r = (1 + all_ - int((vidx + 1) / 2)) / all_ pair[0][uv_layer].uv = c + (new_uvs[hidx] - c) * r if self.select: pair[0][uv_layer].select = True @@ -442,7 +459,7 @@ class MUV_OT_AlignUV_Circle(bpy.types.Operator): @compat.make_annotations class MUV_OT_AlignUV_Straighten(bpy.types.Operator): - bl_idname = "uv.muv_ot_align_uv_straighten" + bl_idname = "uv.muv_align_uv_straighten" bl_label = "Align UV (Straighten)" bl_description = "Straighten UV coordinates" bl_options = {'REGISTER', 'UNDO'} @@ -594,7 +611,7 @@ class MUV_OT_AlignUV_Straighten(bpy.types.Operator): @compat.make_annotations class MUV_OT_AlignUV_Axis(bpy.types.Operator): - bl_idname = "uv.muv_ot_align_uv_axis" + bl_idname = "uv.muv_align_uv_axis" bl_label = "Align UV (XY-Axis)" bl_description = "Align UV to XY-axis" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/align_uv_cursor.py b/magic_uv/op/align_uv_cursor.py index 24c111d0..2189d764 100644 --- a/magic_uv/op/align_uv_cursor.py +++ b/magic_uv/op/align_uv_cursor.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy from mathutils import Vector @@ -60,7 +60,7 @@ class _Properties: bd_size = common.get_uvimg_editor_board_size(area) else: bd_size = [1.0, 1.0] - loc = space.cursor.location + loc = space.cursor_location if bd_size[0] < 0.000001: cx = 0.0 @@ -84,7 +84,7 @@ class _Properties: bd_size = [1.0, 1.0] cx = bd_size[0] * value[0] cy = bd_size[1] * value[1] - space.cursor.location = Vector((cx, cy)) + space.cursor_location = Vector((cx, cy)) scene.muv_align_uv_cursor_enabled = BoolProperty( name="Align UV Cursor Enabled", @@ -133,7 +133,7 @@ class _Properties: @compat.make_annotations class MUV_OT_AlignUVCursor(bpy.types.Operator): - bl_idname = "uv.muv_ot_align_uv_cursor" + bl_idname = "uv.muv_align_uv_cursor" bl_label = "Align UV Cursor" bl_description = "Align cursor to the center of UV island" bl_options = {'REGISTER', 'UNDO'} @@ -264,6 +264,6 @@ class MUV_OT_AlignUVCursor(bpy.types.Operator): cx = cx * bd_size[0] cy = cy * bd_size[1] - space.cursor.location = Vector((cx, cy)) + space.cursor_location = Vector((cx, cy)) return {'FINISHED'} diff --git a/magic_uv/op/copy_paste_uv.py b/magic_uv/op/copy_paste_uv.py index fca412ad..60cdcc36 100644 --- a/magic_uv/op/copy_paste_uv.py +++ b/magic_uv/op/copy_paste_uv.py @@ -20,8 +20,8 @@ __author__ = "Nutti , Jace Priester" __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bmesh import bpy.utils @@ -326,7 +326,7 @@ class MUV_OT_CopyPasteUV_CopyUV(bpy.types.Operator): Operation class: Copy UV coordinate """ - bl_idname = "uv.muv_ot_copy_paste_uv_copy_uv" + bl_idname = "uv.muv_copy_paste_uv_copy_uv" bl_label = "Copy UV" bl_description = "Copy UV coordinate" bl_options = {'REGISTER', 'UNDO'} @@ -368,7 +368,7 @@ class MUV_MT_CopyPasteUV_CopyUV(bpy.types.Menu): Menu class: Copy UV coordinate """ - bl_idname = "uv.muv_mt_copy_paste_uv_copy_uv" + bl_idname = "MUV_MT_CopyPasteUV_CopyUV" bl_label = "Copy UV (Menu)" bl_description = "Menu of Copy UV coordinate" @@ -403,7 +403,7 @@ class MUV_OT_CopyPasteUV_PasteUV(bpy.types.Operator): Operation class: Paste UV coordinate """ - bl_idname = "uv.muv_ot_copy_paste_uv_paste_uv" + bl_idname = "uv.muv_copy_paste_uv_paste_uv" bl_label = "Paste UV" bl_description = "Paste UV coordinate" bl_options = {'REGISTER', 'UNDO'} @@ -491,7 +491,7 @@ class MUV_MT_CopyPasteUV_PasteUV(bpy.types.Menu): Menu class: Paste UV coordinate """ - bl_idname = "uv.muv_mt_copy_paste_uv_paste_uv" + bl_idname = "MUV_MT_CopyPasteUV_PasteUV" bl_label = "Paste UV (Menu)" bl_description = "Menu of Paste UV coordinate" @@ -543,7 +543,7 @@ class MUV_OT_CopyPasteUV_SelSeqCopyUV(bpy.types.Operator): Operation class: Copy UV coordinate by selection sequence """ - bl_idname = "uv.muv_ot_copy_paste_uv_selseq_copy_uv" + bl_idname = "uv.muv_copy_paste_uv_selseq_copy_uv" bl_label = "Copy UV (Selection Sequence)" bl_description = "Copy UV data by selection sequence" bl_options = {'REGISTER', 'UNDO'} @@ -585,7 +585,7 @@ class MUV_MT_CopyPasteUV_SelSeqCopyUV(bpy.types.Menu): Menu class: Copy UV coordinate by selection sequence """ - bl_idname = "uv.muv_mt_copy_paste_uv_selseq_copy_uv" + bl_idname = "MUV_MT_CopyPasteUV_SelSeqCopyUV" bl_label = "Copy UV (Selection Sequence) (Menu)" bl_description = "Menu of Copy UV coordinate by selection sequence" @@ -620,7 +620,7 @@ class MUV_OT_CopyPasteUV_SelSeqPasteUV(bpy.types.Operator): Operation class: Paste UV coordinate by selection sequence """ - bl_idname = "uv.muv_ot_copy_paste_uv_selseq_paste_uv" + bl_idname = "uv.muv_copy_paste_uv_selseq_paste_uv" bl_label = "Paste UV (Selection Sequence)" bl_description = "Paste UV coordinate by selection sequence" bl_options = {'REGISTER', 'UNDO'} @@ -709,7 +709,7 @@ class MUV_MT_CopyPasteUV_SelSeqPasteUV(bpy.types.Menu): Menu class: Paste UV coordinate by selection sequence """ - bl_idname = "uv.muv_mt_copy_paste_uv_selseq_paste_uv" + bl_idname = "MUV_MT_CopyPasteUV_SelSeqPasteUV" bl_label = "Paste UV (Selection Sequence) (Menu)" bl_description = "Menu of Paste UV coordinate by selection sequence" diff --git a/magic_uv/op/copy_paste_uv_object.py b/magic_uv/op/copy_paste_uv_object.py index 23ff412b..0b26d1c3 100644 --- a/magic_uv/op/copy_paste_uv_object.py +++ b/magic_uv/op/copy_paste_uv_object.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bmesh import bpy @@ -103,7 +103,7 @@ class MUV_OT_CopyPasteUVObject_CopyUV(bpy.types.Operator): Operation class: Copy UV coordinate among objects """ - bl_idname = "object.muv_ot_copy_paste_uv_object_copy_uv" + bl_idname = "object.muv_copy_paste_uv_object_copy_uv" bl_label = "Copy UV (Among Objects)" bl_description = "Copy UV coordinate (Among Objects)" bl_options = {'REGISTER', 'UNDO'} @@ -147,7 +147,7 @@ class MUV_MT_CopyPasteUVObject_CopyUV(bpy.types.Menu): Menu class: Copy UV coordinate among objects """ - bl_idname = "object.muv_mt_copy_paste_uv_object_copy_uv" + bl_idname = "MUV_MT_CopyPasteUVObject_CopyUV" bl_label = "Copy UV (Among Objects) (Menu)" bl_description = "Menu of Copy UV coordinate (Among Objects)" @@ -181,7 +181,7 @@ class MUV_OT_CopyPasteUVObject_PasteUV(bpy.types.Operator): Operation class: Paste UV coordinate among objects """ - bl_idname = "object.muv_ot_copy_paste_uv_object_paste_uv" + bl_idname = "object.muv_copy_paste_uv_object_paste_uv" bl_label = "Paste UV (Among Objects)" bl_description = "Paste UV coordinate (Among Objects)" bl_options = {'REGISTER', 'UNDO'} @@ -260,7 +260,7 @@ class MUV_MT_CopyPasteUVObject_PasteUV(bpy.types.Menu): Menu class: Paste UV coordinate among objects """ - bl_idname = "object.muv_mt_copy_paste_uv_object_paste_uv" + bl_idname = "MUV_MT_CopyPasteUVObject_PasteUV" bl_label = "Paste UV (Among Objects) (Menu)" bl_description = "Menu of Paste UV coordinate (Among Objects)" diff --git a/magic_uv/op/copy_paste_uv_uvedit.py b/magic_uv/op/copy_paste_uv_uvedit.py index b448f866..c386e311 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 " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import math from math import atan2, sin, cos @@ -80,7 +80,7 @@ class MUV_OT_CopyPasteUVUVEdit_CopyUV(bpy.types.Operator): Operation class: Copy UV coordinate on UV/Image Editor """ - bl_idname = "uv.muv_ot_copy_paste_uv_uvedit_copy_uv" + bl_idname = "uv.muv_copy_paste_uv_uvedit_copy_uv" bl_label = "Copy UV (UV/Image Editor)" bl_description = "Copy UV coordinate (only selected in UV/Image Editor)" bl_options = {'REGISTER', 'UNDO'} @@ -122,7 +122,7 @@ class MUV_OT_CopyPasteUVUVEdit_PasteUV(bpy.types.Operator): Operation class: Paste UV coordinate on UV/Image Editor """ - bl_idname = "uv.muv_ot_copy_paste_uv_uvedit_paste_uv" + bl_idname = "uv.muv_copy_paste_uv_uvedit_paste_uv" bl_label = "Paste UV (UV/Image Editor)" bl_description = "Paste UV coordinate (only selected in UV/Image Editor)" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/flip_rotate_uv.py b/magic_uv/op/flip_rotate_uv.py index c4c05169..7879812e 100644 --- a/magic_uv/op/flip_rotate_uv.py +++ b/magic_uv/op/flip_rotate_uv.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy import bmesh @@ -163,12 +163,12 @@ class _Properties: @BlClassRegistry() @compat.make_annotations -class MUV_OT_FlipRotate(bpy.types.Operator): +class MUV_OT_FlipRotateUV(bpy.types.Operator): """ Operation class: Flip and Rotate UV coordinate """ - bl_idname = "uv.muv_ot_flip_rotate_uv" + bl_idname = "uv.muv_flip_rotate_uv" bl_label = "Flip/Rotate UV" bl_description = "Flip/Rotate UV coordinate" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/mirror_uv.py b/magic_uv/op/mirror_uv.py index fb98bb05..16fbe9af 100644 --- a/magic_uv/op/mirror_uv.py +++ b/magic_uv/op/mirror_uv.py @@ -20,8 +20,8 @@ __author__ = "Keith (Wahooney) Boshoff, Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy from bpy.props import ( @@ -136,7 +136,7 @@ class MUV_OT_MirrorUV(bpy.types.Operator): Operation class: Mirror UV """ - bl_idname = "uv.muv_ot_mirror_uv" + bl_idname = "uv.muv_mirror_uv" bl_label = "Mirror UV" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/move_uv.py b/magic_uv/op/move_uv.py index be019e9f..90cfdace 100644 --- a/magic_uv/op/move_uv.py +++ b/magic_uv/op/move_uv.py @@ -20,8 +20,8 @@ __author__ = "kgeogeo, mem, Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy from bpy.props import BoolProperty @@ -91,7 +91,7 @@ class MUV_OT_MoveUV(bpy.types.Operator): Operator class: Move UV """ - bl_idname = "uv.muv_ot_move_uv" + bl_idname = "uv.muv_move_uv" bl_label = "Move UV" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/pack_uv.py b/magic_uv/op/pack_uv.py index 4eb3841d..303fa9b0 100644 --- a/magic_uv/op/pack_uv.py +++ b/magic_uv/op/pack_uv.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from math import fabs @@ -187,7 +187,7 @@ class MUV_OT_PackUV(bpy.types.Operator): - Same number of UV """ - bl_idname = "uv.muv_ot_pack_uv" + bl_idname = "uv.muv_pack_uv" bl_label = "Pack UV" bl_description = "Pack UV (Same UV Islands are integrated)" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/preserve_uv_aspect.py b/magic_uv/op/preserve_uv_aspect.py index 116fe898..091eee15 100644 --- a/magic_uv/op/preserve_uv_aspect.py +++ b/magic_uv/op/preserve_uv_aspect.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy from bpy.props import StringProperty, EnumProperty, BoolProperty @@ -108,7 +108,7 @@ class MUV_OT_PreserveUVAspect(bpy.types.Operator): Operation class: Preserve UV Aspect """ - bl_idname = "uv.muv_ot_preserve_uv_aspect" + bl_idname = "uv.muv_preserve_uv_aspect" bl_label = "Preserve UV Aspect" bl_description = "Choose Image" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/select_uv.py b/magic_uv/op/select_uv.py index 72757e29..1b0766f8 100644 --- a/magic_uv/op/select_uv.py +++ b/magic_uv/op/select_uv.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy from bpy.props import BoolProperty @@ -78,7 +78,7 @@ class MUV_OT_SelectUV_SelectOverlapped(bpy.types.Operator): Operation class: Select faces which have overlapped UVs """ - bl_idname = "uv.muv_ot_select_uv_select_overlapped" + bl_idname = "uv.muv_select_uv_select_overlapped" bl_label = "Overlapped" bl_description = "Select faces which have overlapped UVs" bl_options = {'REGISTER', 'UNDO'} @@ -123,7 +123,7 @@ class MUV_OT_SelectUV_SelectFlipped(bpy.types.Operator): Operation class: Select faces which have flipped UVs """ - bl_idname = "uv.muv_ot_select_uv_select_flipped" + bl_idname = "uv.muv_select_uv_select_flipped" bl_label = "Flipped" bl_description = "Select faces which have flipped UVs" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/smooth_uv.py b/magic_uv/op/smooth_uv.py index 0cb4df51..a00554ac 100644 --- a/magic_uv/op/smooth_uv.py +++ b/magic_uv/op/smooth_uv.py @@ -20,8 +20,8 @@ __author__ = "imdjs, Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy from bpy.props import BoolProperty, FloatProperty @@ -97,7 +97,7 @@ class _Properties: @compat.make_annotations class MUV_OT_SmoothUV(bpy.types.Operator): - bl_idname = "uv.muv_ot_smooth_uv" + bl_idname = "uv.muv_smooth_uv" bl_label = "Smooth" bl_description = "Smooth UV coordinates" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/texture_lock.py b/magic_uv/op/texture_lock.py index 791a7ae6..9f69e259 100644 --- a/magic_uv/op/texture_lock.py +++ b/magic_uv/op/texture_lock.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import math from math import atan2, cos, sqrt, sin, fabs @@ -226,7 +226,7 @@ class _Properties: pass def update_func(_, __): - bpy.ops.uv.muv_ot_texture_lock_intr('INVOKE_REGION_WIN') + bpy.ops.uv.muv_texture_lock_intr('INVOKE_REGION_WIN') scene.muv_texture_lock_enabled = BoolProperty( name="Texture Lock Enabled", @@ -260,7 +260,7 @@ class MUV_OT_TextureLock_Lock(bpy.types.Operator): Operation class: Lock Texture """ - bl_idname = "uv.muv_ot_texture_lock_lock" + bl_idname = "uv.muv_texture_lock_lock" bl_label = "Lock Texture" bl_description = "Lock Texture" bl_options = {'REGISTER', 'UNDO'} @@ -307,7 +307,7 @@ class MUV_OT_TextureLock_Unlock(bpy.types.Operator): Operation class: Unlock Texture """ - bl_idname = "uv.muv_ot_texture_lock_unlock" + bl_idname = "uv.muv_texture_lock_unlock" bl_label = "Unlock Texture" bl_description = "Unlock Texture" bl_options = {'REGISTER', 'UNDO'} @@ -392,7 +392,7 @@ class MUV_OT_TextureLock_Intr(bpy.types.Operator): Operation class: Texture Lock (Interactive mode) """ - bl_idname = "uv.muv_ot_texture_lock_intr" + bl_idname = "uv.muv_texture_lock_intr" bl_label = "Texture Lock (Interactive mode)" bl_description = "Internal operation for Texture Lock (Interactive mode)" diff --git a/magic_uv/op/texture_projection.py b/magic_uv/op/texture_projection.py index b5360e4d..a93c9ec3 100644 --- a/magic_uv/op/texture_projection.py +++ b/magic_uv/op/texture_projection.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from collections import namedtuple @@ -157,7 +157,7 @@ class _Properties: pass def update_func(_, __): - bpy.ops.uv.muv_ot_texture_projection('INVOKE_REGION_WIN') + bpy.ops.uv.muv_texture_projection('INVOKE_REGION_WIN') scene.muv_texture_projection_enabled = BoolProperty( name="Texture Projection Enabled", @@ -225,7 +225,7 @@ class MUV_OT_TextureProjection(bpy.types.Operator): Render texture """ - bl_idname = "uv.muv_ot_texture_projection" + bl_idname = "uv.muv_texture_projection" bl_description = "Render selected texture" bl_label = "Texture renderer" @@ -332,7 +332,7 @@ class MUV_OT_TextureProjection_Project(bpy.types.Operator): Operation class: Project texture """ - bl_idname = "uv.muv_ot_texture_projection_project" + bl_idname = "uv.muv_texture_projection_project" bl_label = "Project Texture" bl_description = "Project Texture" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/texture_wrap.py b/magic_uv/op/texture_wrap.py index 49242b83..20306241 100644 --- a/magic_uv/op/texture_wrap.py +++ b/magic_uv/op/texture_wrap.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy from bpy.props import ( @@ -97,7 +97,7 @@ class MUV_OT_TextureWrap_Refer(bpy.types.Operator): Operation class: Refer UV """ - bl_idname = "uv.muv_ot_texture_wrap_refer" + bl_idname = "uv.muv_texture_wrap_refer" bl_label = "Refer" bl_description = "Refer UV" bl_options = {'REGISTER', 'UNDO'} @@ -137,7 +137,7 @@ class MUV_OT_TextureWrap_Set(bpy.types.Operator): Operation class: Set UV """ - bl_idname = "uv.muv_ot_texture_wrap_set" + bl_idname = "uv.muv_texture_wrap_set" bl_label = "Set" bl_description = "Set UV" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/transfer_uv.py b/magic_uv/op/transfer_uv.py index e812d295..c287f1ec 100644 --- a/magic_uv/op/transfer_uv.py +++ b/magic_uv/op/transfer_uv.py @@ -20,8 +20,8 @@ __author__ = "Nutti , Mifth, MaxRobinot" __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from collections import OrderedDict @@ -363,7 +363,7 @@ class MUV_OT_TransferUV_CopyUV(bpy.types.Operator): Topological based copy """ - bl_idname = "uv.muv_ot_transfer_uv_copy_uv" + bl_idname = "uv.muv_transfer_uv_copy_uv" bl_label = "Transfer UV Copy UV" bl_description = "Transfer UV Copy UV (Topological based copy)" bl_options = {'REGISTER', 'UNDO'} @@ -404,7 +404,7 @@ class MUV_OT_TransferUV_PasteUV(bpy.types.Operator): Topological based paste """ - bl_idname = "uv.muv_ot_transfer_uv_paste_uv" + bl_idname = "uv.muv_transfer_uv_paste_uv" bl_label = "Transfer UV Paste UV" bl_description = "Transfer UV Paste UV (Topological based paste)" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/unwrap_constraint.py b/magic_uv/op/unwrap_constraint.py index b622663a..970d09d0 100644 --- a/magic_uv/op/unwrap_constraint.py +++ b/magic_uv/op/unwrap_constraint.py @@ -18,8 +18,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy from bpy.props import ( @@ -92,7 +92,7 @@ class MUV_OT_UnwrapConstraint(bpy.types.Operator): Operation class: Unwrap with constrain UV coordinate """ - bl_idname = "uv.muv_ot_unwrap_constraint" + bl_idname = "uv.muv_unwrap_constraint" bl_label = "Unwrap Constraint" bl_description = "Unwrap while keeping uv coordinate" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/uv_bounding_box.py b/magic_uv/op/uv_bounding_box.py index 38d665e1..b7c6620c 100644 --- a/magic_uv/op/uv_bounding_box.py +++ b/magic_uv/op/uv_bounding_box.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from enum import IntEnum import math @@ -88,7 +88,7 @@ class _Properties: pass def update_func(_, __): - bpy.ops.uv.muv_ot_uv_bounding_box('INVOKE_REGION_WIN') + bpy.ops.uv.muv_uv_bounding_box('INVOKE_REGION_WIN') scene.muv_uv_bounding_box_enabled = BoolProperty( name="UV Bounding Box Enabled", @@ -612,7 +612,7 @@ class MUV_OT_UVBoundingBox(bpy.types.Operator): Operation class: UV Bounding Box """ - bl_idname = "uv.muv_ot_uv_bounding_box" + bl_idname = "uv.muv_uv_bounding_box" bl_label = "UV Bounding Box" bl_description = "Internal operation for UV Bounding Box" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/uv_inspection.py b/magic_uv/op/uv_inspection.py index 61cbf1ed..356a97b7 100644 --- a/magic_uv/op/uv_inspection.py +++ b/magic_uv/op/uv_inspection.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy from bpy.props import BoolProperty, EnumProperty @@ -99,7 +99,7 @@ class _Properties: pass def update_func(_, __): - bpy.ops.uv.muv_ot_uv_inspection_render('INVOKE_REGION_WIN') + bpy.ops.uv.muv_uv_inspection_render('INVOKE_REGION_WIN') scene.muv_uv_inspection_enabled = BoolProperty( name="UV Inspection Enabled", @@ -151,7 +151,7 @@ class MUV_OT_UVInspection_Render(bpy.types.Operator): No operation (only rendering) """ - bl_idname = "uv.muv_ot_uv_inspection_render" + bl_idname = "uv.muv_uv_inspection_render" bl_description = "Render overlapped/flipped UVs" bl_label = "Overlapped/Flipped UV renderer" @@ -258,7 +258,7 @@ class MUV_OT_UVInspection_Update(bpy.types.Operator): Operation class: Update """ - bl_idname = "uv.muv_ot_uv_inspection_update" + bl_idname = "uv.muv_uv_inspection_update" bl_label = "Update UV Inspection" bl_description = "Update UV Inspection" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/uv_sculpt.py b/magic_uv/op/uv_sculpt.py index de5f1e02..5582772f 100644 --- a/magic_uv/op/uv_sculpt.py +++ b/magic_uv/op/uv_sculpt.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from math import pi, cos, tan, sin @@ -96,7 +96,7 @@ class _Properties: pass def update_func(_, __): - bpy.ops.uv.muv_ot_uv_sculpt('INVOKE_REGION_WIN') + bpy.ops.uv.muv_uv_sculpt('INVOKE_REGION_WIN') scene.muv_uv_sculpt_enabled = BoolProperty( name="UV Sculpt", @@ -174,7 +174,7 @@ class MUV_OT_UVSculpt(bpy.types.Operator): Operation class: UV Sculpt in View3D """ - bl_idname = "uv.muv_ot_uv_sculpt" + bl_idname = "uv.muv_uv_sculpt" bl_label = "UV Sculpt" bl_description = "UV Sculpt in View3D" bl_options = {'REGISTER'} diff --git a/magic_uv/op/uvw.py b/magic_uv/op/uvw.py index 035dfca3..2bbc9a77 100644 --- a/magic_uv/op/uvw.py +++ b/magic_uv/op/uvw.py @@ -20,8 +20,8 @@ __author__ = "Alexander Milovsky, Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from math import sin, cos, pi @@ -191,7 +191,7 @@ class _Properties: @BlClassRegistry() @compat.make_annotations class MUV_OT_UVW_BoxMap(bpy.types.Operator): - bl_idname = "uv.muv_ot_uvw_box_map" + bl_idname = "uv.muv_uvw_box_map" bl_label = "Box Map" bl_options = {'REGISTER', 'UNDO'} @@ -249,7 +249,7 @@ class MUV_OT_UVW_BoxMap(bpy.types.Operator): @BlClassRegistry() @compat.make_annotations class MUV_OT_UVW_BestPlanerMap(bpy.types.Operator): - bl_idname = "uv.muv_ot_uvw_best_planer_map" + bl_idname = "uv.muv_uvw_best_planer_map" bl_label = "Best Planer Map" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/op/world_scale_uv.py b/magic_uv/op/world_scale_uv.py index 1d78b8c7..11b38bff 100644 --- a/magic_uv/op/world_scale_uv.py +++ b/magic_uv/op/world_scale_uv.py @@ -20,8 +20,8 @@ __author__ = "McBuff, Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from math import sqrt @@ -31,6 +31,7 @@ from bpy.props import ( FloatProperty, IntVectorProperty, BoolProperty, + StringProperty, ) import bmesh from mathutils import Vector @@ -62,9 +63,9 @@ def _is_valid_context(context): return True -def _measure_wsuv_info(obj, tex_size=None): +def _measure_wsuv_info(obj, method='FIRST', tex_size=None): mesh_area = common.measure_mesh_area(obj) - uv_area = common.measure_uv_area(obj, tex_size) + uv_area = common.measure_uv_area(obj, method, tex_size) if not uv_area: return None, mesh_area, None @@ -177,6 +178,16 @@ def _apply(obj, origin, factor): bmesh.update_edit_mesh(obj.data) +def _get_target_textures(_, __): + images = common.find_images(bpy.context.active_object) + items = [] + items.append(("[Average]", "[Average]", "Average of all textures")) + items.append(("[Max]", "[Max]", "Max of all textures")) + items.append(("[Min]", "[Min]", "Min of all textures")) + items.extend([(img.name, img.name, "") for img in images]) + return items + + @PropertyClassRegistry() class _Properties: idname = "world_scale_uv" @@ -254,7 +265,17 @@ class _Properties: ('RIGHT_BOTTOM', "Right Bottom", "Right Bottom") ], - default='CENTER' + default='CENTER', + ) + scene.muv_world_scale_uv_measure_tgt_texture = EnumProperty( + name="Texture", + description="Texture to be measured", + items=_get_target_textures + ) + scene.muv_world_scale_uv_apply_tgt_texture = EnumProperty( + name="Texture", + description="Texture to be applied", + items=_get_target_textures ) @classmethod @@ -267,19 +288,28 @@ class _Properties: del scene.muv_world_scale_uv_tgt_scaling_factor del scene.muv_world_scale_uv_mode del scene.muv_world_scale_uv_origin + del scene.muv_world_scale_uv_measure_tgt_texture + del scene.muv_world_scale_uv_apply_tgt_texture @BlClassRegistry() +@compat.make_annotations class MUV_OT_WorldScaleUV_Measure(bpy.types.Operator): """ Operation class: Measure face size """ - bl_idname = "uv.muv_ot_world_scale_uv_measure" + bl_idname = "uv.muv_world_scale_uv_measure" bl_label = "Measure World Scale UV" bl_description = "Measure face size for scale calculation" bl_options = {'REGISTER', 'UNDO'} + tgt_texture = StringProperty( + name="Texture", + description="Texture to be measured", + default="[Average]" + ) + @classmethod def poll(cls, context): # we can not get area/space/region from console @@ -291,7 +321,16 @@ class MUV_OT_WorldScaleUV_Measure(bpy.types.Operator): sc = context.scene obj = context.active_object - uv_area, mesh_area, density = _measure_wsuv_info(obj) + if self.tgt_texture == "[Average]": + uv_area, mesh_area, density = _measure_wsuv_info(obj, 'AVERAGE') + elif self.tgt_texture == "[Max]": + uv_area, mesh_area, density = _measure_wsuv_info(obj, 'MAX') + elif self.tgt_texture == "[Min]": + uv_area, mesh_area, density = _measure_wsuv_info(obj, 'MIN') + else: + texture = bpy.data.images[self.tgt_texture] + uv_area, mesh_area, density = _measure_wsuv_info( + obj, 'USER_SPECIFIED', texture.size) if not uv_area: self.report({'WARNING'}, "Object must have more than one UV map and texture") @@ -315,7 +354,7 @@ class MUV_OT_WorldScaleUV_ApplyManual(bpy.types.Operator): Operation class: Apply scaled UV (Manual) """ - bl_idname = "uv.muv_ot_world_scale_uv_apply_manual" + bl_idname = "uv.muv_world_scale_uv_apply_manual" bl_label = "Apply World Scale UV (Manual)" bl_description = "Apply scaled UV based on user specification" bl_options = {'REGISTER', 'UNDO'} @@ -373,7 +412,8 @@ class MUV_OT_WorldScaleUV_ApplyManual(bpy.types.Operator): bm.faces.ensure_lookup_table() tex_size = self.tgt_texture_size - uv_area, _, density = _measure_wsuv_info(obj, tex_size) + uv_area, _, density = _measure_wsuv_info(obj, 'USER_SPECIFIED', + tex_size) if not uv_area: self.report({'WARNING'}, "Object must have more than one UV map") return {'CANCELLED'} @@ -413,7 +453,7 @@ class MUV_OT_WorldScaleUV_ApplyScalingDensity(bpy.types.Operator): Operation class: Apply scaled UV (Scaling Density) """ - bl_idname = "uv.muv_ot_world_scale_uv_apply_scaling_density" + bl_idname = "uv.muv_world_scale_uv_apply_scaling_density" bl_label = "Apply World Scale UV (Scaling Density)" bl_description = "Apply scaled UV with scaling density" bl_options = {'REGISTER', 'UNDO'} @@ -460,6 +500,11 @@ class MUV_OT_WorldScaleUV_ApplyScalingDensity(bpy.types.Operator): default=True, options={'HIDDEN', 'SKIP_SAVE'} ) + tgt_texture = StringProperty( + name="Texture", + description="Texture to be applied", + default="[Average]" + ) @classmethod def poll(cls, context): @@ -476,7 +521,16 @@ class MUV_OT_WorldScaleUV_ApplyScalingDensity(bpy.types.Operator): bm.edges.ensure_lookup_table() bm.faces.ensure_lookup_table() - uv_area, _, density = _measure_wsuv_info(obj) + if self.tgt_texture == "[Average]": + uv_area, _, density = _measure_wsuv_info(obj, 'AVERAGE') + elif self.tgt_texture == "[Max]": + uv_area, _, density = _measure_wsuv_info(obj, 'MAX') + elif self.tgt_texture == "[Min]": + uv_area, _, density = _measure_wsuv_info(obj, 'MIN') + else: + tgt_texture = bpy.data.images[self.tgt_texture] + uv_area, _, density = _measure_wsuv_info(obj, 'USER_SPECIFIED', + tgt_texture.size) if not uv_area: self.report({'WARNING'}, "Object must have more than one UV map and texture") @@ -537,7 +591,7 @@ class MUV_OT_WorldScaleUV_ApplyProportionalToMesh(bpy.types.Operator): Operation class: Apply scaled UV (Proportional to mesh) """ - bl_idname = "uv.muv_ot_world_scale_uv_apply_proportional_to_mesh" + bl_idname = "uv.muv_world_scale_uv_apply_proportional_to_mesh" bl_label = "Apply World Scale UV (Proportional to mesh)" bl_description = "Apply scaled UV proportionaled to mesh" bl_options = {'REGISTER', 'UNDO'} @@ -586,6 +640,11 @@ class MUV_OT_WorldScaleUV_ApplyProportionalToMesh(bpy.types.Operator): default=True, options={'HIDDEN', 'SKIP_SAVE'} ) + tgt_texture = StringProperty( + name="Texture", + description="Texture to be applied", + default="[Average]" + ) @classmethod def poll(cls, context): @@ -602,7 +661,16 @@ class MUV_OT_WorldScaleUV_ApplyProportionalToMesh(bpy.types.Operator): bm.edges.ensure_lookup_table() bm.faces.ensure_lookup_table() - uv_area, mesh_area, density = _measure_wsuv_info(obj) + if self.tgt_texture == "[Average]": + uv_area, mesh_area, density = _measure_wsuv_info(obj, 'AVERAGE') + elif self.tgt_texture == "[Max]": + uv_area, mesh_area, density = _measure_wsuv_info(obj, 'MAX') + elif self.tgt_texture == "[Min]": + uv_area, mesh_area, density = _measure_wsuv_info(obj, 'MIN') + else: + tgt_texture = bpy.data.images[self.tgt_texture] + uv_area, mesh_area, density = _measure_wsuv_info( + obj, 'USER_SPECIFIED', tgt_texture.size) if not uv_area: self.report({'WARNING'}, "Object must have more than one UV map and texture") diff --git a/magic_uv/preferences.py b/magic_uv/preferences.py index 3a024488..ec433e8e 100644 --- a/magic_uv/preferences.py +++ b/magic_uv/preferences.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy from bpy.props import ( @@ -33,7 +33,7 @@ from bpy.props import ( from bpy.types import AddonPreferences from . import common -from .op.flip_rotate_uv import MUV_OT_FlipRotate +from .op.flip_rotate_uv import MUV_OT_FlipRotateUV from .op.mirror_uv import MUV_OT_MirrorUV from .op.move_uv import MUV_OT_MoveUV from .op.unwrap_constraint import MUV_OT_UnwrapConstraint @@ -77,7 +77,7 @@ def view3d_uvmap_menu_fn(self, context): layout.separator() layout.label(text="UV Manipulation", icon=compat.icon('IMAGE')) # Flip/Rotate UV - ops = layout.operator(MUV_OT_FlipRotate.bl_idname, text="Flip/Rotate UV") + ops = layout.operator(MUV_OT_FlipRotateUV.bl_idname, text="Flip/Rotate UV") ops.seams = sc.muv_flip_rotate_uv_seams # Mirror UV ops = layout.operator(MUV_OT_MirrorUV.bl_idname, text="Mirror UV") @@ -187,7 +187,7 @@ def get_debug_mode(self): @BlClassRegistry() @compat.make_annotations -class Preferences(AddonPreferences): +class MUV_Preferences(AddonPreferences): """Preferences class: Preferences for this add-on""" bl_idname = "magic_uv" diff --git a/magic_uv/properites.py b/magic_uv/properites.py index 6ee00edd..d7e92bb0 100644 --- a/magic_uv/properites.py +++ b/magic_uv/properites.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from .utils.property_class_registry import PropertyClassRegistry diff --git a/magic_uv/ui/IMAGE_MT_uvs.py b/magic_uv/ui/IMAGE_MT_uvs.py index ab7e33f8..f723a007 100644 --- a/magic_uv/ui/IMAGE_MT_uvs.py +++ b/magic_uv/ui/IMAGE_MT_uvs.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy @@ -49,7 +49,7 @@ class MUV_MT_CopyPasteUV_UVEdit(bpy.types.Menu): Menu class: Master menu of Copy/Paste UV coordinate on UV/ImageEditor """ - bl_idname = "uv.muv_mt_copy_paste_uv_uvedit" + bl_idname = "MUV_MT_CopyPasteUV_UVEdit" bl_label = "Copy/Paste UV" bl_description = "Copy and Paste UV coordinate among object" @@ -67,7 +67,7 @@ class MUV_MT_AlignUV(bpy.types.Menu): Menu class: Master menu of Align UV """ - bl_idname = "uv.muv_mt_align_uv" + bl_idname = "MUV_MT_AlignUV" bl_label = "Align UV" bl_description = "Align UV" @@ -100,7 +100,7 @@ class MUV_MT_SelectUV(bpy.types.Menu): Menu class: Master menu of Select UV """ - bl_idname = "uv.muv_mt_select_uv" + bl_idname = "MUV_MT_SelectUV" bl_label = "Select UV" bl_description = "Select UV" @@ -119,7 +119,7 @@ class MUV_MT_AlignUVCursor(bpy.types.Menu): Menu class: Master menu of Align UV Cursor """ - bl_idname = "uv.muv_mt_align_uv_cursor" + bl_idname = "MUV_MT_AlignUVCursor" bl_label = "Align UV Cursor" bl_description = "Align UV cursor" @@ -176,7 +176,7 @@ class MUV_MT_UVInspection(bpy.types.Menu): Menu class: Master menu of UV Inspection """ - bl_idname = "uv.muv_mt_uv_inspection" + bl_idname = "MUV_MT_UVInspection" bl_label = "UV Inspection" bl_description = "UV Inspection" diff --git a/magic_uv/ui/VIEW3D_MT_object.py b/magic_uv/ui/VIEW3D_MT_object.py index b691bdd5..54f0c3b0 100644 --- a/magic_uv/ui/VIEW3D_MT_object.py +++ b/magic_uv/ui/VIEW3D_MT_object.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy @@ -38,7 +38,7 @@ class MUV_MT_CopyPasteUV_Object(bpy.types.Menu): Menu class: Master menu of Copy/Paste UV coordinate among object """ - bl_idname = "uv.muv_mt_copy_paste_uv_object" + bl_idname = "MUV_MT_CopyPasteUV_Object" bl_label = "Copy/Paste UV" bl_description = "Copy and Paste UV coordinate among object" diff --git a/magic_uv/ui/VIEW3D_MT_uv_map.py b/magic_uv/ui/VIEW3D_MT_uv_map.py index 12202602..28a125f5 100644 --- a/magic_uv/ui/VIEW3D_MT_uv_map.py +++ b/magic_uv/ui/VIEW3D_MT_uv_map.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy.utils @@ -64,7 +64,7 @@ class MUV_MT_CopyPasteUV(bpy.types.Menu): Menu class: Master menu of Copy/Paste UV coordinate """ - bl_idname = "uv.muv_mt_copy_paste_uv" + bl_idname = "MUV_MT_CopyPasteUV" bl_label = "Copy/Paste UV" bl_description = "Copy and Paste UV coordinate" @@ -88,7 +88,7 @@ class MUV_MT_TransferUV(bpy.types.Menu): Menu class: Master menu of Transfer UV coordinate """ - bl_idname = "uv.muv_mt_transfer_uv" + bl_idname = "MUV_MT_TransferUV" bl_label = "Transfer UV" bl_description = "Transfer UV coordinate" @@ -109,7 +109,7 @@ class MUV_MT_TextureLock(bpy.types.Menu): Menu class: Master menu of Texture Lock """ - bl_idname = "uv.muv_mt_texture_lock" + bl_idname = "MUV_MT_TextureLock" bl_label = "Texture Lock" bl_description = "Lock texture when vertices of mesh (Preserve UV)" @@ -139,7 +139,7 @@ class MUV_MT_WorldScaleUV(bpy.types.Menu): Menu class: Master menu of world scale UV """ - bl_idname = "uv.muv_mt_world_scale_uv" + bl_idname = "MUV_MT_WorldScaleUV" bl_label = "World Scale UV" bl_description = "" @@ -181,7 +181,7 @@ class MUV_MT_TextureWrap(bpy.types.Menu): Menu class: Master menu of Texture Wrap """ - bl_idname = "uv.muv_mt_texture_wrap" + bl_idname = "MUV_MT_TextureWrap" bl_label = "Texture Wrap" bl_description = "" @@ -198,7 +198,7 @@ class MUV_MT_UVW(bpy.types.Menu): Menu class: Master menu of UVW """ - bl_idname = "uv.muv_mt_uvw" + bl_idname = "MUV_MT_UVW" bl_label = "UVW" bl_description = "" @@ -220,7 +220,7 @@ class MUV_MT_PreserveUVAspect(bpy.types.Menu): Menu class: Master menu of Preserve UV Aspect """ - bl_idname = "uv.muv_mt_preserve_uv_aspect" + bl_idname = "MUV_MT_PreserveUVAspect" bl_label = "Preserve UV Aspect" bl_description = "" @@ -240,7 +240,7 @@ class MUV_MT_TextureProjection(bpy.types.Menu): Menu class: Master menu of Texture Projection """ - bl_idname = "uv.muv_mt_texture_projection" + bl_idname = "MUV_MT_TextureProjection" bl_label = "Texture Projection" bl_description = "" diff --git a/magic_uv/ui/__init__.py b/magic_uv/ui/__init__.py index 032cc3bd..57f6a9d8 100644 --- a/magic_uv/ui/__init__.py +++ b/magic_uv/ui/__init__.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" if "bpy" in locals(): import importlib diff --git a/magic_uv/ui/uvedit_copy_paste_uv.py b/magic_uv/ui/uvedit_copy_paste_uv.py index 39259649..91705a66 100644 --- a/magic_uv/ui/uvedit_copy_paste_uv.py +++ b/magic_uv/ui/uvedit_copy_paste_uv.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy @@ -44,7 +44,6 @@ class MUV_PT_UVEdit_CopyPasteUV(bpy.types.Panel): bl_region_type = 'UI' bl_label = "Copy/Paste UV" bl_category = "Magic UV" - bl_context = 'mesh_edit' bl_options = {'DEFAULT_CLOSED'} def draw_header(self, _): diff --git a/magic_uv/ui/uvedit_editor_enhancement.py b/magic_uv/ui/uvedit_editor_enhancement.py index dbae514f..f30e0c58 100644 --- a/magic_uv/ui/uvedit_editor_enhancement.py +++ b/magic_uv/ui/uvedit_editor_enhancement.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy @@ -48,7 +48,6 @@ class MUV_PT_UVEdit_EditorEnhancement(bpy.types.Panel): bl_region_type = 'UI' bl_label = "Editor Enhancement" bl_category = "Magic UV" - bl_context = 'mesh_edit' bl_options = {'DEFAULT_CLOSED'} def draw_header(self, _): diff --git a/magic_uv/ui/uvedit_uv_manipulation.py b/magic_uv/ui/uvedit_uv_manipulation.py index 96c8b54b..ec2045ca 100644 --- a/magic_uv/ui/uvedit_uv_manipulation.py +++ b/magic_uv/ui/uvedit_uv_manipulation.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy @@ -53,7 +53,6 @@ class MUV_PT_UVEdit_UVManipulation(bpy.types.Panel): bl_region_type = 'UI' bl_label = "UV Manipulation" bl_category = "Magic UV" - bl_context = 'mesh_edit' bl_options = {'DEFAULT_CLOSED'} def draw_header(self, _): diff --git a/magic_uv/ui/view3d_copy_paste_uv_editmode.py b/magic_uv/ui/view3d_copy_paste_uv_editmode.py index 49a4e0a3..87d5e8f0 100644 --- a/magic_uv/ui/view3d_copy_paste_uv_editmode.py +++ b/magic_uv/ui/view3d_copy_paste_uv_editmode.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy diff --git a/magic_uv/ui/view3d_copy_paste_uv_objectmode.py b/magic_uv/ui/view3d_copy_paste_uv_objectmode.py index 574a0e43..9f29f1be 100644 --- a/magic_uv/ui/view3d_copy_paste_uv_objectmode.py +++ b/magic_uv/ui/view3d_copy_paste_uv_objectmode.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy diff --git a/magic_uv/ui/view3d_uv_manipulation.py b/magic_uv/ui/view3d_uv_manipulation.py index 312ae171..4c519b76 100644 --- a/magic_uv/ui/view3d_uv_manipulation.py +++ b/magic_uv/ui/view3d_uv_manipulation.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy @@ -43,12 +43,18 @@ from ..op.world_scale_uv import ( MUV_OT_WorldScaleUV_ApplyScalingDensity, MUV_OT_WorldScaleUV_ApplyProportionalToMesh, ) -from ..op.flip_rotate_uv import MUV_OT_FlipRotate +from ..op.flip_rotate_uv import MUV_OT_FlipRotateUV from ..op.mirror_uv import MUV_OT_MirrorUV from ..op.move_uv import MUV_OT_MoveUV from ..op.preserve_uv_aspect import MUV_OT_PreserveUVAspect from ..utils.bl_class_registry import BlClassRegistry from ..utils import compatibility as compat +from .. import common + + +def get_apply_target_texture_name(): + images = common.find_images(bpy.context.active_object) + return images.keys() @BlClassRegistry() @@ -77,7 +83,8 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): box.prop(sc, "muv_flip_rotate_uv_enabled", text="Flip/Rotate UV") if sc.muv_flip_rotate_uv_enabled: row = box.row() - ops = row.operator(MUV_OT_FlipRotate.bl_idname, text="Flip/Rotate") + ops = row.operator(MUV_OT_FlipRotateUV.bl_idname, + text="Flip/Rotate") ops.seams = sc.muv_flip_rotate_uv_seams row.prop(sc, "muv_flip_rotate_uv_seams", text="Seams") @@ -106,6 +113,17 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): box.prop(sc, "muv_world_scale_uv_mode", text="") if sc.muv_world_scale_uv_mode == 'MANUAL': + sp = compat.layout_split(box, 0.4) + col = sp.column(align=True) + col.label(text="Target:") + sp = compat.layout_split(sp, 1.0) + col = sp.column(align=True) + ops = col.operator(MUV_OT_WorldScaleUV_ApplyManual.bl_idname, + text="Apply") + ops.tgt_density = sc.muv_world_scale_uv_tgt_density + ops.tgt_texture_size = sc.muv_world_scale_uv_tgt_texture_size + ops.origin = sc.muv_world_scale_uv_origin + ops.show_dialog = False sp = compat.layout_split(box, 0.5) col = sp.column() col.prop(sc, "muv_world_scale_uv_tgt_texture_size", @@ -113,14 +131,8 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): sp = compat.layout_split(sp, 1.0) col = sp.column() col.label(text="Density:") - col.prop(sc, "muv_world_scale_uv_tgt_density", text="") + col.prop(sc, "muv_world_scale_uv_tgt_density") box.prop(sc, "muv_world_scale_uv_origin", text="Origin") - ops = box.operator(MUV_OT_WorldScaleUV_ApplyManual.bl_idname, - text="Apply") - ops.tgt_density = sc.muv_world_scale_uv_tgt_density - ops.tgt_texture_size = sc.muv_world_scale_uv_tgt_texture_size - ops.origin = sc.muv_world_scale_uv_origin - ops.show_dialog = False elif sc.muv_world_scale_uv_mode == 'SAME_DENSITY': sp = compat.layout_split(box, 0.4) @@ -128,9 +140,11 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): col.label(text="Source:") sp = compat.layout_split(sp, 1.0) col = sp.column(align=True) - col.operator(MUV_OT_WorldScaleUV_Measure.bl_idname, - text="Measure") - + ops = col.operator(MUV_OT_WorldScaleUV_Measure.bl_idname, + text="Measure") + ops.tgt_texture = sc.muv_world_scale_uv_measure_tgt_texture + col = box.column(align=True) + col.prop(sc, "muv_world_scale_uv_measure_tgt_texture") sp = compat.layout_split(box, 0.7) col = sp.column(align=True) col.prop(sc, "muv_world_scale_uv_src_density", text="Density") @@ -140,14 +154,20 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): col.label(text="px2/cm2") box.separator() - box.prop(sc, "muv_world_scale_uv_origin", text="Origin") - ops = box.operator( + sp = compat.layout_split(box, 0.4) + col = sp.column(align=True) + col.label(text="Target:") + sp = compat.layout_split(sp, 1.0) + col = sp.column(align=True) + ops = col.operator( MUV_OT_WorldScaleUV_ApplyScalingDensity.bl_idname, text="Apply") ops.src_density = sc.muv_world_scale_uv_src_density ops.origin = sc.muv_world_scale_uv_origin ops.same_density = True ops.show_dialog = False + ops.tgt_texture = sc.muv_world_scale_uv_apply_tgt_texture + box.prop(sc, "muv_world_scale_uv_origin", text="Origin") elif sc.muv_world_scale_uv_mode == 'SCALING_DENSITY': sp = compat.layout_split(box, 0.4) @@ -155,9 +175,11 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): col.label(text="Source:") sp = compat.layout_split(sp, 1.0) col = sp.column(align=True) - col.operator(MUV_OT_WorldScaleUV_Measure.bl_idname, - text="Measure") - + ops = col.operator(MUV_OT_WorldScaleUV_Measure.bl_idname, + text="Measure") + ops.tgt_texture = sc.muv_world_scale_uv_measure_tgt_texture + col = box.column(align=True) + col.prop(sc, "muv_world_scale_uv_measure_tgt_texture") sp = compat.layout_split(box, 0.7) col = sp.column(align=True) col.prop(sc, "muv_world_scale_uv_src_density", text="Density") @@ -167,10 +189,12 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): col.label(text="px2/cm2") box.separator() - box.prop(sc, "muv_world_scale_uv_tgt_scaling_factor", - text="Scaling Factor") - box.prop(sc, "muv_world_scale_uv_origin", text="Origin") - ops = box.operator( + sp = compat.layout_split(box, 0.4) + col = sp.column(align=True) + col.label(text="Target:") + sp = compat.layout_split(sp, 1.0) + col = sp.column(align=True) + ops = col.operator( MUV_OT_WorldScaleUV_ApplyScalingDensity.bl_idname, text="Apply") ops.src_density = sc.muv_world_scale_uv_src_density @@ -179,6 +203,10 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): ops.show_dialog = False ops.tgt_scaling_factor = \ sc.muv_world_scale_uv_tgt_scaling_factor + ops.tgt_texture = sc.muv_world_scale_uv_apply_tgt_texture + box.prop(sc, "muv_world_scale_uv_tgt_scaling_factor", + text="Scaling Factor") + box.prop(sc, "muv_world_scale_uv_origin", text="Origin") elif sc.muv_world_scale_uv_mode == 'PROPORTIONAL_TO_MESH': sp = compat.layout_split(box, 0.4) @@ -186,9 +214,11 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): col.label(text="Source:") sp = compat.layout_split(sp, 1.0) col = sp.column(align=True) - col.operator(MUV_OT_WorldScaleUV_Measure.bl_idname, - text="Measure") - + ops = col.operator(MUV_OT_WorldScaleUV_Measure.bl_idname, + text="Measure") + ops.tgt_texture = sc.muv_world_scale_uv_measure_tgt_texture + col = box.column(align=True) + col.prop(sc, "muv_world_scale_uv_measure_tgt_texture") sp = compat.layout_split(box, 0.7) col = sp.column(align=True) col.prop(sc, "muv_world_scale_uv_src_mesh_area", @@ -204,8 +234,12 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): col.enabled = False box.separator() - box.prop(sc, "muv_world_scale_uv_origin", text="Origin") - ops = box.operator( + sp = compat.layout_split(box, 0.4) + col = sp.column(align=True) + col.label(text="Target:") + sp = compat.layout_split(sp, 1.0) + col = sp.column(align=True) + ops = col.operator( MUV_OT_WorldScaleUV_ApplyProportionalToMesh.bl_idname, text="Apply") ops.src_density = sc.muv_world_scale_uv_src_density @@ -213,6 +247,11 @@ class MUV_PT_View3D_UVManipulation(bpy.types.Panel): ops.src_mesh_area = sc.muv_world_scale_uv_src_mesh_area ops.origin = sc.muv_world_scale_uv_origin ops.show_dialog = False + ops.tgt_texture = sc.muv_world_scale_uv_apply_tgt_texture + box.prop(sc, "muv_world_scale_uv_origin", text="Origin") + + col = box.column(align=True) + col.prop(sc, "muv_world_scale_uv_apply_tgt_texture") box = layout.box() box.prop(sc, "muv_preserve_uv_aspect_enabled", diff --git a/magic_uv/ui/view3d_uv_mapping.py b/magic_uv/ui/view3d_uv_mapping.py index 278d1725..ca8dfae8 100644 --- a/magic_uv/ui/view3d_uv_mapping.py +++ b/magic_uv/ui/view3d_uv_mapping.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy diff --git a/magic_uv/updater.py b/magic_uv/updater.py index 8a8da2ba..e6242d98 100644 --- a/magic_uv/updater.py +++ b/magic_uv/updater.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import os @@ -41,7 +41,7 @@ from .utils import compatibility as compat @BlClassRegistry() class MUV_OT_CheckAddonUpdate(bpy.types.Operator): - bl_idname = "uv.muv_ot_check_addon_update" + bl_idname = "uv.muv_check_addon_update" bl_label = "Check Update" bl_description = "Check Add-on Update" bl_options = {'REGISTER', 'UNDO'} @@ -56,7 +56,7 @@ class MUV_OT_CheckAddonUpdate(bpy.types.Operator): @BlClassRegistry() @compat.make_annotations class MUV_OT_UpdateAddon(bpy.types.Operator): - bl_idname = "uv.muv_ot_update_addon" + bl_idname = "uv.muv_update_addon" bl_label = "Update" bl_description = "Update Add-on" bl_options = {'REGISTER', 'UNDO'} diff --git a/magic_uv/utils/__init__.py b/magic_uv/utils/__init__.py index b74ab903..8b99470e 100644 --- a/magic_uv/utils/__init__.py +++ b/magic_uv/utils/__init__.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" if "bpy" in locals(): import importlib diff --git a/magic_uv/utils/addon_updator.py b/magic_uv/utils/addon_updator.py index b2ff76cc..1ef522fb 100644 --- a/magic_uv/utils/addon_updator.py +++ b/magic_uv/utils/addon_updator.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from threading import Lock import urllib diff --git a/magic_uv/utils/bl_class_registry.py b/magic_uv/utils/bl_class_registry.py index 81e4b770..0cd86600 100644 --- a/magic_uv/utils/bl_class_registry.py +++ b/magic_uv/utils/bl_class_registry.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy @@ -37,11 +37,16 @@ class BlClassRegistry: def __call__(self, cls): if hasattr(cls, "bl_idname"): BlClassRegistry.add_class(cls.bl_idname, cls, self.legacy) - else: + elif hasattr(cls, "bl_context"): bl_idname = "{}{}{}{}".format(cls.bl_space_type, cls.bl_region_type, cls.bl_context, cls.bl_label) BlClassRegistry.add_class(bl_idname, cls, self.legacy) + else: + bl_idname = "{}{}{}".format(cls.bl_space_type, + cls.bl_region_type, + cls.bl_label) + BlClassRegistry.add_class(bl_idname, cls, self.legacy) return cls @classmethod diff --git a/magic_uv/utils/compatibility.py b/magic_uv/utils/compatibility.py index 62219435..c30ae595 100644 --- a/magic_uv/utils/compatibility.py +++ b/magic_uv/utils/compatibility.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" import bpy import bgl @@ -102,7 +102,7 @@ def get_object_select(obj): def set_active_object(obj): if check_version(2, 80, 0) < 0: - bpy.context.view_layer.objects.active = obj + bpy.context.scene.objects.active = obj else: bpy.context.view_layer.objects.active = obj diff --git a/magic_uv/utils/property_class_registry.py b/magic_uv/utils/property_class_registry.py index e99cd28b..6cf5f6a8 100644 --- a/magic_uv/utils/property_class_registry.py +++ b/magic_uv/utils/property_class_registry.py @@ -20,8 +20,8 @@ __author__ = "Nutti " __status__ = "production" -__version__ = "6.0" -__date__ = "26 Jan 2019" +__version__ = "6.1" +__date__ = "19 May 2019" from .. import common -- cgit v1.2.3