public static Status ( |
||
asset | The asset path to fetch new state for. | |
리턴 |
public static void Open(AssetList assets) { Task task = Provider.Status(assets); task.Wait(); GetWindow().DoOpen(task.assetList); }
public static void Open(AssetList assets) { Task task = Provider.Status(assets); task.Wait(); WindowRevert.GetWindow().DoOpen(task.assetList.Filter(1 != 0, Asset.States.CheckedOutLocal, Asset.States.DeletedLocal, Asset.States.AddedLocal, Asset.States.Missing)); }
public void OnGUI() { float h = (position.height - 122) / 2; // TODO: Show the reason: Who has the exclusive lock? GUILayout.Label("Some files could not be checked out:", EditorStyles.boldLabel); Rect r1 = new Rect(6, 40, position.width - 12, h); GUILayout.BeginArea(r1); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); GUILayout.EndArea(); checkoutFailureList.OnGUI(new Rect(r1.x + 2, r1.y + 2, r1.width - 4, r1.height - 4), true); GUILayout.Space(20 + h); GUILayout.Label("The following files were successfully checked out:", EditorStyles.boldLabel); Rect r2 = new Rect(6, 40 + h + 40, position.width - 12, h); GUILayout.BeginArea(r2); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); GUILayout.EndArea(); checkoutSuccessList.OnGUI(new Rect(r2.x + 2, r2.y + 2, r2.width - 4, r2.height - 4), true); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); EditorUserSettings.showFailedCheckout = !GUILayout.Toggle(!EditorUserSettings.showFailedCheckout, "Don't show this window again."); GUILayout.FlexibleSpace(); bool enabled = GUI.enabled; GUI.enabled = checkoutFailureList.Size > 0; if (GUILayout.Button("Retry Check Out")) { Provider.Checkout(assetList, CheckoutMode.Exact); } GUI.enabled = checkoutSuccessList.Size > 0; if (GUILayout.Button("Revert Unchanged")) { Provider.Revert(assetList, RevertMode.Unchanged).SetCompletionAction(CompletionAction.UpdatePendingWindow); Provider.Status(assetList); Close(); } GUI.enabled = enabled; if (GUILayout.Button("OK")) { Close(); } GUILayout.EndHorizontal(); GUILayout.Space(12); }
public static void Open(AssetList assets) { Task task = Provider.Status(assets); task.Wait(); AssetList revert = task.assetList.Filter(true, new Asset.States[] { Asset.States.CheckedOutLocal }); GetWindow().DoOpen(revert); }
// Resolve a list of files static public void Open(AssetList assets) { Task task = Provider.Status(assets); task.Wait(); WindowResolve win = GetWindow(); win.DoOpen(task.assetList); }
public static void Open(AssetList assets) { Task task = Provider.Status(assets); task.Wait(); Asset.States[] states = new Asset.States[] { Asset.States.CheckedOutLocal, Asset.States.DeletedLocal, Asset.States.AddedLocal, Asset.States.Missing }; AssetList revert = task.assetList.Filter(true, states); GetWindow().DoOpen(revert); }
public void OnGUI() { float num = (base.position.height - 122f) / 2f; GUILayout.Label("Some files could not be checked out:", EditorStyles.boldLabel, new GUILayoutOption[0]); Rect screenRect = new Rect(6f, 40f, base.position.width - 12f, num); GUILayout.BeginArea(screenRect); GUILayout.Box(string.Empty, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); GUILayout.EndArea(); this.checkoutFailureList.OnGUI(new Rect(screenRect.x + 2f, screenRect.y + 2f, screenRect.width - 4f, screenRect.height - 4f), true); GUILayout.Space(20f + num); GUILayout.Label("The following files were successfully checked out:", EditorStyles.boldLabel, new GUILayoutOption[0]); Rect screenRect2 = new Rect(6f, 40f + num + 40f, base.position.width - 12f, num); GUILayout.BeginArea(screenRect2); GUILayout.Box(string.Empty, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); GUILayout.EndArea(); this.checkoutSuccessList.OnGUI(new Rect(screenRect2.x + 2f, screenRect2.y + 2f, screenRect2.width - 4f, screenRect2.height - 4f), true); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorUserSettings.showFailedCheckout = !GUILayout.Toggle(!EditorUserSettings.showFailedCheckout, "Don't show this window again.", new GUILayoutOption[0]); GUILayout.FlexibleSpace(); bool enabled = GUI.enabled; GUI.enabled = (this.checkoutFailureList.Size > 0); if (GUILayout.Button("Retry Check Out", new GUILayoutOption[0])) { Provider.Checkout(this.assetList, CheckoutMode.Exact); } GUI.enabled = (this.checkoutSuccessList.Size > 0); if (GUILayout.Button("Revert Unchanged", new GUILayoutOption[0])) { Provider.Revert(this.assetList, RevertMode.Unchanged).SetCompletionAction(CompletionAction.UpdatePendingWindow); Provider.Status(this.assetList); base.Close(); } GUI.enabled = enabled; if (GUILayout.Button("OK", new GUILayoutOption[0])) { base.Close(); } GUILayout.EndHorizontal(); GUILayout.Space(12f); }
internal static void OnSubmitted(Task task) { var winsChange = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (winsChange.Length == 0) { return; // user closed submit window before submit finished. Just ignore the status callback. } var win = winsChange[0]; win.assetList = task.assetList; win.submitResultCode = task.resultCode; win.submitErrorMessage = null; if ((task.resultCode & (int)SubmitResult.Error) != 0) { string delim = ""; foreach (Message msg in task.messages) { if (msg.severity == Message.Severity.Error) { win.submitErrorMessage += delim + msg.message; } } } if ((task.resultCode & ((int)SubmitResult.OK | (int)SubmitResult.Error)) != 0) { WindowPending.UpdateAllWindows(); bool isNewChangeSet = win.changeSet == null; if (isNewChangeSet) { // When change list becomes empty we open it to make "delete empty changessets" button visible Task flushTask = Provider.Status(""); // Make a dummy task and wait for it since that will guarantee up to date lists flushTask.Wait(); WindowPending.ExpandLatestChangeSet(); } } if ((task.resultCode & (int)SubmitResult.OK) != 0) { win.ResetAndClose(); } else { WindowResolve.Open(win.assetList); win.ResetAndClose(); } }
internal static void OnAdded(Task task) { WindowChange[] changeArray = UnityEngine.Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (changeArray.Length != 0) { WindowChange change = changeArray[0]; change.taskSubmit = null; change.submitResultCode = 0x100; change.submitErrorMessage = null; change.taskAdd = null; change.taskStatus = Provider.Status(change.assetList, false); change.assetList = null; WindowPending.UpdateAllWindows(); } }
internal static void OnAdded(Task task) { WindowChange[] array = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (array.Length != 0) { WindowChange windowChange = array[0]; windowChange.taskSubmit = null; windowChange.submitResultCode = 256; windowChange.submitErrorMessage = null; windowChange.taskAdd = null; windowChange.taskStatus = Provider.Status(windowChange.assetList, false); windowChange.assetList = null; WindowPending.UpdateAllWindows(); } }
internal static void OnSubmitted(Task task) { WindowChange[] array = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (array.Length == 0) { return; } WindowChange windowChange = array[0]; windowChange.assetList = task.assetList; windowChange.submitResultCode = task.resultCode; windowChange.submitErrorMessage = null; if ((task.resultCode & 2) != 0) { string empty = string.Empty; Message[] messages = task.messages; for (int i = 0; i < messages.Length; i++) { Message message = messages[i]; if (message.severity == Message.Severity.Error) { WindowChange expr_77 = windowChange; expr_77.submitErrorMessage = expr_77.submitErrorMessage + empty + message.message; } } } if ((task.resultCode & 3) != 0) { WindowPending.UpdateAllWindows(); bool flag = windowChange.changeSet == null; if (flag) { Task task2 = Provider.Status(string.Empty); task2.Wait(); WindowPending.ExpandLatestChangeSet(); } } if ((task.resultCode & 1) != 0) { windowChange.ResetAndClose(); } else { windowChange.RefreshList(); } }
internal static void OnAdded(Task task) { WindowChange[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (objectsOfTypeAll.Length == 0) { return; } WindowChange windowChange = objectsOfTypeAll[0]; windowChange.taskSubmit = (Task)null; windowChange.submitResultCode = 256; windowChange.submitErrorMessage = (string)null; windowChange.taskAdd = (Task)null; windowChange.taskStatus = Provider.Status(windowChange.assetList, false); windowChange.assetList = (AssetList)null; WindowPending.UpdateAllWindows(); }
// Revert a list of files static public void Open(AssetList assets) { Task task = Provider.Status(assets); task.Wait(); const bool includeFolders = true; AssetList revert = task.assetList.Filter(includeFolders, Asset.States.CheckedOutLocal, Asset.States.DeletedLocal, Asset.States.AddedLocal, //Asset.States.Branch, //Asset.States.Integrate, Asset.States.Missing); GetWindow().DoOpen(revert); }
private void DoOpen(ChangeSet change, AssetList assets) { this.taskSubmit = null; this.submitResultCode = 0x100; this.submitErrorMessage = null; this.changeSet = change; this.description = (change != null) ? this.SanitizeDescription(change.description) : ""; this.assetList = null; if (change == null) { this.taskStatus = Provider.Status(assets); } else { this.taskDesc = Provider.ChangeSetDescription(change); this.taskStat = Provider.ChangeSetStatus(change); } }
private void DoOpen(ChangeSet change, AssetList assets) { this.taskSubmit = null; this.submitResultCode = 256; this.submitErrorMessage = null; this.changeSet = change; this.description = string.Empty; this.assetList = null; if (change == null) { this.taskStatus = Provider.Status(assets); } else { this.taskDesc = Provider.ChangeSetDescription(change); this.taskStat = Provider.ChangeSetStatus(change); } }
internal static void OnSubmitted(Task task) { WindowChange[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (objectsOfTypeAll.Length == 0) { return; } WindowChange windowChange1 = objectsOfTypeAll[0]; windowChange1.assetList = task.assetList; windowChange1.submitResultCode = task.resultCode; windowChange1.submitErrorMessage = (string)null; if ((task.resultCode & 2) != 0) { string empty = string.Empty; foreach (Message message in task.messages) { if (message.severity == Message.Severity.Error) { WindowChange windowChange2 = windowChange1; string str = windowChange2.submitErrorMessage + empty + message.message; windowChange2.submitErrorMessage = str; } } } if ((task.resultCode & 3) != 0) { WindowPending.UpdateAllWindows(); if (windowChange1.changeSet == null) { Provider.Status(string.Empty).Wait(); WindowPending.ExpandLatestChangeSet(); } } if ((task.resultCode & 1) != 0) { windowChange1.ResetAndClose(); } else { windowChange1.RefreshList(); } }
// Open the change list window for one of 2 modes. File list or exisiting change list. // If changeID is null then a list of files is assumed and the user can sumbit them // as a new change list. void DoOpen(ChangeSet change, AssetList assets) { taskSubmit = null; submitResultCode = kSubmitNotStartedResultCode; submitErrorMessage = null; changeSet = change; description = change == null ? c_defaultDescription : SanitizeDescription(change.description); assetList = null; // Refresh the assets or changeset states if (change == null) { taskStatus = Provider.Status(assets); } else { taskDesc = Provider.ChangeSetDescription(change); taskStat = Provider.ChangeSetStatus(change); } }
internal static void OnAdded(Task task) { var winsChange = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (winsChange.Length == 0) { return; // user closed submit window before submit finished. Just ignore the status callback. } var win = winsChange[0]; win.taskSubmit = null; win.submitResultCode = kSubmitNotStartedResultCode; win.submitErrorMessage = null; win.taskAdd = null; // Refetch status win.taskStatus = Provider.Status(win.assetList, false); win.assetList = null; WindowPending.UpdateAllWindows(); // reflect newly added assets in pending window }
internal static void OnSubmitted(Task task) { WindowChange[] changeArray = UnityEngine.Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (changeArray.Length != 0) { WindowChange change = changeArray[0]; change.assetList = task.assetList; change.submitResultCode = task.resultCode; change.submitErrorMessage = null; if ((task.resultCode & 2) != 0) { string str = ""; foreach (Message message in task.messages) { if (message.severity == Message.Severity.Error) { change.submitErrorMessage = change.submitErrorMessage + str + message.message; } } } if ((task.resultCode & 3) != 0) { WindowPending.UpdateAllWindows(); if (change.changeSet == null) { Provider.Status("").Wait(); WindowPending.ExpandLatestChangeSet(); } } if ((task.resultCode & 1) != 0) { change.ResetAndClose(); } else { change.RefreshList(); } } }
void OnGUI() { cancelled = false; GUILayout.Label("Conflicting files to resolve", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); // I would use GUIUtility.GetLastRect() here after the box but that seems to have wierd side effects. Rect r1 = new Rect(6, 40, position.width - 12, position.height - 112); // 82 GUILayout.BeginArea(r1); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); GUILayout.EndArea(); bool repaint = resolveList.OnGUI(new Rect(r1.x + 2, r1.y + 2, r1.width - 4, r1.height - 4), true); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUI.enabled = assetList.Count > 0; GUILayout.Label("Resolve selection by:"); if (GUILayout.Button("using local version")) { SimpleMerge(ResolveMethod.UseMine); } if (GUILayout.Button("using incoming version")) { SimpleMerge(ResolveMethod.UseTheirs); } MergeMethod mergeMethod = MergeMethod.MergeNone; if (GUILayout.Button("merging")) { mergeMethod = MergeMethod.MergeAll; } if (mergeMethod != MergeMethod.MergeNone) { Task t = Provider.Merge(resolveList.SelectedAssets, mergeMethod); t.Wait(); if (t.success) { t = Provider.Resolve(t.assetList, ResolveMethod.UseMerged); t.Wait(); if (t.success) { // Check that there are not more conflicts for the specified // asset. This is possible in e.g. perforce where you handle // one version conflict at a time. t = Provider.Status(assetList); t.Wait(); DoOpen(t.assetList); if (t.success && assetList.Count == 0) { Close(); } // The view will be updated with the new conflicts } else { EditorUtility.DisplayDialog("Error resolving", "Error during resolve of files. Inspect log for details", "Close"); AssetDatabase.Refresh(); } } else { EditorUtility.DisplayDialog("Error merging", "Error during merge of files. Inspect log for details", "Close"); AssetDatabase.Refresh(); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(12); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUI.enabled = true; if (GUILayout.Button("Cancel")) { cancelled = true; Close(); } GUILayout.EndHorizontal(); GUILayout.Space(12); if (repaint) { Repaint(); } }
private void OnGUI() { this.cancelled = false; GUILayout.Label("Conflicting files to resolve", EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); Rect screenRect = new Rect(6f, 40f, base.position.width - 12f, base.position.height - 112f); GUILayout.BeginArea(screenRect); GUILayout.Box(string.Empty, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); GUILayout.EndArea(); bool flag = this.resolveList.OnGUI(new Rect(screenRect.x + 2f, screenRect.y + 2f, screenRect.width - 4f, screenRect.height - 4f), true); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUI.enabled = (this.assetList.Count > 0); GUILayout.Label("Resolve selection by:", new GUILayoutOption[0]); if (GUILayout.Button("using local version", new GUILayoutOption[0])) { AssetList selectedAssets = this.resolveList.SelectedAssets; Provider.Resolve(selectedAssets, ResolveMethod.UseMine).Wait(); AssetDatabase.Refresh(); base.Close(); } if (GUILayout.Button("using incoming version", new GUILayoutOption[0])) { AssetList selectedAssets2 = this.resolveList.SelectedAssets; Provider.Resolve(selectedAssets2, ResolveMethod.UseTheirs).Wait(); AssetDatabase.Refresh(); base.Close(); } MergeMethod mergeMethod = MergeMethod.MergeNone; if (GUILayout.Button("merging", new GUILayoutOption[0])) { mergeMethod = MergeMethod.MergeAll; } if (mergeMethod != MergeMethod.MergeNone) { Task task = Provider.Merge(this.resolveList.SelectedAssets, mergeMethod); task.Wait(); if (task.success) { task = Provider.Resolve(task.assetList, ResolveMethod.UseMerged); task.Wait(); if (task.success) { task = Provider.Status(this.assetList); task.Wait(); this.DoOpen(task.assetList); if (task.success && this.assetList.Count == 0) { base.Close(); } } else { EditorUtility.DisplayDialog("Error resolving", "Error during resolve of files. Inspect log for details", "Close"); AssetDatabase.Refresh(); } } else { EditorUtility.DisplayDialog("Error merging", "Error during merge of files. Inspect log for details", "Close"); AssetDatabase.Refresh(); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(12f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUI.enabled = true; if (GUILayout.Button("Cancel", new GUILayoutOption[0])) { this.cancelled = true; base.Close(); } GUILayout.EndHorizontal(); GUILayout.Space(12f); if (flag) { base.Repaint(); } }