def set_model(self, model): self.model = model if model: self.data = model.data else: self.data = None if self.running: if model: mjlib.mjr_makeContext(model.ptr, byref(self.con), 150) else: mjlib.mjr_makeContext(None, byref(self.con), 150) self.render() if model: self.autoscale()
def start(self, window): self.running = True width, height = glfw.get_framebuffer_size(window) width1, height = glfw.get_window_size(window) self.scale = width * 1.0 / width1 self.window = window mjlib.mjv_makeObjects(byref(self.objects), 1000) mjlib.mjv_defaultCamera(byref(self.cam)) mjlib.mjv_defaultOption(byref(self.vopt)) mjlib.mjr_defaultOption(byref(self.ropt)) mjlib.mjr_defaultContext(byref(self.con)) if self.model: mjlib.mjr_makeContext(self.model.ptr, byref(self.con), 150) self.autoscale() else: mjlib.mjr_makeContext(None, byref(self.con), 150)