merge upstream
This commit is contained in:
		@ -3035,6 +3035,7 @@ Make sure the mesh only has tris/quads.""")
 | 
			
		||||
                    debug_draw_mode |= 16384 if wrd.lnx_bullet_dbg_draw_normals else 0
 | 
			
		||||
                    debug_draw_mode |= 32768 if wrd.lnx_bullet_dbg_draw_axis_gizmo else 0
 | 
			
		||||
                    out_trait['parameters'].append(str(debug_draw_mode))
 | 
			
		||||
                    out_trait['parameters'].append(str(wrd.lnx_bullet_dbg_draw_raycast).lower())
 | 
			
		||||
 | 
			
		||||
            self.output['traits'].append(out_trait)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -132,6 +132,7 @@ def always() -> float:
 | 
			
		||||
    return 0.5
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def poll_threads() -> float:
 | 
			
		||||
    """Polls the thread callback queue and if a thread has finished, it
 | 
			
		||||
    is joined with the main thread and the corresponding callback is
 | 
			
		||||
@ -141,21 +142,27 @@ def poll_threads() -> float:
 | 
			
		||||
        thread, callback = make.thread_callback_queue.get(block=False)
 | 
			
		||||
    except queue.Empty:
 | 
			
		||||
        return 0.25
 | 
			
		||||
 | 
			
		||||
    thread.join()
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        callback()
 | 
			
		||||
    except Exception as e:
 | 
			
		||||
        # If there is an exception, we can no longer return the time to
 | 
			
		||||
        # the next call to this polling function, so to keep it running
 | 
			
		||||
        # we re-register it and then raise the original exception.
 | 
			
		||||
        bpy.app.timers.unregister(poll_threads)
 | 
			
		||||
        bpy.app.timers.register(poll_threads, first_interval=0.01, persistent=True)
 | 
			
		||||
        raise e
 | 
			
		||||
 | 
			
		||||
    # Quickly check if another thread has finished
 | 
			
		||||
    return 0.01
 | 
			
		||||
    if thread.is_alive():
 | 
			
		||||
        try:
 | 
			
		||||
            make.thread_callback_queue.put((thread, callback), block=False)
 | 
			
		||||
        except queue.Full:
 | 
			
		||||
            return 0.5
 | 
			
		||||
        return 0.1 
 | 
			
		||||
    else:
 | 
			
		||||
        try:
 | 
			
		||||
            thread.join()
 | 
			
		||||
            callback()
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            # If there is an exception, we can no longer return the time to
 | 
			
		||||
            # the next call to this polling function, so to keep it running
 | 
			
		||||
            # we re-register it and then raise the original exception.
 | 
			
		||||
            try:
 | 
			
		||||
                bpy.app.timers.unregister(poll_threads)
 | 
			
		||||
            except ValueError:
 | 
			
		||||
                pass
 | 
			
		||||
            bpy.app.timers.register(poll_threads, first_interval=0.01, persistent=True)
 | 
			
		||||
        # Quickly check if another thread has finished
 | 
			
		||||
        return 0.01
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
loaded_py_libraries: dict[str, types.ModuleType] = {}
 | 
			
		||||
 | 
			
		||||
@ -201,6 +201,10 @@ def init_properties():
 | 
			
		||||
        name="Collider Wireframes", default=False,
 | 
			
		||||
        description="Draw wireframes of the physics collider meshes and suspensions of raycast vehicle simulations"
 | 
			
		||||
    )
 | 
			
		||||
    bpy.types.World.lnx_bullet_dbg_draw_raycast = BoolProperty(
 | 
			
		||||
        name="Trace Raycast", default=False,
 | 
			
		||||
        description="Draw raycasts to trace the results"
 | 
			
		||||
    )
 | 
			
		||||
    bpy.types.World.lnx_bullet_dbg_draw_aabb = BoolProperty(
 | 
			
		||||
        name="Axis-aligned Minimum Bounding Boxes", default=False,
 | 
			
		||||
        description="Draw axis-aligned minimum bounding boxes (AABBs) of the physics collider meshes"
 | 
			
		||||
 | 
			
		||||
@ -2756,6 +2756,7 @@ class LNX_PT_BulletDebugDrawingPanel(bpy.types.Panel):
 | 
			
		||||
 | 
			
		||||
        col = layout.column(align=False)
 | 
			
		||||
        col.prop(wrd, "lnx_bullet_dbg_draw_wireframe")
 | 
			
		||||
        col.prop(wrd, "lnx_bullet_dbg_draw_raycast")
 | 
			
		||||
        col.prop(wrd, "lnx_bullet_dbg_draw_aabb")
 | 
			
		||||
        col.prop(wrd, "lnx_bullet_dbg_draw_contact_points")
 | 
			
		||||
        col.prop(wrd, "lnx_bullet_dbg_draw_constraints")
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user