Plain GLSL text to insert inline
| 15 | |
| 16 | |
| 17 | class TextExpression(Expression): |
| 18 | """Plain GLSL text to insert inline""" |
| 19 | |
| 20 | def __init__(self, text): |
| 21 | super(TextExpression, self).__init__() |
| 22 | if not isinstance(text, str): |
| 23 | raise TypeError("Argument must be string.") |
| 24 | self._text = text |
| 25 | |
| 26 | def __repr__(self): |
| 27 | return '<TextExpression %r for at 0x%x>' % (self.text, id(self)) |
| 28 | |
| 29 | def expression(self, names=None): |
| 30 | return self._text |
| 31 | |
| 32 | @property |
| 33 | def text(self): |
| 34 | return self._text |
| 35 | |
| 36 | @text.setter |
| 37 | def text(self, t): |
| 38 | self._text = t |
| 39 | self.changed() |
| 40 | |
| 41 | def __eq__(self, a): |
| 42 | if isinstance(a, TextExpression): |
| 43 | return a._text == self._text |
| 44 | elif isinstance(a, str): |
| 45 | return a == self._text |
| 46 | else: |
| 47 | return False |
| 48 | |
| 49 | def __hash__(self): |
| 50 | return self._text.__hash__() |
| 51 | |
| 52 | |
| 53 | class FunctionCall(Expression): |
no outgoing calls
searching dependent graphs…