How to get all takes with sub takes as an array list?


#1

hi,

I’ve been trying to prepare an array object that will holds all my take list with sub takes. I could not achieve to do it by a recursive function. This should be a minute thing but I could not do that. clearly I don’t understand creating and using 3D or 4D python arrays I guess, yet…

I wonder that is there any usage of arrays like above? or could anyone help me about this please?

my takes like below:

Main
-take 1
----take 1.1
------take 1.1.1
------take 1.1.2
------take 1.1.3

----take 1.2
------take 1.2.1
------take 1.2.2
------take 1.2.3

-take 2
----take 2.1
------take 2.1.1
------take 2.1.2
------take 2.1.3

I want to use an array to reach each to any take.
For example if I need to do something with take2.1.3 I want to reach it by simply using an array like: takes [1,0,2]
I could not achieve to assign my takes to an array list. could anyone help me please


#2

I’ve solved this. here is the function:

takeList = []

def getSubStructure(take,arr):
child=take.GetDown()
while child:
arr.append([])
arr[len(arr)-1].append(child)
if child.GetDown():
getSubStructure(child,arr[len(arr)-1])
child = child.GetNext()

takeData = doc.GetTakeData()
mainTake = takeData.GetMainTake()
getSubStructure(mainTake,takeList)