forked from franMarz/TexTools-Blender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
op_island_mirror.py
36 lines (28 loc) · 1.15 KB
/
op_island_mirror.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import bpy
class op(bpy.types.Operator):
bl_idname = "uv.textools_island_mirror"
bl_label = "Symmetry"
bl_description = "Mirror selected faces with respect to the global Rotation/Scaling Pivot"
bl_options = {'REGISTER', 'UNDO'}
is_vertical : bpy.props.BoolProperty(name="is_vertical", options={'HIDDEN'})
@classmethod
def poll(cls, context):
if bpy.context.area.ui_type != 'UV':
return False
if not bpy.context.active_object:
return False
if bpy.context.active_object.type != 'MESH':
return False
if bpy.context.active_object.mode != 'EDIT':
return False
if not bpy.context.object.data.uv_layers:
return False
return True
def execute(self, context):
#bpy.ops.uv.select_linked()
is_vertical = self.is_vertical
if is_vertical:
bpy.ops.transform.mirror(orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, True, False))
else:
bpy.ops.transform.mirror(orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False))
return {'FINISHED'}