public static void ChangeRootDirectory(DirectoryInfo newAgxDir) { var type = FindType(newAgxDir); if (type == AGXDirectoryType.Unknown) { return; } Environment.Set(Environment.Variable.AGX_DIR, ""); Environment.Set(Environment.Variable.AGX_PLUGIN_PATH, ""); foreach (var path in Instance.AGX_BIN_PATH) { Environment.RemoveFromPath(path); } Instance.Clear(); EditorUtility.SetDirty(Instance); AssetDatabase.SaveAssets(); var success = false; if (type == AGXDirectoryType.Checkout) { success = Instance.InitializeCheckout(newAgxDir.FullName); } else { success = Instance.InitializeInstalled(newAgxDir.FullName); } if (success) { EditorUtility.SetDirty(Instance); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); EditorApplication.OpenProject(Path.Combine(Application.dataPath, "..")); } }
public bool ApplyData() { IsApplied = true; Environment.Set(Environment.Variable.AGX_DIR, AGX_DIR); Environment.Set(Environment.Variable.AGX_PLUGIN_PATH, AGX_PLUGIN_PATH); foreach (var path in AGX_BIN_PATH) { Environment.AddToPath(path); } // All binaries should be in path, try initialize agx. try { AGXUnity.NativeHandler.Instance.Register(null); } catch (TypeInitializationException) { Debug.LogError($"{"ERROR".Color( Color.red )}: Missing dll."); return(false); } var envInstance = agxIO.Environment.instance(); for (int i = 0; i < (int)agxIO.Environment.Type.NUM_TYPES; ++i) { envInstance.getFilePath((agxIO.Environment.Type)i).clear(); } envInstance.getFilePath(agxIO.Environment.Type.RESOURCE_PATH).pushbackPath("."); envInstance.getFilePath(agxIO.Environment.Type.RESOURCE_PATH).pushbackPath(AGX_DIR); envInstance.getFilePath(agxIO.Environment.Type.RESOURCE_PATH).pushbackPath(AGX_PLUGIN_PATH); envInstance.getFilePath(agxIO.Environment.Type.RESOURCE_PATH).pushbackPath(AGX_DATA_DIR); envInstance.getFilePath(agxIO.Environment.Type.RESOURCE_PATH).pushbackPath(AGX_DATA_DIR + Path.DirectorySeparatorChar + "cfg"); envInstance.getFilePath(agxIO.Environment.Type.RUNTIME_PATH).pushbackPath(AGX_PLUGIN_PATH); return(true); }