Hello folks,
I trying to update a plugin which has been developed for C4D R21.x and Python 2 to C4D R23 and higher which is running Python 3. I got almost everything working now except a redundant issue I'm getting with ObjectIterator()
parsing. So, I wondering if the use I made of it is wrong, or if this lib is depreciated?
Here the code running under Python 2 without any issues on C4D R21,
def RetreiveTags(self):
self.tagList = []
obj = self.cacheDoc.GetFirstObject()
scene = ObjectIterator(obj)
for obj in scene:
tags = TagIterator(obj)
for tag in tags:
self.tagList.append(tag)
But while I'm running the same code under C4D R23 with Python 3 I'm getting this error:
Traceback (most recent call last):
File "TestIterator.pyp", line 204, in CoreMessage
self.RetreiveTags()
File "TestIterator.pyp", line 160, in RetreiveTags
for obj in scene:
TypeError: iter() returned non-iterator of type 'ObjectIterator'
The line in error, is the one with the for tag in tags:
After some readings, especially this one http://cgrebel.com/2015/03/c4d-python-scene-iterator/ , I assume that the error comes from the raise StopIteration
Is there a way to get this library works normally as it was under R21 or should I update the code like I already did with my own iterator for object list?
Any advises are as usual more than welcome!
Thanks a lot,
Christophe