regarding GeListHead: The documentation tells us that we find the first and last list element by
GetLast(). Now, in BaseDocument, we have the function GetLayerObjectRoot() which supposedly returns a GeListNode, and where we find the following sample code:
def GetFirstLayer(doc): # Returns the first layer, if available, otherwise None return doc.GetLayerObjectRoot().GetDown()
GetLayerObjectRootis actually returning a
GeListHead, not a Node. That's what the C++ API is doing, at least. (Just checked, yes, the type in Python is
GeListHeadtoo.) So, the documentation on that function is wrong.
- The return value here can nevertheless give us the list by
GetDown(). That suggests that
GeListHeadstores its First list pointer in the same attribute as the Down reference of the superclass. I checked that, and in fact
GetDown()point to the same objects for the
BaseObjectlist in the document and the Shader list in a material. -- OTOH the Pred, Next, and Up references in the
GeListHeadseem to be
None. I am now wondering whether C4D has any construct where
GeListHeads are linked with each other in lists or trees, or whether the parent class's inherited functions are mostly meaningless and will always return
None. -- As
GeListHeadstores references to the Last and Parent objects, these seem to be separate references internally, in Python at least. Question: Is there a reason that
GetDown()is used here, or is this just a relic from some earlier API version where
GeListNodeerroneously? Searching this forum turns up some very old posts where
GetLayerObjectRootseems to be used differently.
- The sample code is annotated with the phrase "Warning: The hierarchy method GeListNode.GetDown() can only be called on the returned object." I have absolutely no idea what that means. Layers are organizes hierarchically, so of course I can call
GetDown()on any other layer. Naturally the call may return
None. Given the fact that WARNINGS are not found that often in the API docs, I assume that this should be taken seriously - but what is it actually warning us of?
Thanks for any insights!