Page MenuHome

Blender crash in bmesh.to_mesh() while using it to modify weights
Open, Needs Triage by DeveloperPublic


System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 431.70

Blender Version
Broken: version: 2.82 (sub 1), branch: master, commit date: 2019-10-27 17:59, hash: rBdd904f67614b
Worked: (optional)

Short description of error
Crash in bmesh.to_mesh() if using it to modify weights in weightpainting while playing animation

Exact steps for others to reproduce the error
*Remove any lights or cameras, keep just one cube in the scene (for the simple script to work).
*Subdivide it 5 times and apply the modifier.
*Add the script below to the script editor and run it
*Go to weight paint mode for the cube
*Run the animation and try to paint. If you just click the left mouse button it will paint a dot and the script will work, but if you hold and drag, Blender crashes.

import bpy, bmesh

def add_handler():
    # remove existing handlers
    old_handlers = []
    for h in
        if "paint_test" in str(h):
    for h in old_handlers:
    # add new handler

def paint_test(scene):
    for ob in scene.objects:
        me =
        print(str(scene.frame_current) + ": Creating Bmesh")
        bm =
        group_index = ob.vertex_groups.active_index
        dvert_lay =
        for vert in bm.verts:
            dvert = vert[dvert_lay]
            try: dvert[group_index] -= 0.1
            except: pass            
        print(str(scene.frame_current) + ": Writing Bmesh")



Event Timeline

This is where the crash occurs: