Based on your description, it appears that while the incoming OSC commands are updating the values in your CHOP to DAT (chop_to_dat), these changes aren’t triggering the DAT Execute script effectively. Here are some troubleshooting tips and potential solutions to ensure that the updates are processed correctly:
Check the configuration of the DAT Execute DAT that runs your script. It should be set to execute on the triggers that correspond to the changes in the chop_to_dat DAT:
- Table Change: If the entire table updates (more typical with an overwrite from a CHOP).
- Cell Change: If individual cells in the DAT are updated.
- Row Change: If you expect row-level changes.
Make sure the correct triggers are enabled in the DAT Execute DAT’s parameters.
Modify your script slightly to log or visibly show the changes it receives to confirm it’s actually running with new data:
chop_to_dat = op('chopto4')
print("Error: CHOP to DAT converter not found.")
print("Current DAT States:")
for col_index in range(chop_to_dat.numCols):
col_value = float(chop_to_dat[0, col_index].val) if chop_to_dat[0, col_index] is not None else 0
print(f"Column {col_index}: {col_value}")
normalized_values = [v / total for v in values]
normalized_values = [0] * len(values) # Avoid division by zero
print(f"Normalized weights set for blending: {normalized_values}")
constant_tops = ['const1', 'const2', 'const3', 'const4']
for i, const_top_name in enumerate(constant_tops):
const_top = op(const_top_name)
old_opacity = const_top.par.opacity.eval()
new_opacity = normalized_values[i]
if old_opacity != new_opacity:
const_top.par.opacity = new_opacity
print(f"Updated opacity for {const_top_name} from {old_opacity} to {new_opacity}")
print(f"No change in opacity needed for {const_top_name}")
print(f"Error: Operator {const_top_name} not found.")
If the script isn’t executing because the data hasn’t “changed enough” from TouchDesigner’s perspective (e.g., same values being sent), consider adding a mechanism to force execution. For instance, include a counter or a timestamp within the OSC message to ensure it’s considered new each time.
Add additional logging to confirm:
- The script is running each time data changes.
- The data being processed is indeed the new data coming in.
If none of the above steps resolves the issue, consider reaching out to the TouchDesigner community or consulting the official documentation for advanced troubleshooting, particularly around data-driven triggers and OSC handling. Sometimes, specific versions of TouchDesigner might behave slightly differently or require specific setups for dynamic data processing.