public SceneBuilder(string outputPath, string sceneName, ExportationOptions exportationOptions, BabylonSceneController controller, string scriptPath) { OutputPath = outputPath; SceneName = string.IsNullOrEmpty(sceneName) ? "scene" : sceneName; SceneController = controller; SceneJavascriptPath = scriptPath; materialsDictionary = new Dictionary<string, BabylonMaterial>(); multiMatDictionary = new Dictionary<string, BabylonMultiMaterial>(); uniqueGuids = new Dictionary<int, string>(); babylonScene = new BabylonScene(OutputPath); babylonScene.producer = new BabylonProducer { file = Path.GetFileName(outputPath), version = "Unity3D", name = SceneName, exporter_version = "0.8.1" }; this.exportationOptions = exportationOptions; this.ManifestData = String.Empty; if (SceneController != null) { this.ManifestData = "{" + String.Format("\n\t\"version\" : {0},\n\t\"enableSceneOffline\" : {1},\n\t\"enableTexturesOffline\" : {2}\n", SceneController.manifestOptions.manifestVersion, SceneController.manifestOptions.storeSceneOffline.ToString().ToLower(), SceneController.manifestOptions.storeTextureOffline.ToString().ToLower()) + "}"; } }
public SceneBuilder(string outputPath, string sceneName, ExportationOptions exportationOptions) { OutputPath = outputPath; SceneName = string.IsNullOrEmpty(sceneName) ? "scene" : sceneName; materialsDictionary = new Dictionary<string, BabylonMaterial>(); multiMatDictionary = new Dictionary<string, BabylonMultiMaterial>(); uniqueGuids = new Dictionary<int, string>(); babylonScene = new BabylonScene(OutputPath); this.exportationOptions = exportationOptions; }
public ExportationOptions CreateSettings() { ExportationOptions result = new ExportationOptions(); string apath = Application.dataPath.Replace("/Assets", ""); string ufile = Path.Combine(apath, "UnityBabylonOptions.ini"); if (File.Exists(ufile)) { var readText = File.ReadAllText(ufile); var jsReader = new JsonReader(); result = jsReader.Read<ExportationOptions>(readText); } return result; }
public ExportationOptions CreateSettings() { ExportationOptions result = new ExportationOptions(); string apath = Application.dataPath.Replace("/Assets", ""); string ufile = Path.Combine(apath, "UnityBabylonOptions.ini"); if (File.Exists(ufile)) { var readText = File.ReadAllText(ufile); var jsReader = new JsonReader(); result = jsReader.Read <ExportationOptions>(readText); } return(result); }
void OnGUI() { if (exportationOptions == null) { exportationOptions = new ExportationOptions(); if (File.Exists("Unity3D2Babylon.ini")) { var readText = File.ReadAllText("Unity3D2Babylon.ini"); var jsReader = new JsonReader(); exportationOptions = jsReader.Read <ExportationOptions>(readText); } } GUILayout.Label("Exportation options", EditorStyles.boldLabel); exportationOptions.ReflectionDefaultLevel = EditorGUILayout.Slider("Reflection default level", exportationOptions.ReflectionDefaultLevel, 0, 1.0f); GUILayout.Label("Collisions options", EditorStyles.boldLabel); exportationOptions.ExportCollisions = EditorGUILayout.Toggle("Collisions", exportationOptions.ExportCollisions); exportationOptions.CameraEllipsoid = EditorGUILayout.Vector3Field("Camera's Ellipsoid:", exportationOptions.CameraEllipsoid); exportationOptions.Gravity = EditorGUILayout.Vector3Field("Gravity:", exportationOptions.Gravity); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Export")) { Export(); } EditorGUILayout.Space(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); foreach (var log in logs) { var bold = log.StartsWith("*"); GUILayout.Label(bold ? log.Remove(0, 1) : log, bold ? (EditorStyles.boldLabel) : EditorStyles.label); } EditorGUILayout.EndScrollView(); Repaint(); }
void OnGUI() { if (exportationOptions == null) { exportationOptions = new ExportationOptions(); if (File.Exists("Unity3D2Babylon.ini")) { var readText = File.ReadAllText("Unity3D2Babylon.ini"); var jsReader = new JsonReader(); exportationOptions = jsReader.Read<ExportationOptions>(readText); } } GUILayout.Label("Exportation options", EditorStyles.boldLabel); exportationOptions.ReflectionDefaultLevel = EditorGUILayout.Slider("Reflection default level", exportationOptions.ReflectionDefaultLevel, 0, 1.0f); GUILayout.Label("Collisions options", EditorStyles.boldLabel); exportationOptions.ExportCollisions = EditorGUILayout.Toggle("Collisions", exportationOptions.ExportCollisions); exportationOptions.CameraEllipsoid = EditorGUILayout.Vector3Field("Camera's Ellipsoid:", exportationOptions.CameraEllipsoid); exportationOptions.Gravity = EditorGUILayout.Vector3Field("Gravity:", exportationOptions.Gravity); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Export")) { Export(); } EditorGUILayout.Space(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); foreach (var log in logs) { var bold = log.StartsWith("*"); GUILayout.Label(bold ? log.Remove(0, 1) : log, bold ? (EditorStyles.boldLabel) : EditorStyles.label); } EditorGUILayout.EndScrollView(); Repaint(); }
public SceneBuilder(string outputPath, string sceneName, ExportationOptions exportationOptions) { OutputPath = outputPath; SceneName = string.IsNullOrEmpty(sceneName) ? "scene" : sceneName; materialsDictionary = new Dictionary <string, BabylonMaterial>(); multiMatDictionary = new Dictionary <string, BabylonMultiMaterial>(); uniqueGuids = new Dictionary <int, string>(); babylonScene = new BabylonScene(OutputPath); babylonScene.producer = new BabylonProducer { file = Path.GetFileName(outputPath), version = "Unity3D", name = SceneName, exporter_version = "0.8" }; this.exportationOptions = exportationOptions; }
public SceneBuilder(string outputPath, string sceneName, ExportationOptions exportationOptions) { OutputPath = outputPath; SceneName = string.IsNullOrEmpty(sceneName) ? "scene" : sceneName; materialsDictionary = new Dictionary<string, BabylonMaterial>(); multiMatDictionary = new Dictionary<string, BabylonMultiMaterial>(); uniqueGuids = new Dictionary<int, string>(); babylonScene = new BabylonScene(OutputPath); babylonScene.producer = new BabylonProducer { file = Path.GetFileName(outputPath), version = "Unity3D", name = SceneName, exporter_version = "0.8" }; this.exportationOptions = exportationOptions; }
void OnGUI() { if (exportationOptions == null) { exportationOptions = new ExportationOptions(); if (File.Exists("Unity3D2Babylon.ini")) { var readText = File.ReadAllText("Unity3D2Babylon.ini"); var jsReader = new JsonReader(); exportationOptions = jsReader.Read <ExportationOptions>(readText); } } GUILayout.Label("Exportation options", EditorStyles.boldLabel); exportationOptions.ReflectionDefaultLevel = EditorGUILayout.Slider("Reflection default level", exportationOptions.ReflectionDefaultLevel, 0, 1.0f); EditorGUILayout.Space(); GUILayout.Label("Collisions options", EditorStyles.boldLabel); exportationOptions.ExportCollisions = EditorGUILayout.Toggle("Collisions", exportationOptions.ExportCollisions); EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false)); GUILayout.Label("Camera's Ellipsoid"); exportationOptions.CameraEllipsoid = EditorGUILayout.Vector3Field("", exportationOptions.CameraEllipsoid, GUILayout.ExpandWidth(false)); EditorGUILayout.EndHorizontal(); GUILayout.Space(-16); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Gravity"); exportationOptions.Gravity = EditorGUILayout.Vector3Field("", exportationOptions.Gravity, GUILayout.ExpandWidth(false)); EditorGUILayout.EndHorizontal(); GUILayout.Space(-16); EditorGUILayout.Space(); GUILayout.Label("Physics options", EditorStyles.boldLabel); exportationOptions.ExportPhysics = EditorGUILayout.Toggle("Physics", exportationOptions.ExportPhysics); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Export")) { Export(false); } if (WebServer.IsSupported) { if (GUILayout.Button("Export & Run")) { Export(true); } } EditorGUILayout.Space(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); foreach (var log in logs) { var bold = log.StartsWith("*"); GUILayout.Label(bold ? log.Remove(0, 1) : log, bold ? (EditorStyles.boldLabel) : EditorStyles.label); } EditorGUILayout.EndScrollView(); Repaint(); }
void OnGUI() { if (exportationOptions == null) { exportationOptions = new ExportationOptions(); if (File.Exists("Unity3D2Babylon.ini")) { var readText = File.ReadAllText("Unity3D2Babylon.ini"); var jsReader = new JsonReader(); exportationOptions = jsReader.Read<ExportationOptions>(readText); } } GUILayout.Label("Exportation options", EditorStyles.boldLabel); exportationOptions.ReflectionDefaultLevel = EditorGUILayout.Slider("Reflection default level", exportationOptions.ReflectionDefaultLevel, 0, 1.0f); EditorGUILayout.Space(); GUILayout.Label("Collisions options", EditorStyles.boldLabel); exportationOptions.ExportCollisions = EditorGUILayout.Toggle("Collisions", exportationOptions.ExportCollisions); EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false)); GUILayout.Label("Camera's Ellipsoid"); exportationOptions.CameraEllipsoid = EditorGUILayout.Vector3Field("", exportationOptions.CameraEllipsoid, GUILayout.ExpandWidth(false)); EditorGUILayout.EndHorizontal(); GUILayout.Space(-16); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Gravity"); exportationOptions.Gravity = EditorGUILayout.Vector3Field("", exportationOptions.Gravity, GUILayout.ExpandWidth(false)); EditorGUILayout.EndHorizontal(); GUILayout.Space(-16); EditorGUILayout.Space(); GUILayout.Label("Physics options", EditorStyles.boldLabel); exportationOptions.ExportPhysics = EditorGUILayout.Toggle("Physics", exportationOptions.ExportPhysics); EditorGUILayout.Space(); GUILayout.Label("Shadows options", EditorStyles.boldLabel); exportationOptions.ExportShadows = EditorGUILayout.Toggle("Shadows", exportationOptions.ExportShadows); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Export")) { Export(false); } if (WebServer.IsSupported) { if (GUILayout.Button("Export & Run")) { Export(true); } } EditorGUILayout.Space(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); foreach (var log in logs) { var bold = log.StartsWith("*"); GUILayout.Label(bold ? log.Remove(0, 1) : log, bold ? (EditorStyles.boldLabel) : EditorStyles.label); } EditorGUILayout.EndScrollView(); Repaint(); }
public void OnEnable() { this.titleContent = new GUIContent("Exporter"); if (ExporterWindow.exportationOptions == null) { ExporterWindow.exportationOptions = CreateSettings(); } // Attach unity editor buttons UnityEditor.EditorApplication.playmodeStateChanged = () => { if (exportationOptions != null && exportationOptions.AttachUnityEditor) { bool wantsToPlay = UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode; bool wantsToPause = UnityEditor.EditorApplication.isPaused; if (wantsToPlay || wantsToPause) { UnityEditor.EditorApplication.isPlaying = false; UnityEditor.EditorApplication.isPaused = false; } if (wantsToPlay) Execute(); } }; // Activate asset store window if (this.assetStore == null) { this.assetStore = Tools.GetAssetStoreWindow(); } // Activate internl web server this.StartServer(); }