Hello;
regarding GeListHead: The documentation tells us that we find the first and last list element by GetFirst()
and 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()
GetLayerObjectRoot
is actually returning aGeListHead
, not a Node. That's what the C++ API is doing, at least. (Just checked, yes, the type in Python isGeListHead
too.) So, the documentation on that function is wrong.- The return value here can nevertheless give us the list by
GetDown()
. That suggests thatGeListHead
stores its First list pointer in the same attribute as the Down reference of the superclass. I checked that, and in factGetFirst()
andGetDown()
point to the same objects for theBaseObject
list in the document and the Shader list in a material. -- OTOH the Pred, Next, and Up references in theGeListHead
seem to beNone
. I am now wondering whether C4D has any construct whereGeListHead
s are linked with each other in lists or trees, or whether the parent class's inherited functions are mostly meaningless and will always returnNone
. -- AsGeListHead
stores references to the Last and Parent objects, these seem to be separate references internally, in Python at least. Question: Is there a reason thatGetDown()
is used here, or is this just a relic from some earlier API version whereGetLayerObjectRoot
returned aGeListNode
erroneously? Searching this forum turns up some very old posts whereGetLayerObjectRoot
seems 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 returnNone
. 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!