Created
May 24, 2016 18:37
-
-
Save folkertdev/35d2eb494bf26b51e87e2b8e491a6058 to your computer and use it in GitHub Desktop.
Generator function as a Freestyle predicate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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