TouchEngine and onStart() method

Hello,

I built an interaction with Touchdesigner which saves values inside .txt files.

When the project is launched i read back those values as starting states using an ExecuteDAT with OnStart activated. The code is as follow :

def onStart():
  counter = op('count6')
  with open(str(parent().par.Backupfile)) as f:
     counter.par.resetvalue = f.read(5)
  counter.par.resetpulse.pulse()
  op('hold1').par.holdpulse.pulse()
  return

Everything works as expected when launching the project using Touchdesigner (.toe or .tox file)

Now i need to embed this project inside a media player for the video part so i am loading the .tox file inside the mediaplayer. When doing so, the installation is not reset with the backup values stored in the .txt files.

I was wondering if the OnStart() method is triggered inside TouchEngine ? Or maybe this issue has to do with the mediaplayer or something i am missing when using it with TouchEngine ?

Let me know so i know if i have to investigate further outside TD

Thanks !

Hi

Because TouchEngine loads components after it has started, onStart() won’t be called. You can use onCreate() to do that work instead.

The documentation for the Engine COMP mention this.

Hi,

I have just stumpled upon this !

Thanks for the clarification :slight_smile:

Cheers