Skip to content

Instantly share code, notes, and snippets.

Last active May 7, 2019 00:01
  • 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 dict_to_storage(target_op, storage_dict_key, preset_name, dict_to_store):
A reusable method for capturing parameters on a single page of a COMP
target_op (TouchDesigner COMP):
> a ToughDesigner COMP that has custom parameters you would like to convert
> into a python dictionary.
storage_dict_key (str):
> the string name of the storage dictionary you'd like to add
> your preset / cue to.
preset_name (str):
> a name for the preset / cue.
dict_to_store (dict):
> a python dictionary to put into storage.
# grab the dictionary from storage
all_presets = target_op.fetch(storage_dict_key)
# create a new entry
all_presets[preset_name] = dict_to_store
# put dictionary back into storage, all_presets)
# example use
target_op = op('base_example')
storage_dict_key = 'presets'
preset_name = 'look001'
dict_to_store = {"preset_values": {
'Blacklevel' : 0.0,
'Contrast' : 1.0,
'Opacity' : 1.0
dict_to_storage(target_op, storage_dict_key, preset_name, dict_to_store)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment