2 hours ago · Tech · hide · 0 comments

When I'm creating systems in TouchDesigner I'll often make use of the Custom Parameters feature in a Comp, allowing me to create a settings style interface for that Comp. What I also will want to do is save out those settings and have them load in automatically. There's a few ways to this including TDJSON.addParametersFromJSONOp but sometimes you just want a simple system so here's the code I use which saves and load the parameters to a file. import json from pathlib import Path def saveParamValues(comp, filepath): data = {p.name: p.eval() for p in comp.customPars} with open(filepath, 'w') as f: json.dump(data, f, indent=2) def loadParamValues(comp, filepath): if Path(filepath).exists(): with open(filepath) as f: data = json.load(f) for name, val in data.items(): if hasattr(comp.par, name): getattr(comp.par, name).val = val I put this code in an Execute DAT and have the Save method triggered on Exit and the Load method triggered on Start. You could also add a Parameter Execute DAT and…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.