TUIK Knobs Question/Issue

Hey folks!

As a learning excercise, I’ve been building a sort of pseudo/faux modular synth in Touch Designer, in effect ‘patching’ the inputs and outputs of various Container COMPs as if they were modules… and building a UI for each to tweak and toggle various parameters in a pop up interface.

The issue : I am using TUIK Knob Labels to adjust various properties, and when I reopen the project, all of the CHOP values are as they were, but all of the TUIK knobs are reset to zero. I checked many other TUIK slider components, and they all seem to behave similar.

Is this a limitation of TUIK? Or is there something I need to do so that on reopen the UI I’ve built will reflect values that have been stored in the CHOPS they are assigned to drive.

I’ve attached a before and after picture to illustrate.
Many Thanks!

BEFORE

AFTER

-Casey

Hi Casey,

TUIK UI elements are clones - so when the project starts up I’d guess that they’re being reset to the default clone values. If you want to hold onto the previous values you probably want to stash them in storage or in a table, then use an execute DAT to re-set your UI values on start. Does that make sense?

@raganmd

Somehow your reply totally slipped past my radar! Thanks for the response.
I believe I understand what you’re saying, though I dont have the technical knowhow to implement your suggestion at present.

Currently working through your python coursework (after avoiding scripting like the plague!) so I imagine soon enough I’ll have an idea of how to go about it.

I appreciate the info!

-Casey

@hunt.casey

Take a look at this example to get jumpstarted:
save_vals_example.toe (5.87 KB)

An execute DAT is used to save your knob values to a table when you save your project, and then to set those values to your knobs when you start-up your project. The exciting stuff happens in a the module “text_set_recall”.

[code]# here we declare some variables for reuse in both of our functions

knobs will be a list of operators that are containers that

have “knob” anywhere in their name

knobs = parent().findChildren(type=containerCOMP, name=“knob”)

this just cleans up our references for the table DAT that

holds our values

val_DAT = op(‘table_knob_vals’)

def Store_knob_vals():
# the job of this function will be to store the values of the knobs
# inside of a table DAT.

# first we need to clear out old results from our table, but
# we want to make sure we keep our header row
val_DAT.clear(keepFirstRow=True)

# next we loop through each knob and find the values for u and v
# these radial knobs are harder to get a value out of, but I think
# this should do the trick.
# our last step in this loop is to add our values to our table DAT
for each_knob in knobs:
	slider1 	= each_knob.op('slider1')
	row_data 	= [slider1.path, slider1.panel.u, slider1.panel.v, slider1.op('out1')['v1']]
	val_DAT.appendRow(row_data)

return

def Set_knob_vals():
# the job of this function will be to make sure our knobs are correctly
# set up when the project starts

# here we loop through each row of our table (excluding the first row)
# for each target we set the u an v values to make sure that our 
# settings are faithfully restored.
for each_row in range(val_DAT.numRows)[1:]:
	target 			= op(val_DAT[each_row, 'path'])
	target.panel.u 	= val_DAT[each_row, 'u']
	target.panel.v 	= val_DAT[each_row, 'v']

return[/code]

Two helper functions are used to save your knob values, and then set them.

Gotchas - this assumes that the word “knob” is in the name of the container COMP. This approach only works with the TUIK knobs, and would need to be adjusted if you wanted to use it for sliders or other kinds of UI pieces.

Hope this helps you get started.

@raganmd

I musn’t have set notifications to replies, as I missed this.
Thanks for laying this out, its is super awesome.
Much appreciated! :smiley:

-Casey

I’ve had the same challenge. Thanks for the tip Matt!