static internal AssetList GetInspectorAssets(Object[] assets) { AssetList inspectorAssets = new AssetList(); foreach (var asset in assets) { string assetPath = AssetDatabase.GetAssetPath(asset); if (NeedToCheckOutBoth(asset)) { Asset actualAsset = CacheStatus(assetPath); if (actualAsset != null) { inspectorAssets.Add(actualAsset); } } Asset metaAsset = CacheStatus(AssetDatabase.GetTextMetaFilePathFromAssetPath(assetPath)); if (metaAsset != null) { inspectorAssets.Add(metaAsset); } } return(inspectorAssets); }
// Filter a list of assets by a given set of states public AssetList Filter(bool includeFolder, params Asset.States[] states) { AssetList filter = new AssetList(); if (includeFolder == false && (states == null || states.Length == 0)) { return(filter); } foreach (Asset asset in this) { if (asset.isFolder) { if (includeFolder) { filter.Add(asset); } } else { if (asset.IsOneOfStates(states)) { filter.Add(asset); } } } return(filter); }
public AssetList Filter(bool includeFolder, params Asset.States[] states) { AssetList assetList = new AssetList(); if (!includeFolder && (states == null || states.Length == 0)) { return(assetList); } foreach (Asset current in this) { if (current.isFolder) { if (includeFolder) { assetList.Add(current); } } else { if (current.IsOneOfStates(states)) { assetList.Add(current); } } } return(assetList); }
public AssetList Filter(bool includeFolder, params Asset.States[] states) { AssetList assetList = new AssetList(); if (!includeFolder && (states == null || states.Length == 0)) { return(assetList); } using (List <Asset> .Enumerator enumerator = this.GetEnumerator()) { while (enumerator.MoveNext()) { Asset current = enumerator.Current; if (current.isFolder) { if (includeFolder) { assetList.Add(current); } } else if (current.IsOneOfStates(states)) { assetList.Add(current); } } } return(assetList); }
private void OnUnaddedFilesGUI() { AssetList assetList = new AssetList(); string text = string.Empty; foreach (Asset current in this.assetList) { if (!current.IsState(Asset.States.OutOfSync) && !current.IsState(Asset.States.Synced) && !current.IsState(Asset.States.AddedLocal)) { text = text + current.prettyPath + "\n"; assetList.Add(current); } } GUILayout.Label("Files to add", EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.Label("Some additional files need to be added:", new GUILayoutOption[0]); GUI.enabled = false; GUILayout.TextArea(text, new GUILayoutOption[0]); GUI.enabled = true; GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add files", new GUILayoutOption[0])) { this.taskAdd = Provider.Add(assetList, false); this.taskAdd.SetCompletionAction(CompletionAction.OnAddedChangeWindow); } if (GUILayout.Button("Abort", new GUILayoutOption[0])) { this.taskSubmit = null; this.submitResultCode = 256; this.submitErrorMessage = null; base.Close(); } GUILayout.EndHorizontal(); }
private void OnUnaddedFilesGUI() { AssetList assets = new AssetList(); string text = string.Empty; using (List <Asset> .Enumerator enumerator = this.assetList.GetEnumerator()) { while (enumerator.MoveNext()) { Asset current = enumerator.Current; if (!current.IsState(Asset.States.OutOfSync) && !current.IsState(Asset.States.Synced) && !current.IsState(Asset.States.AddedLocal)) { text = text + current.prettyPath + "\n"; assets.Add(current); } } } GUILayout.Label("Files to add", EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.Label("Some additional files need to be added:"); GUI.enabled = false; GUILayout.TextArea(text); GUI.enabled = true; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add files")) { this.taskAdd = Provider.Add(assets, false); this.taskAdd.SetCompletionAction(CompletionAction.OnAddedChangeWindow); } if (GUILayout.Button("Abort")) { this.ResetAndClose(); } GUILayout.EndHorizontal(); }
void OnUnaddedFilesGUI() { AssetList toAdd = new AssetList(); string files = ""; foreach (Asset a in assetList) { if (!a.IsState(Asset.States.OutOfSync) && !a.IsState(Asset.States.Synced) && !a.IsState(Asset.States.AddedLocal)) { files += a.prettyPath + "\n"; toAdd.Add(a); } } GUILayout.Label("Files to add", EditorStyles.boldLabel); GUILayout.Label("Some additional files need to be added:"); GUI.enabled = false; GUILayout.TextArea(files); GUI.enabled = true; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add files")) { taskAdd = Provider.Add(toAdd, false); taskAdd.SetCompletionAction(CompletionAction.OnAddedChangeWindow); } if (GUILayout.Button("Abort")) { ResetAndClose(); } GUILayout.EndHorizontal(); }
private void DoOpen(AssetList assets, bool alreadyOpen) { if (alreadyOpen) { foreach (var asset in assets) { bool found = false; int count = assetList.Count; for (int i = 0; i < count; i++) { if (assetList[i].path == asset.path) { found = true; assetList[i] = asset; break; } } if (!found) { assetList.Add(asset); } } } else { assetList.AddRange(assets); } RefreshList(); }
private void OnUnaddedFilesGUI() { AssetList assets = new AssetList(); string text = ""; foreach (Asset asset in this.assetList) { if ((!asset.IsState(Asset.States.OutOfSync) && !asset.IsState(Asset.States.Synced)) && !asset.IsState(Asset.States.AddedLocal)) { text = text + asset.prettyPath + "\n"; assets.Add(asset); } } GUILayout.Label("Files to add", EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.Label("Some additional files need to be added:", new GUILayoutOption[0]); GUI.enabled = false; GUILayout.TextArea(text, new GUILayoutOption[0]); GUI.enabled = true; GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add files", new GUILayoutOption[0])) { this.taskAdd = Provider.Add(assets, false); this.taskAdd.SetCompletionAction(CompletionAction.OnAddedChangeWindow); } if (GUILayout.Button("Abort", new GUILayoutOption[0])) { this.ResetAndClose(); } GUILayout.EndHorizontal(); }
static public Task Checkout(string asset, CheckoutMode mode, ChangeSet changeset = null) { var assetList = new AssetList(); assetList.Add(GetAssetByPath(asset)); return(CheckCallbackAndCheckout(assetList, mode, changeset)); }
static public Task Checkout(Asset asset, CheckoutMode mode, ChangeSet changeset) { var assetList = new AssetList(); assetList.Add(asset); return(CheckCallbackAndCheckout(assetList, mode, changeset)); }
/// <summary> /// <para>Return version control information about the currently selected assets.</para> /// </summary> public static AssetList GetAssetListFromSelection() { AssetList assetList = new AssetList(); foreach (Asset asset in Provider.Internal_GetAssetArrayFromSelection()) { assetList.Add(asset); } return(assetList); }
public static Task Checkout(UnityEngine.Object[] assets, CheckoutMode mode) { AssetList list = new AssetList(); foreach (UnityEngine.Object obj2 in assets) { Asset assetByPath = GetAssetByPath(AssetDatabase.GetAssetPath(obj2)); list.Add(assetByPath); } return(Internal_Checkout(list.ToArray(), mode)); }
/// <summary> /// <para>Checkout an asset or list of asset from the version control system.</para> /// </summary> /// <param name="assets">List of assets to checkout.</param> /// <param name="mode">Tell the Provider to checkout the asset, the .meta file or both.</param> /// <param name="asset">Asset to checkout.</param> public static Task Checkout(Object[] assets, CheckoutMode mode) { AssetList assetList = new AssetList(); foreach (Object asset in assets) { Asset assetByPath = Provider.GetAssetByPath(AssetDatabase.GetAssetPath(asset)); assetList.Add(assetByPath); } return(Provider.Internal_Checkout(assetList.ToArray(), mode)); }
/// <summary> /// <para>Return version control information about the currently selected assets.</para> /// </summary> public static AssetList GetAssetListFromSelection() { AssetList list = new AssetList(); Asset[] assetArray = Internal_GetAssetArrayFromSelection(); foreach (Asset asset in assetArray) { list.Add(asset); } return(list); }
static public Task Checkout(UnityEngine.Object asset, CheckoutMode mode, ChangeSet changeset) { var path = AssetDatabase.GetAssetPath(asset); var vcasset = GetAssetByPath(path); var assetList = new AssetList(); assetList.Add(vcasset); return(CheckCallbackAndCheckout(assetList, mode, changeset)); }
static public AssetList GetAssetListFromSelection() { var list = new AssetList(); foreach (var asset in Internal_GetAssetArrayFromSelection()) { list.Add(asset); } return(list); }
static public Task Checkout(Object[] assets, CheckoutMode mode, ChangeSet changeset) { var assetList = new AssetList(); foreach (var o in assets) { assetList.Add(GetAssetByPath(AssetDatabase.GetAssetPath(o))); } return(CheckCallbackAndCheckout(assetList, mode, changeset)); }
static public Task Checkout(string[] assets, CheckoutMode mode, ChangeSet changeset) { var assetList = new AssetList(); foreach (var path in assets) { var asset = GetAssetByPath(path); assetList.Add(asset); } return(CheckCallbackAndCheckout(assetList, mode, changeset)); }
static public Task Checkout(UnityEngine.Object[] assets, CheckoutMode mode) { AssetList assetList = new AssetList(); foreach (Object o in assets) { string path = AssetDatabase.GetAssetPath(o); Asset asset = GetAssetByPath(path); assetList.Add(asset); } return(Internal_Checkout(assetList.ToArray(), mode)); }
void DoOpen(AssetList resolve, bool selectAll = false) { if (assetList.Count == 0 && assetPaths.Count != 0) { assetPaths.ForEach(assetPath => assetList.Add(Provider.CacheStatus(assetPath))); } bool includeFolders = true; assetList = resolve.Filter(includeFolders, Asset.States.Conflicted); assetPaths = assetList.Select(asset => asset.path).ToList(); RefreshList(selectAll); }
public static Task Checkout(UnityEngine.Object[] assets, CheckoutMode mode) { AssetList assetList = new AssetList(); for (int i = 0; i < assets.Length; i++) { UnityEngine.Object assetObject = assets[i]; string assetPath = AssetDatabase.GetAssetPath(assetObject); Asset assetByPath = Provider.GetAssetByPath(assetPath); assetList.Add(assetByPath); } return(Provider.Internal_Checkout(assetList.ToArray(), mode)); }
public static AssetList GetAssetListFromSelection() { AssetList assetList = new AssetList(); Asset[] array = Provider.Internal_GetAssetArrayFromSelection(); Asset[] array2 = array; for (int i = 0; i < array2.Length; i++) { Asset item = array2[i]; assetList.Add(item); } return(assetList); }
public AssetList Filter(bool includeFolder, params Asset.States[] states) { AssetList list = new AssetList(); if (includeFolder || ((states != null) && (states.Length != 0))) { foreach (Asset asset in this) { if (asset.isFolder) { if (includeFolder) { list.Add(asset); } } else if (asset.IsOneOfStates(states)) { list.Add(asset); } } } return(list); }
//*Undocumented static internal bool PromptAndCheckoutIfNeeded(string[] assets, string promptIfCheckoutIsNeeded, ChangeSet changeset = null) { var assetList = new AssetList(); foreach (var path in assets) { var asset = GetAssetByPath(path); assetList.Add(asset); } if (preCheckoutCallback != null) { var changesetID = changeset == null ? ChangeSet.defaultID : changeset.id; string changesetDescription = null; if (preCheckoutCallback(assetList, ref changesetID, ref changesetDescription) == true) { var changesetTask = CheckAndCreateUserSuppliedChangeSet(changesetID, changesetDescription, ref changeset); if (changesetTask != null) { Debug.LogError("Tried to create/rename remote ChangeSet to match the one specified in user-supplied callback but failed with error code: " + changesetTask.resultCode.ToString()); return(false); } var newAssets = new List <string>(); foreach (var asset in assetList) { newAssets.Add(asset.path); } assets = newAssets.ToArray(); } else { Debug.LogWarning("User-created pre-checkout callback has blocked this checkout."); return(false); } } return(Internal_PromptAndCheckoutIfNeeded(assets, promptIfCheckoutIsNeeded, changeset)); }
private void OnGUI() { this.InitStyles(); if (!WindowPending.s_DidReload) { WindowPending.s_DidReload = true; this.UpdateWindow(); } this.CreateResources(); Event current = Event.current; float fixedHeight = EditorStyles.toolbar.fixedHeight; bool flag1 = false; GUILayout.BeginArea(new Rect(0.0f, 0.0f, this.position.width, fixedHeight)); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); int num = this.incomingList.Root != null ? this.incomingList.Root.ChildCount : 0; this.m_ShowIncoming = !GUILayout.Toggle(!this.m_ShowIncoming, "Outgoing", EditorStyles.toolbarButton, new GUILayoutOption[0]); this.m_ShowIncoming = GUILayout.Toggle(this.m_ShowIncoming, GUIContent.Temp("Incoming" + (num != 0 ? " (" + num.ToString() + ")" : string.Empty)), EditorStyles.toolbarButton, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { flag1 = true; } GUILayout.FlexibleSpace(); EditorGUI.BeginDisabledGroup(Provider.activeTask != null); foreach (CustomCommand customCommand in Provider.customCommands) { if (customCommand.context == CommandContext.Global && GUILayout.Button(customCommand.label, EditorStyles.toolbarButton, new GUILayoutOption[0])) { customCommand.StartTask(); } } EditorGUI.EndDisabledGroup(); if (Mathf.FloorToInt(this.position.width - this.s_ToolbarButtonsWidth - this.s_SettingsButtonWidth - this.s_DeleteChangesetsButtonWidth) > 0 && this.HasEmptyPendingChangesets() && GUILayout.Button("Delete Empty Changesets", EditorStyles.toolbarButton, new GUILayoutOption[0])) { this.DeleteEmptyPendingChangesets(); } if (Mathf.FloorToInt(this.position.width - this.s_ToolbarButtonsWidth - this.s_SettingsButtonWidth) > 0 && GUILayout.Button("Settings", EditorStyles.toolbarButton, new GUILayoutOption[0])) { EditorApplication.ExecuteMenuItem("Edit/Project Settings/Editor"); EditorWindow.FocusWindowIfItsOpen <InspectorWindow>(); GUIUtility.ExitGUI(); } Color color1 = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.5f); bool flag2 = GUILayout.Button((Texture)this.refreshIcon, EditorStyles.toolbarButton, new GUILayoutOption[0]); bool flag3 = flag1 || flag2; GUI.color = color1; if (current.isKey && GUIUtility.keyboardControl == 0 && (current.type == EventType.KeyDown && current.keyCode == KeyCode.F5)) { flag3 = true; current.Use(); } if (flag3) { if (flag2) { Provider.InvalidateCache(); } this.UpdateWindow(); } GUILayout.EndArea(); Rect rect = new Rect(0.0f, fixedHeight, this.position.width, (float)((double)this.position.height - (double)fixedHeight - 17.0)); bool flag4 = false; GUILayout.EndHorizontal(); bool flag5; if (!Provider.isActive) { Color color2 = GUI.color; GUI.color = new Color(0.8f, 0.5f, 0.5f); rect.height = fixedHeight; GUILayout.BeginArea(rect); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); string text = "DISABLED"; if (Provider.enabled) { if (Provider.onlineState == OnlineState.Updating) { GUI.color = new Color(0.8f, 0.8f, 0.5f); text = "CONNECTING..."; } else { text = "OFFLINE"; } } GUILayout.Label(text, EditorStyles.miniLabel, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndArea(); rect.y += rect.height; if (!string.IsNullOrEmpty(Provider.offlineReason)) { GUI.Label(rect, Provider.offlineReason); } GUI.color = color2; flag5 = false; } else { flag5 = !this.m_ShowIncoming ? flag4 | this.pendingList.OnGUI(rect, this.hasFocus) : flag4 | this.incomingList.OnGUI(rect, this.hasFocus); rect.y += rect.height; rect.height = 17f; GUI.Label(rect, GUIContent.none, WindowPending.s_Styles.bottomBarBg); GUIContent content = new GUIContent("Apply All Incoming Changes"); Vector2 vector2 = EditorStyles.miniButton.CalcSize(content); WindowPending.ProgressGUI(new Rect(rect.x, rect.y - 2f, (float)((double)rect.width - (double)vector2.x - 5.0), rect.height), Provider.activeTask, false); if (this.m_ShowIncoming) { Rect position = rect; position.width = vector2.x; position.height = vector2.y; position.y = rect.y + 2f; position.x = (float)((double)this.position.width - (double)vector2.x - 5.0); EditorGUI.BeginDisabledGroup(this.incomingList.Size == 0); if (GUI.Button(position, content, EditorStyles.miniButton)) { Asset asset = new Asset(string.Empty); AssetList assets = new AssetList(); assets.Add(asset); Provider.GetLatest(assets).SetCompletionAction(CompletionAction.OnGotLatestPendingWindow); } EditorGUI.EndDisabledGroup(); } } if (!flag5) { return; } this.Repaint(); }