What is the best workflow for creating a custom operator

Hello, I’m making a custom operator CHOP that exposes python functions which means I can’t load my built DLL into a CPlusPlusCHOP. Whenever I make a change to my operator while developing I’d like to be able to overwrite my plugin DLL in the Plugins folder with copy but I get the error

The process cannot access the file because it is being used by another process.

To overcome this I need to close TouchDesigner, overwrite my DLL, and then relaunch TouchDesigner. Has anyone found a better workflow for developing a custom operator that doesn’t require closing and relaunching so many times.

Thanks!

1 Like

Have you tried temporarily enabling the ‘Unload Plugin’ parameter?
Should have the same effect.
Cheers

1 Like

Hi Rob, thanks for the response. I see that parameter on the CPlusPlus CHOP but not on my custom operator.
https://docs.derivative.ca/CPlusPlus_CHOP#:~:text=Unload%20Plugin%20unloadplugin%20-%20When%20this,it%20to%20release%20the%20file.
Is there an example implementation of that functionality for the custom operator?

For a recent project that was heavily c+±based I set up a “Run” target in Visual Studio that launched a tester project in the appropriate TD version. That makes it possible to easily launch it and to attach a debugger to it. It does mean re-launching when you make a change though. So I put in some features to make it easy to get the running project into the relevant state (recalling parameter values etc).

1 Like

Hi tekt, thanks for the suggestion. I set up a .toe file to run as a debugger command:

I haven’t been able to get the run touch file to load my debug file though (getting the error “failed to load plugin”).

No the option is only in the CPlusPlus CHOP. If you do find that feature quicker for developing, one option may be to develop as a CPlusPlus CHOP, only creating the custom operator afterwards.

2 Likes

I had a similar issue. I was able to get it to load when building with the Release profile. But for some reason the debug profile builds depend on a different version of the python runtime dll that isn’t available by default.
You can still debug the release builds but some variables aren’t viewable and stack traces sometimes skip things if they get inlined by the compiler.

Thanks for the help. I’ve managed to get the “plugin” to work when debugging but like @rob said I need to load it as a CPlusPlus CHOP (I’ll deal with the python stuff once I get all of my main functionality done). Additionally like @tekt said I am debugging with the “Release” build.

I’ve used visual studio debug to launch the TD process and set the linker output directory to the touch plugins folder. So every time I run as debug it launches the touch file with the new plugin version.

1 Like