Skip to content

Commit

Permalink
Fix error in Edge Peel if UV Sync is enabled
Browse files Browse the repository at this point in the history
Fixes #86
  • Loading branch information
franMarz authored Jun 26, 2021
1 parent 13bf42c commit 166de87
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions op_unwrap_edge_peel.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import bpy
import os
import bmesh
from mathutils import Vector
from collections import defaultdict
from math import pi

from . import utilities_uv
from . import utilities_ui


class op(bpy.types.Operator):
bl_idname = "uv.textools_unwrap_edge_peel"
bl_label = "Peel Edge"
Expand Down Expand Up @@ -38,11 +34,13 @@ def execute(self, context):
return {'FINISHED'}



def unwrap_edges_pipe(self, context):

bm = bmesh.from_edit_mesh(bpy.context.active_object.data)
uv_layers = bm.loops.layers.uv.verify()

is_sync = bpy.context.scene.tool_settings.use_uv_select_sync

contextViewUV = utilities_ui.GetContextViewUV()
if not contextViewUV:
Expand Down Expand Up @@ -87,9 +85,14 @@ def unwrap_edges_pipe(self, context):

bpy.ops.uv.unwrap(method='ANGLE_BASED', margin=0.0226216)
bpy.ops.uv.select_all(action='SELECT')

bpy.context.scene.tool_settings.use_uv_select_sync = False
bpy.ops.uv.textools_rectify(contextViewUV)
if is_sync:
bpy.context.scene.tool_settings.use_uv_select_sync = True

# TODO: Restore initial selection
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')

bpy.utils.register_class(op)

bpy.utils.register_class(op)

0 comments on commit 166de87

Please sign in to comment.