diff options
author | Nutti <nutti.metro@gmail.com> | 2018-11-17 15:11:55 +0300 |
---|---|---|
committer | Nutti <nutti.metro@gmail.com> | 2018-11-17 15:11:55 +0300 |
commit | 2532b96844c121b710e1a1973d2a5ff824ab3be4 (patch) | |
tree | c1f7682a77310f53ed4c2682b0788f73aa677d69 /uv_magic_uv/ui/view3d_uv_manipulation.py | |
parent | 92ebf635ee2a9ddbc7fbf4a0c06b9732ee555b27 (diff) |
Magic UV: Release v5.2
* Bulit-in menu preferences
* Add-on updater
* Copy/Paste UV
* Add option "[New]" for pasting to newly allocated UV map
* Add option "[All]" for pasting all UV maps at once
* Align UV
* Add option "Mesh Influence"
* World Scale UV
* Add mode option "Manual" to allow the user specify the density manually
* Improve UI
* Cleanup documents
* Fix bugs
Diffstat (limited to 'uv_magic_uv/ui/view3d_uv_manipulation.py')
-rw-r--r-- | uv_magic_uv/ui/view3d_uv_manipulation.py | 275 |
1 files changed, 183 insertions, 92 deletions
diff --git a/uv_magic_uv/ui/view3d_uv_manipulation.py b/uv_magic_uv/ui/view3d_uv_manipulation.py index 1e9b7d7e..be0bcf57 100644 --- a/uv_magic_uv/ui/view3d_uv_manipulation.py +++ b/uv_magic_uv/ui/view3d_uv_manipulation.py @@ -20,8 +20,8 @@ __author__ = "Nutti <nutti.metro@gmail.com>" __status__ = "production" -__version__ = "5.1" -__date__ = "24 Feb 2018" +__version__ = "5.2" +__date__ = "17 Nov 2018" import bpy @@ -35,7 +35,12 @@ from ..op import uv_sculpt from ..op import world_scale_uv -class OBJECT_PT_MUV_UVManip(bpy.types.Panel): +__all__ = [ + 'PanelUVManipulation', +] + + +class PanelUVManipulation(bpy.types.Panel): """ Panel class: UV Manipulation on Property Panel on View3D """ @@ -53,128 +58,214 @@ class OBJECT_PT_MUV_UVManip(bpy.types.Panel): def draw(self, context): sc = context.scene - props = sc.muv_props layout = self.layout box = layout.box() - box.prop(sc, "muv_fliprot_enabled", text="Flip/Rotate UV") - if sc.muv_fliprot_enabled: + 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(flip_rotate_uv.MUV_FlipRot.bl_idname, + ops = row.operator(flip_rotate_uv.Operator.bl_idname, text="Flip/Rotate") - ops.seams = sc.muv_fliprot_seams - row.prop(sc, "muv_fliprot_seams", text="Seams") + ops.seams = sc.muv_flip_rotate_uv_seams + row.prop(sc, "muv_flip_rotate_uv_seams", text="Seams") box = layout.box() - box.prop(sc, "muv_mirroruv_enabled", text="Mirror UV") - if sc.muv_mirroruv_enabled: + box.prop(sc, "muv_mirror_uv_enabled", text="Mirror UV") + if sc.muv_mirror_uv_enabled: row = box.row() - ops = row.operator(mirror_uv.MUV_MirrorUV.bl_idname, text="Mirror") - ops.axis = sc.muv_mirroruv_axis - row.prop(sc, "muv_mirroruv_axis", text="") + ops = row.operator(mirror_uv.Operator.bl_idname, text="Mirror") + ops.axis = sc.muv_mirror_uv_axis + row.prop(sc, "muv_mirror_uv_axis", text="") box = layout.box() - box.prop(sc, "muv_mvuv_enabled", text="Move UV") - if sc.muv_mvuv_enabled: + box.prop(sc, "muv_move_uv_enabled", text="Move UV") + if sc.muv_move_uv_enabled: col = box.column() - col.operator(move_uv.MUV_MVUV.bl_idname, icon='PLAY', text="Start") - if props.mvuv.running: - col.enabled = False + if not move_uv.Operator.is_running(context): + col.operator(move_uv.Operator.bl_idname, icon='PLAY', + text="Start") else: - col.enabled = True + col.operator(move_uv.Operator.bl_idname, icon='PAUSE', + text="Stop") box = layout.box() - box.prop(sc, "muv_wsuv_enabled", text="World Scale UV") - if sc.muv_wsuv_enabled: - row = box.row(align=True) - row.operator(world_scale_uv.MUV_WSUVMeasure.bl_idname, - text="Measure") - ops = row.operator(world_scale_uv.MUV_WSUVApply.bl_idname, - text="Apply") - ops.origin = sc.muv_wsuv_origin - box.label("Source:") - sp = box.split(percentage=0.7) - col = sp.column(align=True) - col.prop(sc, "muv_wsuv_src_mesh_area", text="Mesh Area") - col.prop(sc, "muv_wsuv_src_uv_area", text="UV Area") - col.prop(sc, "muv_wsuv_src_density", text="Density") - col.enabled = False - sp = sp.split(percentage=1.0) - col = sp.column(align=True) - col.label("cm x cm") - col.label("px x px") - col.label("px/cm") - col.enabled = False - sp = box.split(percentage=0.3) - sp.label("Mode:") - sp = sp.split(percentage=1.0) - col = sp.column() - col.prop(sc, "muv_wsuv_mode", text="") - if sc.muv_wsuv_mode == 'USER': - col.prop(sc, "muv_wsuv_tgt_density", text="Density") - if sc.muv_wsuv_mode == 'SCALING': - col.prop(sc, "muv_wsuv_scaling_factor", text="Scaling Factor") - box.prop(sc, "muv_wsuv_origin", text="Origin") + box.prop(sc, "muv_world_scale_uv_enabled", text="World Scale UV") + if sc.muv_world_scale_uv_enabled: + box.prop(sc, "muv_world_scale_uv_mode", text="") + + if sc.muv_world_scale_uv_mode == 'MANUAL': + sp = box.split(percentage=0.5) + col = sp.column() + col.prop(sc, "muv_world_scale_uv_tgt_texture_size", + text="Texture Size") + sp = sp.split(percentage=1.0) + col = sp.column() + col.label("Density:") + col.prop(sc, "muv_world_scale_uv_tgt_density", text="") + box.prop(sc, "muv_world_scale_uv_origin", text="Origin") + ops = box.operator( + world_scale_uv.OperatorApplyManual.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 = box.split(percentage=0.4) + col = sp.column(align=True) + col.label("Source:") + sp = sp.split(percentage=1.0) + col = sp.column(align=True) + col.operator(world_scale_uv.OperatorMeasure.bl_idname, + text="Measure") + + sp = box.split(percentage=0.7) + col = sp.column(align=True) + col.prop(sc, "muv_world_scale_uv_src_density", text="Density") + col.enabled = False + sp = sp.split(percentage=1.0) + col = sp.column(align=True) + col.label("px2/cm2") + + box.separator() + box.prop(sc, "muv_world_scale_uv_origin", text="Origin") + ops = box.operator( + world_scale_uv.OperatorApplyScalingDensity.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 + + elif sc.muv_world_scale_uv_mode == 'SCALING_DENSITY': + sp = box.split(percentage=0.4) + col = sp.column(align=True) + col.label("Source:") + sp = sp.split(percentage=1.0) + col = sp.column(align=True) + col.operator(world_scale_uv.OperatorMeasure.bl_idname, + text="Measure") + + sp = box.split(percentage=0.7) + col = sp.column(align=True) + col.prop(sc, "muv_world_scale_uv_src_density", text="Density") + col.enabled = False + sp = sp.split(percentage=1.0) + col = sp.column(align=True) + col.label("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( + world_scale_uv.OperatorApplyScalingDensity.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 = False + ops.show_dialog = False + ops.tgt_scaling_factor = \ + sc.muv_world_scale_uv_tgt_scaling_factor + + elif sc.muv_world_scale_uv_mode == 'PROPORTIONAL_TO_MESH': + sp = box.split(percentage=0.4) + col = sp.column(align=True) + col.label("Source:") + sp = sp.split(percentage=1.0) + col = sp.column(align=True) + col.operator(world_scale_uv.OperatorMeasure.bl_idname, + text="Measure") + + sp = box.split(percentage=0.7) + col = sp.column(align=True) + col.prop(sc, "muv_world_scale_uv_src_mesh_area", + text="Mesh Area") + col.prop(sc, "muv_world_scale_uv_src_uv_area", text="UV Area") + col.prop(sc, "muv_world_scale_uv_src_density", text="Density") + col.enabled = False + sp = sp.split(percentage=1.0) + col = sp.column(align=True) + col.label("cm2") + col.label("px2") + col.label("px2/cm2") + col.enabled = False + + box.separator() + box.prop(sc, "muv_world_scale_uv_origin", text="Origin") + ops = box.operator( + world_scale_uv.OperatorApplyProportionalToMesh.bl_idname, + text="Apply") + ops.src_density = sc.muv_world_scale_uv_src_density + ops.src_uv_area = sc.muv_world_scale_uv_src_uv_area + ops.src_mesh_area = sc.muv_world_scale_uv_src_mesh_area + ops.origin = sc.muv_world_scale_uv_origin + ops.show_dialog = False box = layout.box() - box.prop(sc, "muv_preserve_uv_enabled", text="Preserve UV Aspect") - if sc.muv_preserve_uv_enabled: + box.prop(sc, "muv_preserve_uv_aspect_enabled", + text="Preserve UV Aspect") + if sc.muv_preserve_uv_aspect_enabled: row = box.row() ops = row.operator( - preserve_uv_aspect.MUV_PreserveUVAspect.bl_idname, + preserve_uv_aspect.Operator.bl_idname, text="Change Image") - ops.dest_img_name = sc.muv_preserve_uv_tex_image - ops.origin = sc.muv_preserve_uv_origin - row.prop(sc, "muv_preserve_uv_tex_image", text="") - box.prop(sc, "muv_preserve_uv_origin", text="Origin") + ops.dest_img_name = sc.muv_preserve_uv_aspect_tex_image + ops.origin = sc.muv_preserve_uv_aspect_origin + row.prop(sc, "muv_preserve_uv_aspect_tex_image", text="") + box.prop(sc, "muv_preserve_uv_aspect_origin", text="Origin") box = layout.box() - box.prop(sc, "muv_texlock_enabled", text="Texture Lock") - if sc.muv_texlock_enabled: + box.prop(sc, "muv_texture_lock_enabled", text="Texture Lock") + if sc.muv_texture_lock_enabled: row = box.row(align=True) col = row.column(align=True) col.label("Normal Mode:") col = row.column(align=True) - col.operator(texture_lock.MUV_TexLockStart.bl_idname, text="Lock") - ops = col.operator(texture_lock.MUV_TexLockStop.bl_idname, + col.operator(texture_lock.OperatorLock.bl_idname, + text="Lock" + if not texture_lock.OperatorLock.is_ready(context) + else "ReLock") + ops = col.operator(texture_lock.OperatorUnlock.bl_idname, text="Unlock") - ops.connect = sc.muv_texlock_connect - col.prop(sc, "muv_texlock_connect", text="Connect") + ops.connect = sc.muv_texture_lock_connect + col.prop(sc, "muv_texture_lock_connect", text="Connect") row = box.row(align=True) row.label("Interactive Mode:") - if not props.texlock.intr_running: - row.operator(texture_lock.MUV_TexLockIntrStart.bl_idname, - icon='PLAY', text="Start") - else: - row.operator(texture_lock.MUV_TexLockIntrStop.bl_idname, - icon="PAUSE", text="Stop") + box.prop(sc, "muv_texture_lock_lock", + text="Unlock" + if texture_lock.OperatorIntr.is_running(context) + else "Lock", + icon='RESTRICT_VIEW_OFF' + if texture_lock.OperatorIntr.is_running(context) + else 'RESTRICT_VIEW_ON') box = layout.box() - box.prop(sc, "muv_texwrap_enabled", text="Texture Wrap") - if sc.muv_texwrap_enabled: + box.prop(sc, "muv_texture_wrap_enabled", text="Texture Wrap") + if sc.muv_texture_wrap_enabled: row = box.row(align=True) - row.operator(texture_wrap.MUV_TexWrapRefer.bl_idname, text="Refer") - row.operator(texture_wrap.MUV_TexWrapSet.bl_idname, text="Set") - box.prop(sc, "muv_texwrap_set_and_refer") - box.prop(sc, "muv_texwrap_selseq") + row.operator(texture_wrap.OperatorRefer.bl_idname, text="Refer") + row.operator(texture_wrap.OperatorSet.bl_idname, text="Set") + box.prop(sc, "muv_texture_wrap_set_and_refer") + box.prop(sc, "muv_texture_wrap_selseq") box = layout.box() - box.prop(sc, "muv_uvsculpt_enabled", text="UV Sculpt") - if sc.muv_uvsculpt_enabled: - if not props.uvsculpt.running: - box.operator(uv_sculpt.MUV_UVSculptOps.bl_idname, - icon='PLAY', text="Start") - else: - box.operator(uv_sculpt.MUV_UVSculptOps.bl_idname, - icon='PAUSE', text="Stop") + box.prop(sc, "muv_uv_sculpt_enabled", text="UV Sculpt") + if sc.muv_uv_sculpt_enabled: + box.prop(sc, "muv_uv_sculpt_enable", + text="Disable"if uv_sculpt.Operator.is_running(context) + else "Enable", + icon='RESTRICT_VIEW_OFF' + if uv_sculpt.Operator.is_running(context) + else 'RESTRICT_VIEW_ON') col = box.column() col.label("Brush:") - col.prop(sc, "muv_uvsculpt_radius") - col.prop(sc, "muv_uvsculpt_strength") - box.prop(sc, "muv_uvsculpt_tools") - if sc.muv_uvsculpt_tools == 'PINCH': - box.prop(sc, "muv_uvsculpt_pinch_invert") - elif sc.muv_uvsculpt_tools == 'RELAX': - box.prop(sc, "muv_uvsculpt_relax_method") - box.prop(sc, "muv_uvsculpt_show_brush") + col.prop(sc, "muv_uv_sculpt_radius") + col.prop(sc, "muv_uv_sculpt_strength") + box.prop(sc, "muv_uv_sculpt_tools") + if sc.muv_uv_sculpt_tools == 'PINCH': + box.prop(sc, "muv_uv_sculpt_pinch_invert") + elif sc.muv_uv_sculpt_tools == 'RELAX': + box.prop(sc, "muv_uv_sculpt_relax_method") + box.prop(sc, "muv_uv_sculpt_show_brush") |