private void showLoginUi() { GUILayout.Label("Log in with your Sketchfab account", EditorStyles.centeredGreyMiniLabel); user_name = EditorGUILayout.TextField("Email", user_name); user_password = EditorGUILayout.PasswordField("Password", user_password); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(SketchfabPlugin.ClickableTextColor("Create an account"), SketchfabPlugin.SkfbClickableLabel, GUILayout.Height(20))) { Application.OpenURL(SketchfabPlugin.Urls.createAccount); } if (GUILayout.Button(SketchfabPlugin.ClickableTextColor("Reset your password"), SketchfabPlugin.SkfbClickableLabel, GUILayout.Height(20))) { Application.OpenURL(SketchfabPlugin.Urls.resetPassword); } if (GUILayout.Button(SketchfabPlugin.ClickableTextColor("Report an issue"), SketchfabPlugin.SkfbClickableLabel, GUILayout.Height(20))) { Application.OpenURL(SketchfabPlugin.Urls.reportAnIssue); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Login", GUILayout.Width(150), GUILayout.Height(25))) { _api.authenticateUser(user_name, user_password); EditorPrefs.SetString(usernameEditorKey, user_name); } GUILayout.EndHorizontal(); }
void OnCheckVersionSuccess() { if (!_api.isLatestVersion()) { SketchfabPlugin.DisplayVersionPopup(); } }
private void checkValidity() { SketchfabPlugin.CheckValidity((int)descSize.x, (int)descSize.y); if (_api == null) { setupAPI(); } }
private void checkValidity() { SketchfabPlugin.CheckValidity(); if (_importer == null) { Initialize(); } if (_api == null) { setupAPI(); } }
void OnEnable() { // Pre-fill model name with scene name if empty if (param_name.Length == 0) { param_name = EditorSceneManager.GetActiveScene().name; } SketchfabPlugin.Initialize(); setupAPI(); resizeWindow(loginSize); relog(); }
private void Initialize() { SketchfabPlugin.Initialize(); // Load header image setupAPI(); _importer = new GLTFEditorImporter(this.Repaint); _unzippedFiles = new List <string>(); _isInitialized = true; _unzipDirectory = Application.temporaryCachePath + "/unzip"; _header = new GUIStyle(EditorStyles.boldLabel); _defaultImportDirectory = Application.dataPath + "/Import"; this.minSize = minimumSize; }
public void displayVersionInfo() { if (_api.getLatestVersion() == null) { SketchfabPlugin.showVersionChecking(); } else if (_api.getLatestVersion().Length == 0) { SketchfabPlugin.showVersionCheckError(); } else if (_api.isLatestVersion()) { SketchfabPlugin.showUpToDate(_api.getLatestVersion()); } else { SketchfabPlugin.showOutdatedVersionWarning(_api.getLatestVersion()); } }
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(); }
private void showOptions() { GUILayout.Label("Options", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); opt_exportAnimation = EditorGUILayout.Toggle("Export animation (beta)", opt_exportAnimation); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); opt_exportSelection = EditorGUILayout.Toggle("Export selection", opt_exportSelection); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); param_autopublish = EditorGUILayout.Toggle("Publish immediately ", param_autopublish); if (GUILayout.Button("(" + SketchfabPlugin.ClickableTextColor("more info") + ")", SketchfabPlugin.SkfbClickableLabel, GUILayout.Height(20))) { Application.OpenURL(SketchfabPlugin.Urls.latestRelease); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }
private void showPrivateSetting() { GUILayout.Label("Set the model to Private", EditorStyles.centeredGreyMiniLabel); if (_api.getUserCanPrivate()) { EditorGUILayout.BeginVertical("Box"); GUILayout.BeginHorizontal(); param_private = EditorGUILayout.Toggle("Private model", param_private); if (GUILayout.Button("( " + SketchfabPlugin.ClickableTextColor("more info") + ")", SketchfabPlugin.SkfbClickableLabel, GUILayout.Height(20))) { Application.OpenURL(SketchfabPlugin.Urls.privateInfo); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUI.enabled = param_private; GUILayout.Label("Password"); param_password = EditorGUILayout.TextField(param_password); EditorGUILayout.EndVertical(); GUI.enabled = true; } else { if (_api.getCurrentUserPlanLabel() == "BASIC") { if (GUILayout.Button("(" + SketchfabPlugin.ClickableTextColor("Upgrade to a paid account to set your model to private") + ")", SketchfabPlugin.SkfbClickableLabel, GUILayout.Height(20))) { Application.OpenURL(SketchfabPlugin.Urls.plans); } } else { if (GUILayout.Button("(" + SketchfabPlugin.ClickableTextColor("You cannot set any other model to private (limit reached)") + ")", SketchfabPlugin.SkfbClickableLabel, GUILayout.Height(20))) { Application.OpenURL(SketchfabPlugin.Urls.plans); } } } }
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(); } } }