Esempio n. 1
0
  def myfn(self, arg):
    Newton.myfn(self, arg)
        
    # check for buffered adds
    for body in self._add_list:
      self.add_body(body)
    self._add_list = []
    
    # check for buffered deletes
    for body in self._delete_list:
      self.remove_body(body)
    self._delete_list = []
    
    # check for output in the buffers of incoming flows
    inputs = self.inputs()
    for p in range(len(inputs)):
      if len(inputs[p].output_buffer) > 0:
        body = inputs[p].output_buffer[0]
        body.position = (self.input_x, self.input_y)
        #print body.position
        self.add_body(body)
        inputs[p].output_buffer.remove(body)

    # check for obects to be stuck into the output_buffer
    # TODO -> Move refs in Newton to remove_list to Reactor
    if len(self.outputs()) > 0:
      for body in self._remove_list:
        self.remove_body(body)
        self.output_buffer.append(body)
    else:
      for body in self._remove_list:
        self.remove_body(body)
    self._remove_list = []