def _genDiff(self, current, next): key = (next['object'], next['property']) if key in current: diff = current[key]['value'].genDiff(current[key], next) if diff: ta = node.TimedActions(current[key]['time']) ta.addAction(next['object'].encloseDiff(diff)) self._changes.append(ta) current[key] = next
def freeze(self, loop=False): self._changes = [] self._loop = loop current = {} for next in self._previous: self._genDiff(current, next) for next in self._current.itervalues(): self._genDiff(current, next) for i in self._instants: self._changes.append(i) if loop: ta = node.TimedActions(self._time) ta.addAction(node.TimerChange(self)) self._changes.append(ta)
def restart(self): ta = node.TimedActions(self._time) ta.addAction(node.Restart()) self._instants.append(ta)
def playSound(self, sound): ta = node.TimedActions(self._time) ta.addAction(node.SoundRef(sound)) self._instants.append(ta)
def changeLink(self, link, enable): ta = node.TimedActions(self._time) o = node.ObjectChange(link) o.addChild(node.LinkChange('link_' + ('on' if enable else 'off'))) ta.addAction(o) self._instants.append(ta)
def changeTimeline(self, other, action='start'): ta = node.TimedActions(self._time) ta.addAction(node.TimerChange(other)) self._instants.append(ta)