dev.StandAloneBuilds - tooll3/t3 GitHub Wiki

Building a stand alone version

NOTE: This process changed with this commit

Building a stand alone player...

  1. If not already run Install\install.bat to make sure bass.dll is copied to release build folders.
  2. In your IDE switch to release mode
  3. Rebuild the solution
  4. Switch configuration to "PlayerWithDeps" and build

image

This will generate a packaged build with all .net dependencies in Player\bin\Release\net6.0-windows\. Although this player executable is large, it no longer requires additional installation of .net depedencies.

An exporter executable project can the look like this:

image

  1. Restore the home-canvas with the default canvas
  2. Run build-stand-alone.bat → A stand alone version is created in ..\T3-Stand-alone
  3. Potentially clean up unwanted resource files

Testing the build.

  1. Run StartT3.exe (ideally with Shift Return to keep the console output open).
    • Make sure there are no errors → See fix Operator build errors
  2. Run Editor.exe (ideally with Shift Return to keep the console output open).
    • Make sure there are no errors → See fixing Startup errors

Pitfalls

Fixing startup errors

  1. Always check log files in .t3/log/

potential problems:

Could not load type

...
Info:  read symbol: `Operators\Types\lib\3d\helper\TextSprites_1a6a58ea-c63a-4c99-aa9d-aeaeb01662f4.t3`
Error: The type initializer for 'T3.Editor.Gui.T3Ui' threw an exception.
   at T3.Editor.Program.Main(String[] args) in C:\Users\pixtur\dev\tooll\t3\Editor\Program.cs:line 122
Unhandled exception. System.TypeInitializationException: The type initializer for 'T3.Editor.Gui.T3Ui' threw an exception.
--→ System.TypeLoadException: Could not load type 'Operators.Utils.BmFontDescription+VerticalAligns' from assembly 'Operators, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at System.Reflection.CustomAttribute._GetPropertyOrFieldData(RuntimeModule pModule, Byte** ppBlobStart, Byte* pBlobEnd, String& name, Boolean& bIsProperty, RuntimeType& type, Object& value)
...
   at T3.Editor.Gui.UiModel.Init() in C:\Users\pixtur\dev\tooll\t3\Editor\Gui\UiModel.cs:line 223
   at T3.Editor.Gui.UiModel..ctor(Assembly operatorAssembly) in C:\Users\pixtur\dev\tooll\t3\Editor\Gui\UiModel.cs:line 43
   at T3.Editor.Gui.T3Ui..cctor() in C:\Users\pixtur\dev\tooll\t3\Editor\Gui\T3UI.cs:line 38
   --- End of inner exception stack trace ---
   at T3.Editor.Program.Main(String[] args) in C:\Users\pixtur\dev\tooll\t3\Editor\Program.cs:line 130

How to fix

The important section is Could not load type 'Operators.Utils.BmFontDescription+VerticalAligns'. This looks like when compiling the Operators.dll not all required references were added. In this case some enums defined in BmFontDescription. When looking into the source we find BmFontDescription.cs in Operators\Utils\. And with further investigation we can see, that in StartT3/Program.cs it's missing in the reference list:

            operatorAssemblySources.Add(File.ReadAllText(@"Operators\Utils\AudioAnalysisResult.cs"));
            operatorAssemblySources.Add(File.ReadAllText(@"Operators\Utils\BmFont.cs"));
            operatorAssemblySources.Add(File.ReadAllText(@"Operators\Utils\GpuQuery.cs"));
            operatorAssemblySources.Add(File.ReadAllText(@"Operators\Utils\ICameraPropertiesProvider.cs"));
            operatorAssemblySources.Add(File.ReadAllText(@"Operators\Utils\MidiInConnectionManager.cs"));
            operatorAssemblySources.Add(File.ReadAllText(@"Operators\Utils\OscConnectionManager.cs"));
            operatorAssemblySources.Add(File.ReadAllText(@"Operators\Utils\Interop\SpoutDX.cs"));
            operatorAssemblySources.Add(File.ReadAllText(@"Operators\Utils\Interop\Std.cs"));

We can add this and rebuild the standalone.

Background

To understand why this is not as straight forward, we have to understand how Operators are build into an assembly: The Operators-assembly is one of the three major parts of the t3-solution (the others are Core, T3, and Player). This assembly contains all classes defined by operators symbols. Whenever you combine operators or change it's inputs, this Operators-assembly will rebuild on the fly.

While tooll is running this will happen in memory. But on the next start the operators.dll has to be recompiled. That's what the IDE does for you, when you start the t3-project: Operators is one of its dependencies, so it will be rebuild.

Rebuilding Operators.dll

We don't necessarily need an IDE like visual studio to rebuild Operators.dll. In fact, when exporting a player, T3 does just that: it generate as subset of the required ops for you project and builds a new operator.dll into the Export/ directory.

Now for the tricky parts:

  • Operator.dll can't be written, while its being used - so we need a stand alone executable that does this job before starting tooll.
  • To correctly build the operators.dll that is usable for t3-editor, the compiler needs some additional references → currently we are resolve these by using a "Reference" operators.dll.
  • Assembly versions, targets frameworks and architecture must match precisely
  • For building we need quite a lot of dependencies, which makes the t3 directory rather polluted. With .netcore defining additional sub folders for assemblies is no longer supported.

In the feature branch https://github.com/still-scene/t3/tree/feat/standalone-runner we are exploring how to address this issues.

Frequently compilation fails with zero file size. No error or warning → It would be great to catch these!

Make sure that StartEditor.deps.json is complete.