Bastep opened this issue on Nov 22, 2023 ยท 4 posts
Bastep posted Sun, 26 November 2023 at 2:48 AM
an0malaus posted at 8:11 PM Sat, 25 November 2023 - #4478167
Nice work @Bastep.
One observation is that given how long Poser's Python API has been developing, certain methods tended to vary in what returns they would give if they normally returned a list, but the list had no content. Actor.Children() is well behaved, in that it actually returns an empty list, making it safe to iterate over in a for loop.
Other methods tended to return None, which unhelpfully breaks for loops as it cannot be iterated. A quick hack to overcome this is:
for iter in ReturnsNoneIfListEmptyMethod() or []:
...That way there's always something which can be iterated over or skipped if the list is empty and the expression/method returns None.
Good morning! @an0malaus, thanks for the tip. Yes, the Poser API has its pitfalls. That's why I work extensively with the try/except statements.This was not necessary in the example program. Because, as you said, the Actor.Children() method does exactly what it should.
Have a nice Sunday ...