reinit all extensions function

I was about to do an RFE to create a method to reinitialize all the extensions in a project but then I thought it would only take a few minutes to write a function (using the new findChildren method) that would do it anyways.

With the new builds sometimes extensions aren’t being reinitialized so I thought I would share this in case it might come in useful. Just copy and paste the following code into a text DAT place it anywhere in the project and run it. It will find all comps with extensions in the project and reinitialize them.

cheers
Keith

[code]def reInitExt(comp):

hasExt = False	
par = comp.par

for n in range(1,5):
	
	nStr = str(n)
	ext = 'ext' + nStr
	extPar = 'extension' + nStr

	ext = getattr(par, extPar)

	if ext != '':
		hasExt = True	

if hasExt == True:

	par.reinitextensions.pulse()
	return 1
	
else:	
	return 0

def reInitAllExt():

allComps = root.findChildren(type = COMP)

i = 0
	
for compPath in allComps:
	
	comp = op(compPath)
	i += reInitExt(comp)
			
print(str(i) + ' COMPs with extensions reinitialized')

reInitAllExt()[/code]

Great utility and use of the new findChildren method Keith.
Just one small tip:

You can get all the non-blank extensions in one shot with:

root.findChildren(type=COMP, parName=‘extension*’, onlyNonDefaults=True)

This searches for COMP, with parameters matching ‘extension*’, that are non default.

Ah thanks Rob, I should have read the wiki more carefully but it turns out I’m on build 20840 which doesn’t have support for the parName or hasNonDefaults yet anyways. When the next build is released I’ll clean it up using the new variables.

thanks
Keith