object_collection_manager: use GPL headers for all files
[blender-addons.git] / magic_uv / ui / view3d_copy_paste_uv_editmode.py
blob041f279d6be3732b070d5367b1834161e5b1198b
1 # <pep8-80 compliant>
3 # ##### BEGIN GPL LICENSE BLOCK #####
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # ##### END GPL LICENSE BLOCK #####
21 __author__ = "Nutti <nutti.metro@gmail.com>"
22 __status__ = "production"
23 __version__ = "6.2"
24 __date__ = "31 Jul 2019"
26 import bpy
28 from ..op.copy_paste_uv import (
29 MUV_MT_CopyPasteUV_CopyUV,
30 MUV_MT_CopyPasteUV_PasteUV,
31 MUV_MT_CopyPasteUV_SelSeqCopyUV,
32 MUV_MT_CopyPasteUV_SelSeqPasteUV,
34 from ..op.transfer_uv import (
35 MUV_OT_TransferUV_CopyUV,
36 MUV_OT_TransferUV_PasteUV,
38 from ..utils.bl_class_registry import BlClassRegistry
39 from ..utils import compatibility as compat
42 @BlClassRegistry()
43 @compat.ChangeRegionType(region_type='TOOLS')
44 class MUV_PT_CopyPasteUVEditMode(bpy.types.Panel):
45 """
46 Panel class: Copy/Paste UV on Property Panel on View3D
47 """
49 bl_space_type = 'VIEW_3D'
50 bl_region_type = 'UI'
51 bl_label = "Copy/Paste UV"
52 bl_category = "Edit"
53 bl_context = 'mesh_edit'
54 bl_options = {'DEFAULT_CLOSED'}
56 def draw_header(self, _):
57 layout = self.layout
58 layout.label(text="", icon=compat.icon('IMAGE'))
60 def draw(self, context):
61 sc = context.scene
62 layout = self.layout
64 box = layout.box()
65 box.prop(sc, "muv_copy_paste_uv_enabled", text="Copy/Paste UV")
66 if sc.muv_copy_paste_uv_enabled:
67 row = box.row(align=True)
68 if sc.muv_copy_paste_uv_mode == 'DEFAULT':
69 row.menu(MUV_MT_CopyPasteUV_CopyUV.bl_idname, text="Copy")
70 row.menu(MUV_MT_CopyPasteUV_PasteUV.bl_idname, text="Paste")
71 elif sc.muv_copy_paste_uv_mode == 'SEL_SEQ':
72 row.menu(MUV_MT_CopyPasteUV_SelSeqCopyUV.bl_idname,
73 text="Copy")
74 row.menu(MUV_MT_CopyPasteUV_SelSeqPasteUV.bl_idname,
75 text="Paste")
76 box.prop(sc, "muv_copy_paste_uv_mode", expand=True)
77 box.prop(sc, "muv_copy_paste_uv_copy_seams", text="Seams")
78 box.prop(sc, "muv_copy_paste_uv_strategy", text="Strategy")
80 box = layout.box()
81 box.prop(sc, "muv_transfer_uv_enabled", text="Transfer UV")
82 if sc.muv_transfer_uv_enabled:
83 row = box.row(align=True)
84 row.operator(MUV_OT_TransferUV_CopyUV.bl_idname, text="Copy")
85 ops = row.operator(MUV_OT_TransferUV_PasteUV.bl_idname,
86 text="Paste")
87 ops.invert_normals = sc.muv_transfer_uv_invert_normals
88 ops.copy_seams = sc.muv_transfer_uv_copy_seams
89 row = box.row()
90 row.prop(sc, "muv_transfer_uv_invert_normals",
91 text="Invert Normals")
92 row.prop(sc, "muv_transfer_uv_copy_seams", text="Seams")