diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-18 05:35:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-18 05:35:43 +0300 |
commit | 7e9f76944c3117f99045f9cde6253e2592953330 (patch) | |
tree | 7053a6b213a6c52239a6e23a4ca939ac62fd5ff0 /release/scripts/startup/bl_operators/uvcalc_follow_active.py | |
parent | 08f15433ba11c7beec64957f01f48c13471f8600 (diff) |
Fix T59461: Follow active quad asserts
Diffstat (limited to 'release/scripts/startup/bl_operators/uvcalc_follow_active.py')
-rw-r--r-- | release/scripts/startup/bl_operators/uvcalc_follow_active.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index 58d60426464..21c89444a32 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -34,14 +34,14 @@ STATUS_ERR_NOT_QUAD = (1 << 3) def extend(obj, operator, EXTEND_MODE): import bmesh me = obj.data - # script will fail without UVs - if not me.uv_layers: - me.uv_layers.new() bm = bmesh.from_edit_mesh(me) + faces = [f for f in bm.faces if f.select and len(f.verts) == 4] + if not faces: + return 0 + f_act = bm.faces.active - uv_act = bm.loops.layers.uv.active if f_act is None: return STATUS_ERR_ACTIVE_FACE @@ -50,7 +50,11 @@ def extend(obj, operator, EXTEND_MODE): elif len(f_act.verts) != 4: return STATUS_ERR_NOT_QUAD - faces = [f for f in bm.faces if f.select and len(f.verts) == 4] + # Script will fail without UVs. + if not me.uv_layers: + me.uv_layers.new() + + uv_act = bm.loops.layers.uv.active # our own local walker def walk_face_init(faces, f_act): @@ -222,16 +226,9 @@ def main(context, operator): num_errors = 0 status = 0 - ob_list = [ob for ob in context.selected_objects if ob and ob.type == 'MESH'] + ob_list = context.objects_in_mode_unique_data for ob in ob_list: - ob.data.tag = False - - for ob in ob_list: - if ob.data.tag: - continue - num_meshes += 1 - ob.data.tag = True ret = extend(ob, operator, operator.properties.mode) if ret != STATUS_OK: |