System Information
Operating system: Windows-10-10.0.19043-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 472.39
Blender Version
Broken: version: 3.1.0 Alpha, branch: master, commit date: 2021-12-26 20:08, hash: rB20b438d523c9
Worked: 2.93 LTS
Caused by rBeb0eb54d9644: Fix D12533: Simplify curve object to mesh conversion
Blender crashes with an access violation in nvoglv64.dll when entering edit mode on a curve with the following script running. This worked fine in Blender 2.93 et al, so something has changed with object.to_mesh() that nvoglv64.dll does not like.
See the attached blend file, and run the embedded minimum repro crash_script text file- which is a simple GL handler that should use blf to display the number of mesh polygons in a curve.
# Blender 3.1.0, Commit date: 2021-12-26 20:08, Hash 20b438d523c9 bpy.ops.object.editmode_toggle() # Operator # backtrace Exception Record: ExceptionCode : EXCEPTION_ACCESS_VIOLATION Exception Address : 0x00007FF9798BBDD0 Exception Module : nvoglv64.dll Exception Flags : 0x00000000 Exception Parameters : 0x2 Parameters[0] : 0x0000000000000000 Parameters[1] : 0x0000000000000000 Stack trace: nvoglv64.dll :0x00007FF9798BBDD0 Symbols not available # Python backtrace
the repro script, for posterity:
import bpy, blf
def draw_test():
ui_scale = bpy.context.preferences.system.ui_scale
blf.color(0, 1,1,0,1)
blf.size(0, int(12 * ui_scale), 72)
blf.position(0, int(20 * ui_scale), int(bpy.context.region.height) - int(200 * ui_scale), 0)
blf.draw(0, f"With the curve selected, enter edit mode.")
blf.position(0, int(20 * ui_scale), int(bpy.context.region.height) - int(220 * ui_scale), 0)
blf.draw(0, f"If it doesn't crash immediately, try selecting a few points.")
if bpy.context.mode != 'EDIT_CURVE':
return
obj = bpy.context.active_object
value = 0
if obj is not None and obj.type == 'CURVE':
# NOTE: crash is caused by this:
me = obj.to_mesh()
value = len(me.polygons)
obj.to_mesh_clear()
blf.position(0, int(20 * ui_scale), int(bpy.context.region.height) - int(240 * ui_scale), 0)
blf.draw(0, f"We'll never get to this point, but the curve has {value} polygons.")
handler = None
def register():
global handler
handler = bpy.types.SpaceView3D.draw_handler_add(draw_test, (), 'WINDOW', 'POST_PIXEL')
def unregister():
global handler
if handler is not None:
bpy.types.SpaceView3D.draw_handler_remove(handler, 'WINDOW')
handler = None
if __name__ == "__main__":
register()edit: apparently the blend file did not attach, here it is again
You can get around it passing the evaluated object to to_mesh, see:
