Page MenuHome

PythonAPI: BMLoopUV.select_edge never returns True and doesn't update uv select state when set manually.
Open, Confirmed, MediumPublic


System Information
Operating system: Linux-4.18.0-21-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: Mesa DRI Intel(R) Haswell Mobile Intel Open Source Technology Center 4.5 (Core Profile) Mesa 18.2.8

Blender Version
Broken: version: 2.80 (sub 74), branch: blender2.7, commit date: 2019-06-03 19:00, hash: rBd62a749fcf48
Worked: (optional)

Short description of error
BMLoopUV.select_edge never returns True and doesn't update uv select state when set manually.

Exact steps for others to reproduce the error
See attached .blend file for exact/minimal repro. Contains an embedded script with a simple bmesh operator ("UVLoop Select Edge Bug"), when you run it with a selected edge in the UV editor it should print "THIS WILL NEVER HAPPEN" to the console, but obviously it does not. Script also contains simple logic to prove that the edge is selected by checking the next loop's select state.

Script, for posterity:

import bpy
import bmesh

def main(context):
    bm = bmesh.from_edit_mesh(
    uv_layer = bm.loops.layers.uv.verify()   
    for face in bm.faces:
        for loop in face.loops:
            uvloop = loop[uv_layer]
            # BUG(?): -------------------------------------------
            # select_edge is always false, even if there is an edge selected!!
            next_loop = loop.link_loop_next
            next_uvloop = next_loop[uv_layer]
            if uvloop.select_edge:
                print("THIS WILL NEVER HAPPEN")                
            elif and
                print(f"uvloop.select_edge for edge index {loop.edge.index} should have been True, but it wasn't!")
            # ---------------------------------------------------

class SimpleOperator(bpy.types.Operator):
    bl_idname = "object.simple_operator_bug_test"
    bl_label = "UVLoop Select Edge Bug?"

    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        return {'FINISHED'}

def register():

def unregister():

if __name__ == "__main__":



Event Timeline

eldee smith (eldee) updated the task description. (Show Details)
Sebastian Parborg (zeddb) triaged this task as Confirmed, Medium priority.
eldee smith (eldee) added a comment.EditedWed, Jul 3, 10:44 PM

For anyone else who might need this functionality, a workaround that I use is the following:

def is_uv_edge_selected( loop, uv_layer ):
        '''With a given loop, determine if the entire edge is selected in the UV editor.'''
        # NOTE: This helper function is only necessary because of a bug where BMLoopUV.select_edge does nothing:
        return loop[ uv_layer ].select and loop.link_loop_next[ uv_layer ].select