I am running a program and I want to render and display a 3D bunny. Therefore we use pyrender and trimesh. In my university class they showed a trick so that the rendering is running on a side thread so that we can still interact with the window and change things. This works for everyone but not for me. Here is my code.
bunny = trimesh.load("/bun_zipper.ply")
mesh = pyrender.Mesh.from_trimesh(bunny)
scene = pyrender.Scene(ambient_light=[.5, .5, .5], bg_color=[0, 0, 0])
node = pyrender.Node(name="Node", mesh=mesh)
scene.add_node((node))
v = pyrender.Viewer(scene,run_in_thread=True)
the problem is here the run_in_thread=True. Without this argument it works fine for me but with that argument I get the following error message:
2021-10-26 10:03:53.756 Python[89940:3624072] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/0m/8zgbz49j2032wtvwfxv6rw2r0000gn/T/org.python.python.savedState
2021-10-26 10:03:53.765 Python[89940:3624072] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff2067e1db __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff203b7d92 objc_exception_throw + 48
2 CoreFoundation 0x00007fff206a68e6 -[NSException raise] + 9
3 AppKit 0x00007fff22e35eb2 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 321
4 AppKit 0x00007fff22e20aa2 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1296
5 AppKit 0x00007fff22e2058b -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
6 libffi.dylib 0x00007fff2daec8f5 ffi_call_unix64 + 85
7 ??? 0x0000700002521400 0x0 + 123145341244416
)
libc++abi: terminating with uncaught exception of type NSException