I’m trying to import an OBJ file during a frame_change_pre
event. It works fine in Object mode, but it fails when I try the same thing while rendering an animation.
For some background, I maintain the Stop Motion OBJ addon, which imports sequences of meshes then shows/hides the correct ones for each frame. There’s a Cached Sequence mode which imports all of the meshes into memory up front, and a Streaming Sequence mode, which imports meshes as-needed, during the frame_change_pre
event. In the past (pre 4.0), both modes have worked both in the 3D viewport in Object and Sculpt modes as well as while rendering an animation, using the Legacy OBJ importer (see here and here)
However, when I attempt this in Blender 4.0 using the new OBJ importer, it (usually) fails when calling the new importer and gives the following error: RuntimeError: Operator bpy.ops.wm.obj_import.poll() failed, context is incorrect
Usually the first few frames are successful, then it fails after 10-30 frames.
I’ve tried overriding the context, with no success, though I’m not sure I’m doing this properly.
Any tips? Why was this not a problem with the legacy OBJ importer? How can I accomplish this with the new OBJ importer?