private void OnGUI() { if (!_isInitialized) { Initialize(); } checkValidity(); SketchfabPlugin.showHeader(); displayVersionInfo(); DragAndDrop.visualMode = DragAndDropVisualMode.Generic; if (Event.current.type == EventType.DragExited) { if (DragAndDrop.paths.Length > 0) { _gltfPath = DragAndDrop.paths[0]; string modelfileName = Path.GetFileNameWithoutExtension(_gltfPath); _projectDirectory = GLTFUtils.unifyPathSeparator(Path.Combine(_defaultImportDirectory, modelfileName)); _currentSampleName = modelfileName; } } showImportUI(); // Options emptyLines(1); showOptions(); emptyLines(1); // Disable import if nothing valid to import GUI.enabled = _gltfPath.Length > 0 && File.Exists(_gltfPath); // Import button if (GUILayout.Button("IMPORT")) { processImportButton(); } showStatus(); }
void OnGUI() { checkValidity(); SketchfabPlugin.showHeader(); // Account settings if (!_api.isUserAuthenticated()) { showLoginUi(); } else { displayVersionInfo(); GUILayout.BeginHorizontal("Box"); GUILayout.Label("Account: <b>" + _api.getCurrentUserDisplayName() + (_api.getCurrentUserPlanLabel().Length > 0 ? "</b> (" + _api.getCurrentUserPlanLabel() + " account)" : ""), SketchfabPlugin.SkfbLabel); if (GUILayout.Button("Logout")) { _api.logoutUser(); resizeWindow(loginSize); } GUILayout.EndHorizontal(); GUILayout.Space(SketchfabPlugin.SPACE_SIZE); showModelProperties(); GUILayout.Space(SketchfabPlugin.SPACE_SIZE); showPrivateSetting(); showOptions(); bool enable = updateExporterStatus(); if (enable) { GUI.color = SketchfabPlugin.BLUE_COLOR; } else { GUI.color = SketchfabPlugin.GREY_COLOR; } if (_api.getUploadProgress() >= 0.0f && _api.getUploadProgress() < 1.0f) { Rect r = EditorGUILayout.BeginVertical(); EditorGUI.ProgressBar(r, _api.getUploadProgress(), "Upload progress"); GUILayout.Space(18); EditorGUILayout.EndVertical(); } else { GUI.enabled = enable; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(status, GUILayout.Width(250), GUILayout.Height(40))) { if (!enable) { EditorUtility.DisplayDialog("Error", status, "Ok"); } else { proceedToExportAndUpload(); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } } }