Get edit mode edge freestyle data

Hello, I want to get the freestyle property of the currently selected edge in editing, but cannot be updated in real time in grid editing mode, I tried using (), but this didn’t work, I want to know how to update it in real time. Or is there an API for freestyle in BMesh? I saw there was a post before, but no one replied, it was this one Access freestyle edges through bmesh - Other Development Topics / Python API - Blender Developer Talk


In the linked thread (two years ago), I ended up copying the BMesh data to a temporary Mesh object, and reading the properties from there. It is an ugly workaround but it still works:

    def get_freestyle_marks(bm):
    # NOTE: this is a workaround for NotImplementedError on bmesh.edges.layers.freestyle
    mesh ="temp")
    result = {bmedge: mesh.edges[bmedge.index].use_freestyle_mark for bmedge in bm.edges}
    return result
1 Like

Thank you, this is available, I did not expect to solve this, this is the official API has not been fixed, or there is no this function