/// <summary> /// Static constructor, primary entry point of initialization. /// </summary> static UsdInitializer() { var targetVariables = EnvironmentVariableTarget.Process; var usdLocation = GetUsdLocation(); var path = Environment.GetEnvironmentVariable("PATH", targetVariables); if (path.IndexOf(usdLocation) < 0) { // Assumes the standard USD build structure, may need to be modified for linux. path = path + ";" + Path.Combine(usdLocation, "lib"); path = path + ";" + Path.Combine(usdLocation, "bin"); Environment.SetEnvironmentVariable("PATH", path, targetVariables); } // We want to register the diagnostic handler before registering plugins, since they may spew // some useful warnings when things go wrong. var handler = new DiagnosticHandler(); // Save a copy so it doesn't get garbage collected while set as the handler. sm_diagnosticHandler = handler; // Init plugins (e.g. file formats, etc). var pluginsLocation = GetUsdPluginPath(); pxr.PlugRegistry.GetInstance().RegisterPlugins(pluginsLocation); // Init USD.NET.Unity type bindings. USD.NET.Unity.UnityTypeBindings.RegisterTypes(); }
public DiagnosticHandler() : base() { Instance = this; }