Last active
May 7, 2019 00:01
Revisions
-
raganmd revised this gist
May 7, 2019 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,8 +20,7 @@ def dict_to_storage(target_op, storage_dict_key, preset_name, dict_to_store): Returns --------------- None ''' # grab the dictionary from storage all_presets = target_op.fetch(storage_dict_key) -
raganmd revised this gist
May 6, 2019 . 1 changed file with 28 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,35 @@ 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 Args --------------- 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. Returns --------------- par_dict (dict) > a dictionary containing a preset name and dictionary of parameters. ''' # 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 target_op.store(storage_dict_key, all_presets) # example use -
raganmd created this gist
May 6, 2019 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ def dict_to_storage(target_op, storage_dict_key, preset_name, dict_to_store): all_presets = target_op.fetch(storage_dict_key) all_presets[preset_name] = dict_to_store target_op.store(storage_dict_key, 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)