Сейчас у меня есть следующее
Код: Выделить всё
class Graph_Manager:
def __init__(self):
self.graph_history = []
self.last_displayed_labels = []
self.app = o3d.visualization.gui.Application.instance
self.app.initialize()
self.vis = o3d.visualization.O3DVisualizer(title="Scene Graph Visualizer", width=1000, height=1000)
self.app.add_window(self.vis)
self.app.run_in_thread(self.update_display)
def update_display(self):
while True:
print(f"update display looped")
if len(self.graph_history) == 0:
geo = get_geometries(None) # Get geometries for the initial graph
else:
geo = get_geometries(self.graph_history[-1]) # Get geometries for the latest graph
#print(f"{geo=}")
# Clear previous geometry and add new geometries to the visualizer
#print(f"{dir(self.vis)=}")
for old_geometry in self.last_displayed_labels:
#print(f"removing {old_geometry}")
self.vis.remove_geometry(old_geometry)
self.last_displayed_labels = []
for label, geometry in geo:
self.vis.add_geometry(label, geometry)
self.last_displayed_labels.append(label)
self.vis.post_redraw()
#self.app.post_to_main_thread(self.vis, self.vis.post_redraw)
#self.app.run_one_tick()
self.app.post_to_main_thread(self.vis, self.app.run_one_tick)
time.sleep(0.05)
def add_graph(self, graph):
self.graph_history.append(graph)
O3DVisualizer
Приложение
Подробнее здесь: https://stackoverflow.com/questions/792 ... ow-manager