Skip to content

Instantly share code, notes, and snippets.

@folkertdev
Created May 24, 2016 18:37
Show Gist options
  • Save folkertdev/35d2eb494bf26b51e87e2b8e491a6058 to your computer and use it in GitHub Desktop.
Save folkertdev/35d2eb494bf26b51e87e2b8e491a6058 to your computer and use it in GitHub Desktop.
Generator function as a Freestyle predicate
def pyVertexNatureUP0D(nature):
""" Generator function as predicate. about 50% slower, but it works """
while True:
print("doing work")
inter = yield
if inter is None:
continue
yield bool(inter.object.nature & nature)
it = Interface0DIterator(stroke)
next(self.pred)
for svert, _ in zip(it, self.pred):
c = float(self.pred.send(it))
svert.attribute.color = (c, c, c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment