Hey everyone,
I’m currently working on expanding the Stop-Motion-OBJ Addon. Unfortunately I’m experiencing a crash when I modify mesh data in the Depsgraph-Update-Pre event. This is the code block in question:
bmNew = bmesh.new()
bmNew.from_mesh(next_mesh)
bmNew.to_mesh(_obj.data)
bmNew.free()
if(len(next_mesh.materials) > 0):
_obj.data.materials.clear()
for material in next_mesh.materials:
print("Appended next mesh mat")
_obj.data.materials.append(material)
The part where I’m copying data from one mesh to another works fine. But I’m experiencing a crash when I try to do any modification of the materials data (such as clear or append). The crash doesn’t occur when I use the Depsgraph-Update-Post, Frames_Change_pre or Frames_Change_Post event to call the same function, but unfortunately I need this function to work in the Depsgraph-Update-Pre call.
My question is, could this be a bug in blender, or am I doing something that I shouldn’t do in the Depsgraph-Pre event?
This is the crash-log:
Exception Record:
ExceptionCode : EXCEPTION_ACCESS_VIOLATION
Exception Address : 0x00007FF7223963E3
Exception Module : blender.exe
Exception Flags : 0x00000000
Exception Parameters : 0x2
Parameters[0] : 0x0000000000000000
Parameters[1] : 0x0000000000000060
Stack trace:
blender.exe :0x00007FF7223961A0 library_foreach_ID_link
blender.exe :0x00007FF722395910 BKE_library_foreach_ID_link
blender.exe :0x00007FF722674490 blender::deg::DepsgraphNodeBuilder::end_build
blender.exe :0x00007FF722664300 blender::deg::AbstractBuilderPipeline::build
blender.exe :0x00007FF72264EBD0 DEG_graph_relations_update
blender.exe :0x00007FF72237CA50 scene_graph_update_tagged
blender.exe :0x00007FF722BC8B20 blender::io::export_startjob
blender.exe :0x00007FF722587860 do_job_thread
blender.exe :0x00007FF7277D39C0 _ptw32_threadStart
ucrtbase.dll :0x00007FFCA85A6BB0 recalloc
KERNEL32.DLL :0x00007FFCA8D854D0 BaseThreadInitThunk
ntdll.dll :0x00007FFCAA9A4830 RtlUserThreadStart