Page MenuHome

PLY import fails when called during frame_change_pre handler
Needs Triage, NormalPublic

Description

System Information
Operating system: Windows 10, Kubuntu 18.10
Graphics card:

Blender Version
Broken:
2.91.0, 2.91.2 (see https://developer.blender.org/rBA089cfd12a5511829aafad3790417a5218955a3ad)
Worked:
2.83.12

Short description of error
When the PLY importer is called during the frame_change_pre handler, the import fails with the following message:

File "/<path/to/blender>/blender-2.91.0-linux64/2.91/scripts/addons/io_mesh_ply/init.py", line 87, in execute
context.window.cursor_set('WAIT')
AttributeError: 'NoneType' object has no attribute 'cursor_set'

Exact steps for others to reproduce the error
This error is specific to users of the Stop Motion OBJ addon.
I've had two reports of users trying to import a sequence of .PLY files using the Streaming Sequence feature, and having the addon fail when it tries to import the next mesh into the cache, but only while rendering the sequence.

I think this might be due to a recent patch to the importer (see https://developer.blender.org/rBA089cfd12a5511829aafad3790417a5218955a3ad), which sets the cursor type on the current context's window. However, while the animation is rendering, apparently the cursor is not available, and throws an error. The current workaround is to use Blender 2.83 instead of Blender 2.91.

Would it be possible to check whether the context has a window with a cursor before calling context.window.cursor_set('WAIT')? Something like:

if hasattr(context.window, 'cursor_set'):
      context.window.cursor_set('WAIT')