I'm not well versed in scripting and I'm trying to write a script that involves converting grease pencil to curve, I have discovered that the operator
bpy.ops.gpencil.convert(type='CURVE', use_timing_data=True)
needs the 3D view context to work, however if i set the correct context Blender crashes without any crash log
i have tried these two options
import bpy
area = bpy.context.area
old_type = area.type
area.type = 'VIEW_3D'
bpy.ops.gpencil.convert(type='CURVE', use_timing_data=True)
area.type = old_type
and
import bpy
win = bpy.context.window
scr = win.screen
areas3d = [area for area in scr.areas if area.type == 'VIEW_3D']
region = [region for region in areas3d[0].regions if region.type == 'WINDOW']
override = {'window':win,
'screen':scr,
'area' :areas3d[0],
'region':region,
'scene' :bpy.context.scene,
}
bpy.ops.gpencil.convert(override, type='CURVE', use_timing_data=True)
How to explan the crashing and is there maybe a different approach for creating curve from grease pencil?