def processSynchronizerBuffer(self, buffer): while not buffer.isEmpty(): command = buffer.command() if (command == self.SYNCHRONIZER_COMMAND_USER_POSITION): self.setPosition(buffer.matrix_4x4()) elif (command == self.SYNCHRONIZER_COMMAND_VEHICLE_POSITION): self.setVehiclePosition(buffer.matrix_4x4())
def getSynchronizerBuffer(self): buffer = blender_cave.buffer.Buffer() if (self._previous['user_position'] != self.getPosition()): self._previous['user_position'] = self.getPosition() buffer.command(self.SYNCHRONIZER_COMMAND_USER_POSITION) buffer.matrix_4x4(self.getPosition()) if (self._previous['vehicle_position'] != self.getVehiclePosition()): self._previous['vehicle_position'] = self.getVehiclePosition() buffer.command(self.SYNCHRONIZER_COMMAND_VEHICLE_POSITION) buffer.matrix_4x4(self.getVehiclePosition()) return buffer