diff options
Diffstat (limited to 'magic_uv/op')
-rw-r--r-- | magic_uv/op/__init__.py | 4 | ||||
-rw-r--r-- | magic_uv/op/align_uv.py | 45 | ||||
-rw-r--r-- | magic_uv/op/align_uv_cursor.py | 12 | ||||
-rw-r--r-- | magic_uv/op/copy_paste_uv.py | 20 | ||||
-rw-r--r-- | magic_uv/op/copy_paste_uv_object.py | 12 | ||||
-rw-r--r-- | magic_uv/op/copy_paste_uv_uvedit.py | 8 | ||||
-rw-r--r-- | magic_uv/op/flip_rotate_uv.py | 8 | ||||
-rw-r--r-- | magic_uv/op/mirror_uv.py | 6 | ||||
-rw-r--r-- | magic_uv/op/move_uv.py | 6 | ||||
-rw-r--r-- | magic_uv/op/pack_uv.py | 6 | ||||
-rw-r--r-- | magic_uv/op/preserve_uv_aspect.py | 6 | ||||
-rw-r--r-- | magic_uv/op/select_uv.py | 8 | ||||
-rw-r--r-- | magic_uv/op/smooth_uv.py | 6 | ||||
-rw-r--r-- | magic_uv/op/texture_lock.py | 12 | ||||
-rw-r--r-- | magic_uv/op/texture_projection.py | 10 | ||||
-rw-r--r-- | magic_uv/op/texture_wrap.py | 8 | ||||
-rw-r--r-- | magic_uv/op/transfer_uv.py | 8 | ||||
-rw-r--r-- | magic_uv/op/unwrap_constraint.py | 6 | ||||
-rw-r--r-- | magic_uv/op/uv_bounding_box.py | 8 | ||||
-rw-r--r-- | magic_uv/op/uv_inspection.py | 10 | ||||
-rw-r--r-- | magic_uv/op/uv_sculpt.py | 8 | ||||
-rw-r--r-- | magic_uv/op/uvw.py | 8 | ||||
-rw-r--r-- | magic_uv/op/world_scale_uv.py | 94 |
23 files changed, 202 insertions, 117 deletions
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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>, 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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>, 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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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 <nutti.metro@gmail.com>" __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") |