Skip to content

Instantly share code, notes, and snippets.

Last active May 7, 2019 01:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
def load_preset(preset_name, storage_op, target_op):
A Helper function that writes JSON file to disk
preset_name (str):
> the string name of the preset we want to load
storage_op (TouchDesigner operator):
> the target operator storing the presets.
target_op (TouchDesigner operator):
> the target operator whose values we want to set.
# safety to ensure we have a preset to use
preset_vals = storage_op.fetch("presets")[preset_name]
print("This preset does not exist")
# loop through all pars and set them based on the vals in storage
for each_par, each_val in preset_vals.items():[0].val = each_val
target_op.par.Presetname = preset_name
# example use
target_op = op('base_target')
storage_op = op('base_example')
preset_name = 'look002'
load_preset(preset_name, storage_op, target_op)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment