1 # SPDX-FileCopyrightText: 2018-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 __author__
= "Nutti <nutti.metro@gmail.com>"
6 __status__
= "production"
8 __date__
= "22 Apr 2022"
12 from ..op
.uvw
import (
14 MUV_OT_UVW_BestPlanerMap
,
16 from ..op
.texture_projection
import (
17 MUV_OT_TextureProjection
,
18 MUV_OT_TextureProjection_Project
,
20 from ..op
.unwrap_constraint
import MUV_OT_UnwrapConstraint
21 from ..utils
.bl_class_registry
import BlClassRegistry
22 from ..utils
import compatibility
as compat
26 @compat.ChangeRegionType(region_type
='TOOLS')
27 class MUV_PT_View3D_UVMapping(bpy
.types
.Panel
):
29 Panel class: UV Mapping on Property Panel on View3D
32 bl_space_type
= 'VIEW_3D'
34 bl_label
= "UV Mapping"
36 bl_context
= 'mesh_edit'
37 bl_options
= {'DEFAULT_CLOSED'}
39 def draw_header(self
, _
):
41 layout
.label(text
="", icon
=compat
.icon('IMAGE'))
43 def draw(self
, context
):
48 box
.prop(sc
, "muv_unwrap_constraint_enabled", text
="Unwrap Constraint")
49 if sc
.muv_unwrap_constraint_enabled
:
50 ops
= box
.operator(MUV_OT_UnwrapConstraint
.bl_idname
,
52 ops
.u_const
= sc
.muv_unwrap_constraint_u_const
53 ops
.v_const
= sc
.muv_unwrap_constraint_v_const
54 row
= box
.row(align
=True)
55 row
.prop(sc
, "muv_unwrap_constraint_u_const", text
="U-Constraint")
56 row
.prop(sc
, "muv_unwrap_constraint_v_const", text
="V-Constraint")
59 box
.prop(sc
, "muv_texture_projection_enabled",
60 text
="Texture Projection")
61 if sc
.muv_texture_projection_enabled
:
64 sc
, "muv_texture_projection_enable",
66 if MUV_OT_TextureProjection
.is_running(context
)
68 icon
='RESTRICT_VIEW_OFF'
69 if MUV_OT_TextureProjection
.is_running(context
)
70 else 'RESTRICT_VIEW_ON')
71 row
.prop(sc
, "muv_texture_projection_tex_image", text
="")
72 box
.prop(sc
, "muv_texture_projection_tex_transparency",
74 col
= box
.column(align
=True)
76 row
.prop(sc
, "muv_texture_projection_adjust_window",
78 if not sc
.muv_texture_projection_adjust_window
:
79 sp
= compat
.layout_split(col
, factor
=0.5)
81 sub
.prop(sc
, "muv_texture_projection_tex_scaling",
83 sp
= compat
.layout_split(sp
, factor
=1.0)
85 sub
.prop(sc
, "muv_texture_projection_tex_translation",
88 row
.label(text
="Rotation:")
89 row
.prop(sc
, "muv_texture_projection_tex_rotation", text
="")
91 col
.prop(sc
, "muv_texture_projection_apply_tex_aspect",
92 text
="Texture Aspect Ratio")
93 col
.prop(sc
, "muv_texture_projection_assign_uvmap",
96 MUV_OT_TextureProjection_Project
.bl_idname
,
100 box
.prop(sc
, "muv_uvw_enabled", text
="UVW")
101 if sc
.muv_uvw_enabled
:
102 row
= box
.row(align
=True)
103 ops
= row
.operator(MUV_OT_UVW_BoxMap
.bl_idname
, text
="Box")
104 ops
.assign_uvmap
= sc
.muv_uvw_assign_uvmap
105 ops
= row
.operator(MUV_OT_UVW_BestPlanerMap
.bl_idname
,
107 ops
.assign_uvmap
= sc
.muv_uvw_assign_uvmap
108 box
.prop(sc
, "muv_uvw_assign_uvmap", text
="Assign UVMap")