thank you for reaching out to us. Please remember to tag your topics also with the version(s) of Cinema 4D and OS you are targeting.
About your question: The answer to that is unfortunately not trivial. The take system of Cinema 4D is powerful, but that makes it sometimes hard to find general solutions for working with it programmatically. There is no general solution for "find all classic nodes that are somehow part of the active take". The reason for that is that classic nodes can be manipulated in many ways by takes. In your example it is the layers which are being manipulated and not the objects themselves you are after. So, you will need to find the layer(s) which are part of the active take and then the objects that are part of that layer.
We cannot provide full solutions, but I wrote a little example which goes into the direction you want to go. Please note that this is an example and that we can only answer specific follow up questions. We cannot improve the script so that it will fit your requirements, you will have to do that yourself.
I hope this helps and cheers,
"""Example for iterating over all objects that are attached to a layer.
The script retrieves the layer to be tested for via the take system, looking
for a layer which is part of the overrides of the currently active take.
As discussed in:
def Iterate(document, callback, **kwargs):
"""The iteration function, walking a document object graph depth first.
document (c4d.documents.BaseDocument): The document to iterate over.
callback (callable): A callback to evaluate if a certain node should
be yielded or not.
**kwargs: The additional kw arguments for the callback.
c4d.BaseObject: An object node within the document graph that did
satisfy the callback.
node = document.GetFirstObject()
visisted = 
terminal = node.GetUp() if isinstance(node, c4d.GeListNode) else None
if node not in visisted:
if callback(node, document, **kwargs):
if node.GetDown() and node.GetDown() not in visisted:
node = node.GetDown()
node = node.GetNext()
node = node.GetUp()
if node == terminal:
def MyCallback(node, document, **kwargs):
"""A little callback function which does test if a node should be yielded
We are testing here if the node is attached to the same layer as passed
down via activeLayer to `Iterate`.
if not isinstance(node, c4d.BaseList2D):
if "activeLayer" not in kwargs:
return kwargs["activeLayer"] == node.GetLayerObject(document)
# Get the active take
takeData = doc.GetTakeData()
baseTake = takeData.GetCurrentTake()
# Iterate over all overrides to find the first override for a layer
# object. Bail the script when we cannot find any overrides for a layer.
layer = None
for item in baseTake.GetOverrides():
if isinstance(item.GetSceneNode(), c4d.documents.LayerObject):
layer = item.GetSceneNode()
if layer is None:
raise RuntimeError("Could not find any layer object overrides.")
# Iterate over all objects in the scene which are attached to that layer.
for node in Iterate(doc, MyCallback, activeLayer=layer):
if __name__ == '__main__':