def SetValuesFromPreset(self, values): for name in values: p = getattr(self._comp.par, name, None) if p is not None: util.setParValue(p, values[name]) else: print(self._comp.par.Modname + ': skipping missing param ' + name)
def LoadPreset(self, i): host, hostpars = self._GetHostAndPars() # if not host: # return print('loading preset "%s" [%i] in %s' % (_getPresetName(host, i), i, host.path)) data = _getDataPar(host, i).eval() if not data: return vals = json.loads(data) if not vals: return for (name, val) in vals.items(): p = getattr(host.par, name, None) if p is None: print('%s: skipping missing param %s' % (host.path, name)) else: util.setParValue(p, val)