Hi I want to copy the parameters from a base component child to its parent, it works but the RGBA RGB UV XY and all those parameters with multiple values are getting exponencial copies.
If someone can help me would be great it seams I am stuck here doing loops
and here is my code sorry I dont get how to insert it correctly:
def onOffToOn(channel, sampleIndex, val, prev):
print("onOffToOn function called")
parent_comp = parent()
newPage = parent_comp.appendCustomPage("Custom")
for child_comp in parent_comp.findChildren(type=baseCOMP):
print(f"Processing child: {child_comp.path}")
for par in child_comp.customPars:
try:
newPar = getattr(newPage, f'append{par.style}', newPage.appendFloat)(par.name, label=par.label)
newPar.bindExpr = f'op("{child_comp.path}").par.{par.name}'
# Copy attributes for the new parameter tuplet
if isinstance(newPar, tuple):
for p in newPar:
p.normMin = par.normMin
p.normMax = par.normMax
p.default = par.default
p.min = par.min
p.clampMin = par.clampMin
p.max = par.max
p.clampMax = par.clampMax
else:
newPar.normMin = par.normMin
newPar.normMax = par.normMax
newPar.default = par.default
newPar.min = par.min
newPar.clampMin = par.clampMin
newPar.max = par.max
newPar.clampMax = par.clampMax
except Exception as e:
print(f"Error processing {par.name}: {e}")
return