@bentraje said in Bug on GetActiveObjects() on R20.057?:
objSel = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER)
Works fine by me.
I have a cube and a plane primitive. With the two selected, I get a printout for both. No out of range.
Running 20.057 (on Windows).
<c4d.BaseObject object called 'Plane/Plane' with ID 5168 at 0x0000004C44847570>
<c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0000004C448476D0>
When I only select a single object then I get an out of range (obviously):
IndexError: list index out of range
Hang on, when I make one the child of the other and have both selected, I do get an out of range.
But this is obvious, since your active objects flag doesn't mention children. As such, you do only have a single parent object selected.
To take children into account as being detected as selected, you need:
objSel = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER | c4d.GETACTIVEOBJECTFLAGS_CHILDREN )