This class containes information about the version control state of an asset.

Example #1
0
 public static void DrawOverlay(Asset asset, Asset metaAsset, Rect itemRect)
 {
   if (asset == null || metaAsset == null || Event.current.type != EventType.Repaint)
     return;
   string externalVersionControl = EditorSettings.externalVersionControl;
   if (externalVersionControl == ExternalVersionControl.Disabled || externalVersionControl == ExternalVersionControl.AutoDetect || (externalVersionControl == ExternalVersionControl.Generic || externalVersionControl == ExternalVersionControl.AssetServer))
     return;
   Overlay.DrawOverlays(asset, metaAsset, itemRect);
 }
Example #2
0
 private static void DrawOverlay(Asset.States state, Rect iconRect)
 {
   Rect atlasRectForState = Provider.GetAtlasRectForState((int) state);
   if ((double) atlasRectForState.width == 0.0)
     return;
   Texture2D overlayAtlas = Provider.overlayAtlas;
   if ((Object) overlayAtlas == (Object) null)
     return;
   GUI.DrawTextureWithTexCoords(iconRect, (Texture) overlayAtlas, atlasRectForState);
 }
Example #3
0
 public static void DrawOverlay(Asset asset, Asset metaAsset, Rect itemRect)
 {
     if (((asset != null) && (metaAsset != null)) && (Event.current.type == EventType.Repaint))
     {
         string externalVersionControl = EditorSettings.externalVersionControl;
         if (((externalVersionControl != ExternalVersionControl.Disabled) && (externalVersionControl != ExternalVersionControl.AutoDetect)) && ((externalVersionControl != ExternalVersionControl.Generic) && (externalVersionControl != ExternalVersionControl.AssetServer)))
         {
             DrawOverlays(asset, metaAsset, itemRect);
         }
     }
 }
Example #4
0
 private static void DrawOverlay(Asset.States state, Rect iconRect)
 {
     Rect atlasRectForState = Provider.GetAtlasRectForState((int) state);
     if (atlasRectForState.width != 0f)
     {
         Texture2D overlayAtlas = Provider.overlayAtlas;
         if (overlayAtlas != null)
         {
             GUI.DrawTextureWithTexCoords(iconRect, overlayAtlas, atlasRectForState);
         }
     }
 }
Example #5
0
    public static void Revert(string path)
    {
#if UNITY_VC
        if (HasVC())
        {
            UnityEditor.VersionControl.Asset vcAsset = UnityEditor.VersionControl.Provider.GetAssetByPath(path);
            if (vcAsset != null)
            {
                UnityEditor.VersionControl.Task task = UnityEditor.VersionControl.Provider.Revert(vcAsset, UnityEditor.VersionControl.RevertMode.Normal);
                task.Wait();
                AssetDatabase.Refresh();
            }
        }
#endif
    }
Example #6
0
    public static bool IsEditable(string path)
    {
#if UNITY_VC
        if (HasVC())
        {
            UnityEditor.VersionControl.Asset vcAsset = UnityEditor.VersionControl.Provider.GetAssetByPath(path);
            return(vcAsset != null?UnityEditor.VersionControl.Provider.IsOpenForEdit(vcAsset) : true);
        }
        else
        {
            return(true);
        }
#else
        return(true);
#endif
    }
Example #7
0
    public static bool CheckOut(string path)
    {
#if UNITY_VC
        if (HasVC())
        {
            UnityEditor.VersionControl.Asset vcAsset = UnityEditor.VersionControl.Provider.GetAssetByPath(path);
            if (vcAsset != null)
            {
                UnityEditor.VersionControl.Task task = UnityEditor.VersionControl.Provider.Checkout(vcAsset, UnityEditor.VersionControl.CheckoutMode.Both);
                task.Wait();
            }
        }
        return(IsEditable(path));
#else
        return(true);
#endif
    }
Example #8
0
 public ListItem Add(ListItem parent, string name, Asset asset)
 {
     ListItem item = (parent == null) ? this.root : parent;
     ListItem listItem = new ListItem {
         Name = name,
         Asset = asset
     };
     item.Add(listItem);
     ListItem twinAsset = this.GetTwinAsset(listItem);
     if (((twinAsset != null) && (listItem.Asset != null)) && (twinAsset.Asset.state == (listItem.Asset.state & ~Asset.States.MetaFile)))
     {
         listItem.Hidden = true;
     }
     if ((listItem.Asset != null) && (listItem.Asset.path.Length > 0))
     {
         this.pathSearch[listItem.Asset.path.ToLower()] = listItem;
     }
     return listItem;
 }
Example #9
0
		public static void DrawOverlay(Asset asset, Rect itemRect)
		{
			if (asset == null)
			{
				return;
			}
			if (Event.current.type != EventType.Repaint)
			{
				return;
			}
			Overlay.m_Asset = asset;
			Overlay.m_ItemRect = itemRect;
			Overlay.m_IconPrefix = EditorSettings.externalVersionControl;
			if (Overlay.m_IconPrefix == ExternalVersionControl.Disabled || Overlay.m_IconPrefix == ExternalVersionControl.AutoDetect || Overlay.m_IconPrefix == ExternalVersionControl.Generic || Overlay.m_IconPrefix == ExternalVersionControl.AssetServer)
			{
				return;
			}
			Overlay.DrawOverlays();
		}
 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();
 }
Example #11
0
		public ListItem Add(ListItem parent, string name, Asset asset)
		{
			ListItem listItem = (parent == null) ? this.root : parent;
			ListItem listItem2 = new ListItem();
			listItem2.Name = name;
			listItem2.Asset = asset;
			listItem.Add(listItem2);
			if (listItem2.Asset == null)
			{
				return listItem2;
			}
			if (listItem2.Asset.path.Length > 0)
			{
				this.pathSearch[listItem2.Asset.path.ToLower()] = listItem2;
			}
			return listItem2;
		}
Example #12
0
 /// <summary>
 /// <para>Returns true if locking the assets is a valid operation.</para>
 /// </summary>
 /// <param name="assets">The assets to lock.</param>
 /// <param name="asset">The asset to lock.</param>
 public static bool UnlockIsValid(Asset asset)
 {
     Asset[] assets = new Asset[] { asset };
     return Internal_UnlockIsValid(assets);
 }
Example #13
0
 /// <summary>
 /// <para>Start a task that will fetch the most recent status from revision control system.</para>
 /// </summary>
 /// <param name="assets">The assets fetch new state for.</param>
 /// <param name="asset">The asset path to fetch new state for.</param>
 /// <param name="recursively">If any assets specified are folders this flag will get status for all descendants of the folder as well.</param>
 public static Task Status(Asset asset)
 {
     Asset[] assets = new Asset[] { asset };
     return Internal_Status(assets, true);
 }
Example #14
0
 /// <summary>
 /// <para>Return true if Revert is a valid task to perform.</para>
 /// </summary>
 /// <param name="assets">List of assets to test.</param>
 /// <param name="mode">Revert mode to test for.</param>
 /// <param name="asset">Asset to test.</param>
 public static bool RevertIsValid(Asset asset, RevertMode mode)
 {
     Asset[] assets = new Asset[] { asset };
     return Internal_RevertIsValid(assets, mode);
 }
Example #15
0
 internal static string AllStateToString(Asset.States state)
 {
   StringBuilder stringBuilder = new StringBuilder();
   if (Asset.IsState(state, Asset.States.AddedLocal))
     stringBuilder.AppendLine("Added Local");
   if (Asset.IsState(state, Asset.States.AddedRemote))
     stringBuilder.AppendLine("Added Remote");
   if (Asset.IsState(state, Asset.States.CheckedOutLocal))
     stringBuilder.AppendLine("Checked Out Local");
   if (Asset.IsState(state, Asset.States.CheckedOutRemote))
     stringBuilder.AppendLine("Checked Out Remote");
   if (Asset.IsState(state, Asset.States.Conflicted))
     stringBuilder.AppendLine("Conflicted");
   if (Asset.IsState(state, Asset.States.DeletedLocal))
     stringBuilder.AppendLine("Deleted Local");
   if (Asset.IsState(state, Asset.States.DeletedRemote))
     stringBuilder.AppendLine("Deleted Remote");
   if (Asset.IsState(state, Asset.States.Local))
     stringBuilder.AppendLine("Local");
   if (Asset.IsState(state, Asset.States.LockedLocal))
     stringBuilder.AppendLine("Locked Local");
   if (Asset.IsState(state, Asset.States.LockedRemote))
     stringBuilder.AppendLine("Locked Remote");
   if (Asset.IsState(state, Asset.States.OutOfSync))
     stringBuilder.AppendLine("Out Of Sync");
   if (Asset.IsState(state, Asset.States.Synced))
     stringBuilder.AppendLine("Synced");
   if (Asset.IsState(state, Asset.States.Missing))
     stringBuilder.AppendLine("Missing");
   if (Asset.IsState(state, Asset.States.ReadOnly))
     stringBuilder.AppendLine("ReadOnly");
   return stringBuilder.ToString();
 }
Example #16
0
 internal static bool IsState(Asset.States isThisState, Asset.States partOfThisState)
 {
   return (isThisState & partOfThisState) != Asset.States.None;
 }
Example #17
0
 public static extern bool IsOpenForEdit([NotNull] Asset asset);
Example #18
0
 public static Task Checkout(Asset asset, CheckoutMode mode)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_Checkout(assets, mode));
 }
Example #19
0
 public static bool UnlockIsValid(Asset asset)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_UnlockIsValid(assets));
 }
Example #20
0
 public static Task Status(Asset asset, bool recursively)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_Status(assets, recursively));
 }
Example #21
0
 public static Task Status(Asset asset)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_Status(assets, true));
 }
Example #22
0
 public extern bool IsChildOf(Asset other);
Example #23
0
 public static bool CheckoutIsValid(Asset asset)
 {
     return(Provider.CheckoutIsValid(asset, CheckoutMode.Exact));
 }
Example #24
0
 public bool HasPath()
 {
     UnityEditor.VersionControl.Asset item = this.item as UnityEditor.VersionControl.Asset;
     return((item != null) && (item.path != null));
 }
        // Editor window GUI paint
        void OnGUI()
        {
            InitStyles();

            if (!s_DidReload)
            {
                s_DidReload = true;
                UpdateWindow();
            }

            CreateResources();

            float toolBarHeight = EditorStyles.toolbar.fixedHeight;
            bool  refresh       = false;

            GUILayout.BeginArea(new Rect(0, 0, position.width, toolBarHeight));

            GUILayout.BeginHorizontal(EditorStyles.toolbar);

            EditorGUI.BeginChangeCheck();

            int  incomingChangesetCount = incomingList.Root == null ? 0 : incomingList.Root.ChildCount;
            bool switchToOutgoing       = GUILayout.Toggle(!m_ShowIncoming, "Outgoing", EditorStyles.toolbarButton);

            GUIContent cont             = GUIContent.Temp("Incoming" + (incomingChangesetCount == 0 ? "" : " (" + incomingChangesetCount + ")"));
            bool       switchToIncoming = GUILayout.Toggle(m_ShowIncoming, cont, EditorStyles.toolbarButton);

            m_ShowIncoming = m_ShowIncoming ? !switchToOutgoing : switchToIncoming;

            if (EditorGUI.EndChangeCheck())
            {
                refresh = true;
            }

            GUILayout.FlexibleSpace();

            Event e = Event.current;

            SearchField(e, m_ShowIncoming ? incomingList : pendingList);

            // Global context custom commands goes here
            using (new EditorGUI.DisabledScope(Provider.activeTask != null))
            {
                foreach (CustomCommand c in Provider.customCommands)
                {
                    if (c.context == CommandContext.Global && GUILayout.Button(c.label, EditorStyles.toolbarButton))
                    {
                        c.StartTask();
                    }
                }
            }

            bool showDeleteEmptyChangesetsButton =
                Mathf.FloorToInt(position.width - s_ToolbarButtonsWidth - k_MinSearchFieldWidth - s_SettingsButtonWidth - s_DeleteChangesetsButtonWidth) > 0 &&
                HasEmptyPendingChangesets();

            if (showDeleteEmptyChangesetsButton && GUILayout.Button("Delete Empty Changesets", EditorStyles.toolbarButton))
            {
                DeleteEmptyPendingChangesets();
            }

            bool showSettingsButton = Mathf.FloorToInt(position.width - s_ToolbarButtonsWidth - k_MinSearchFieldWidth - s_SettingsButtonWidth) > 0;

            if (showSettingsButton && GUILayout.Button(Styles.editorSettingsLabel, EditorStyles.toolbarButton))
            {
                SettingsService.OpenProjectSettings("Project/Version Control");
                EditorWindow.FocusWindowIfItsOpen <InspectorWindow>();
                GUIUtility.ExitGUI();
            }

            bool refreshButtonClicked = GUILayout.Button(refreshIcon, EditorStyles.toolbarButton);

            refresh = refresh || refreshButtonClicked || scheduleRefresh;

            bool repaint = false;

            if (refresh)
            {
                if (refreshButtonClicked)
                {
                    m_SearchText = string.Empty;
                    GUI.FocusControl(null);
                    Provider.InvalidateCache();
                    Provider.UpdateSettings();
                }

                repaint         = true;
                scheduleRefresh = false;
                UpdateWindow();
            }

            GUILayout.EndArea();

            Rect rect = new Rect(0, toolBarHeight, position.width, position.height - toolBarHeight - k_BottomBarHeight);

            GUILayout.EndHorizontal();

            if (EditorUserSettings.WorkOffline)
            {
                GUI.color   = new Color(0.8f, 0.5f, 0.5f);
                rect.height = toolBarHeight;
                GUILayout.BeginArea(rect);

                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                GUILayout.FlexibleSpace();

                GUILayout.Label(Styles.workOfflineLabel, EditorStyles.miniLabel);

                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }
            // Disabled Window view
            else if (!Provider.isActive)
            {
                Color tmpColor = GUI.color;
                GUI.color   = new Color(0.8f, 0.5f, 0.5f);
                rect.height = toolBarHeight;
                GUILayout.BeginArea(rect);

                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                GUILayout.FlexibleSpace();

                if (Provider.enabled)
                {
                    if (Provider.onlineState == OnlineState.Updating)
                    {
                        GUI.color = new Color(0.8f, 0.8f, 0.5f);
                        GUILayout.Label(Styles.connectingLabel, EditorStyles.miniLabel);
                    }
                    else
                    {
                        GUILayout.Label(Styles.offlineLabel, EditorStyles.miniLabel);
                    }
                }
                else
                {
                    GUILayout.Label(Styles.disabledLabel, EditorStyles.miniLabel);
                }

                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.EndArea();

                rect.y += rect.height;
                if (!string.IsNullOrEmpty(Provider.offlineReason))
                {
                    GUI.Label(rect, Provider.offlineReason);
                }

                GUI.color = tmpColor;
                repaint   = false;
            }
            else
            {
                if (m_ShowIncoming)
                {
                    repaint |= incomingList.OnGUI(rect, hasFocus);
                }
                else
                {
                    repaint |= pendingList.OnGUI(rect, hasFocus);
                }


                rect.y     += rect.height;
                rect.height = k_BottomBarHeight;

                // Draw separation line over the button
                GUI.Label(rect, GUIContent.none, s_Styles.bottomBarBg);

                var  content      = EditorGUIUtility.TrTextContent("Apply All Incoming Changes");
                var  buttonSize   = EditorStyles.miniButton.CalcSize(content);
                Rect progressRect = new Rect(rect.x, rect.y - 2, rect.width - buttonSize.x - 5f, rect.height);
                ProgressGUI(progressRect, Provider.activeTask, false);

                if (m_ShowIncoming)
                {
                    // Draw "apply incoming" button
                    var buttonRect = rect;
                    buttonRect.width  = buttonSize.x;
                    buttonRect.height = buttonSize.y;
                    buttonRect.y      = rect.y + 2f;
                    buttonRect.x      = position.width - buttonSize.x - 5f;

                    using (new EditorGUI.DisabledScope(incomingList?.Root?.VisibleChildCount == 0))
                    {
                        if (GUI.Button(buttonRect, content, EditorStyles.miniButton))
                        {
                            Asset root = new Asset("");
                            Task  t    = Provider.GetLatest(new AssetList()
                            {
                                root
                            });
                            t.SetCompletionAction(CompletionAction.OnGotLatestPendingWindow);
                        }
                    }
                }
            }

            if (m_ShowIncoming != m_ShowIncomingPrevious)
            {
                (m_ShowIncoming ? incomingList : pendingList).Filter = m_SearchText;
                m_ShowIncomingPrevious = m_ShowIncoming;
            }

            if (repaint)
            {
                Repaint();
            }
        }
Example #26
0
 public bool IsOneOfStates(Asset.States[] states)
 {
   foreach (Asset.States state in states)
   {
     if ((this.state & state) != Asset.States.None)
       return true;
   }
   return false;
 }
Example #27
0
 public static Task Revert(Asset asset, RevertMode mode)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_Revert(assets, mode));
 }
Example #28
0
 public static Task ChangeSetMove(Asset asset, ChangeSet changeset)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_ChangeSetMove(assets, changeset));
 }
Example #29
0
 public static Task Lock(Asset asset, bool locked)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_Lock(assets, locked));
 }
Example #30
0
 /// <summary>
 /// <para>Move an asset or list of assets from their current changeset to a new changeset.</para>
 /// </summary>
 /// <param name="assets">List of asset to move to changeset.</param>
 /// <param name="changeset">Changeset to move asset to.</param>
 /// <param name="asset">Asset to move to changeset.</param>
 /// <param name="changesetID">ChangesetID to move asset to.</param>
 public static Task ChangeSetMove(Asset asset, string changesetID)
 {
     ChangeSet target = new ChangeSet("", changesetID);
     Asset[] assets = new Asset[] { asset };
     return Internal_ChangeSetMove(assets, target);
 }
Example #31
0
 public static extern bool IsOpenForEdit(Asset asset);
Example #32
0
 /// <summary>
 /// <para>Start a task that will fetch the most recent status from revision control system.</para>
 /// </summary>
 /// <param name="assets">The assets fetch new state for.</param>
 /// <param name="asset">The asset path to fetch new state for.</param>
 /// <param name="recursively">If any assets specified are folders this flag will get status for all descendants of the folder as well.</param>
 public static Task Status(Asset asset, bool recursively)
 {
     Asset[] assets = new Asset[] { asset };
     return Internal_Status(assets, recursively);
 }
Example #33
0
 public static bool GetLatestIsValid(Asset asset)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_GetLatestIsValid(assets));
 }
Example #34
0
 /// <summary>
 /// <para>Move an asset or list of assets from their current changeset to a new changeset.</para>
 /// </summary>
 /// <param name="assets">List of asset to move to changeset.</param>
 /// <param name="changeset">Changeset to move asset to.</param>
 /// <param name="asset">Asset to move to changeset.</param>
 /// <param name="changesetID">ChangesetID to move asset to.</param>
 public static Task ChangeSetMove(Asset asset, ChangeSet changeset)
 {
     Asset[] assets = new Asset[] { asset };
     return Internal_ChangeSetMove(assets, changeset);
 }
Example #35
0
 public static Task GetLatest(Asset asset)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_GetLatest(assets));
 }
 private void OnExpandIncoming(ChangeSet change, ListItem item)
 {
   if (!Provider.isActive)
     return;
   Task task = Provider.IncomingChangeSetAssets(change);
   task.userIdentifier = item.Identifier;
   task.SetCompletionAction(CompletionAction.OnChangeContentsPendingWindow);
   if (item.HasChildren)
     return;
   Asset asset = new Asset("Updating...");
   this.incomingList.Add(item, asset.prettyPath, asset).Dummy = true;
   this.incomingList.Refresh(false);
   this.Repaint();
 }
Example #37
0
 public static Task Delete(Asset asset)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_Delete(assets));
 }
 public ListItem Add(ListItem parent, string name, Asset asset)
 {
   ListItem listItem1 = parent == null ? this.root : parent;
   ListItem listItem2 = new ListItem();
   listItem2.Name = name;
   listItem2.Asset = asset;
   listItem1.Add(listItem2);
   ListItem twinAsset = this.GetTwinAsset(listItem2);
   if (twinAsset != null && listItem2.Asset != null && twinAsset.Asset.state == (listItem2.Asset.state & ~Asset.States.MetaFile))
     listItem2.Hidden = true;
   if (listItem2.Asset == null || listItem2.Asset.path.Length <= 0)
     return listItem2;
   this.pathSearch[listItem2.Asset.path.ToLower()] = listItem2;
   return listItem2;
 }
		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;
			GUILayout.BeginArea(new Rect(0f, 0f, base.position.width, fixedHeight));
			GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
			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]);
			GUIContent content = GUIContent.Temp("Incoming" + ((num != 0) ? (" (" + num.ToString() + ")") : string.Empty));
			this.m_ShowIncoming = GUILayout.Toggle(this.m_ShowIncoming, content, EditorStyles.toolbarButton, new GUILayoutOption[0]);
			GUILayout.FlexibleSpace();
			EditorGUI.BeginDisabledGroup(Provider.activeTask != null);
			CustomCommand[] customCommands = Provider.customCommands;
			for (int i = 0; i < customCommands.Length; i++)
			{
				CustomCommand customCommand = customCommands[i];
				if (customCommand.context == CommandContext.Global && GUILayout.Button(customCommand.label, EditorStyles.toolbarButton, new GUILayoutOption[0]))
				{
					customCommand.StartTask();
				}
			}
			EditorGUI.EndDisabledGroup();
			bool flag = Mathf.FloorToInt(base.position.width - this.s_ToolbarButtonsWidth) > 0;
			if (flag && GUILayout.Button("Settings", EditorStyles.toolbarButton, new GUILayoutOption[0]))
			{
				EditorApplication.ExecuteMenuItem("Edit/Project Settings/Editor");
				EditorWindow.FocusWindowIfItsOpen<InspectorWindow>();
				GUIUtility.ExitGUI();
			}
			Color color = GUI.color;
			GUI.color = new Color(1f, 1f, 1f, 0.5f);
			bool flag2 = GUILayout.Button(this.refreshIcon, EditorStyles.toolbarButton, new GUILayoutOption[0]);
			GUI.color = color;
			if (current.isKey && GUIUtility.keyboardControl == 0 && current.type == EventType.KeyDown && current.keyCode == KeyCode.F5)
			{
				flag2 = true;
				current.Use();
			}
			if (flag2)
			{
				Provider.InvalidateCache();
				if (Provider.isActive && Provider.onlineState == OnlineState.Online)
				{
					Task task = Provider.ChangeSets();
					task.SetCompletionAction(CompletionAction.OnChangeSetsPendingWindow);
					Task task2 = Provider.Incoming();
					task2.SetCompletionAction(CompletionAction.OnIncomingPendingWindow);
				}
				else
				{
					Provider.UpdateSettings();
				}
			}
			GUILayout.EndArea();
			Rect rect = new Rect(0f, fixedHeight, base.position.width, base.position.height - fixedHeight - 17f);
			bool flag3 = false;
			GUILayout.EndHorizontal();
			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;
				flag3 = false;
			}
			else
			{
				if (this.m_ShowIncoming)
				{
					flag3 |= this.incomingList.OnGUI(rect, base.hasFocus);
				}
				else
				{
					flag3 |= this.pendingList.OnGUI(rect, base.hasFocus);
				}
				rect.y += rect.height;
				rect.height = 17f;
				GUI.Label(rect, GUIContent.none, WindowPending.s_Styles.bottomBarBg);
				GUIContent content2 = new GUIContent("Apply All Incoming Changes");
				Vector2 vector = EditorStyles.miniButton.CalcSize(content2);
				Rect rect2 = new Rect(rect.x, rect.y - 2f, rect.width - vector.x - 5f, rect.height);
				WindowPending.ProgressGUI(rect2, Provider.activeTask, false);
				if (this.m_ShowIncoming)
				{
					Rect position = rect;
					position.width = vector.x;
					position.height = vector.y;
					position.y = rect.y + 2f;
					position.x = base.position.width - vector.x - 5f;
					EditorGUI.BeginDisabledGroup(this.incomingList.Size == 0);
					if (GUI.Button(position, content2, EditorStyles.miniButton))
					{
						Asset item = new Asset(string.Empty);
						Task latest = Provider.GetLatest(new AssetList
						{
							item
						});
						latest.SetCompletionAction(CompletionAction.OnGotLatestPendingWindow);
					}
					EditorGUI.EndDisabledGroup();
				}
			}
			if (flag3)
			{
				base.Repaint();
			}
		}
		private void DrawOverlayDescription(Asset.States state)
		{
			Rect atlasRectForState = Provider.GetAtlasRectForState((int)state);
			if (atlasRectForState.width == 0f)
			{
				return;
			}
			Texture2D overlayAtlas = Provider.overlayAtlas;
			if (overlayAtlas == null)
			{
				return;
			}
			GUILayout.Label("    " + Asset.StateToString(state), EditorStyles.miniLabel, new GUILayoutOption[0]);
			Rect lastRect = GUILayoutUtility.GetLastRect();
			lastRect.width = 16f;
			GUI.DrawTextureWithTexCoords(lastRect, overlayAtlas, atlasRectForState);
		}
Example #41
0
 public static bool CheckoutIsValid(Asset asset, CheckoutMode mode)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_CheckoutIsValid(assets, mode));
 }
Example #42
0
 public bool IsChildOf(Asset other);
Example #43
0
 public static extern bool IsOpenForEdit(Asset asset);
Example #44
0
 public bool IsState(Asset.States state)
 {
   return Asset.IsState(this.state, state);
 }
Example #45
0
 /// <summary>
 /// <para>Attempt to lock an asset for exclusive editing.</para>
 /// </summary>
 /// <param name="assets">List of assets to lock/unlock.</param>
 /// <param name="locked">True to lock assets, false to unlock assets.</param>
 /// <param name="asset">Asset to lock/unlock.</param>
 public static Task Lock(Asset asset, bool locked)
 {
     Asset[] assets = new Asset[] { asset };
     return Internal_Lock(assets, locked);
 }
Example #46
0
 internal static string StateToString(Asset.States state)
 {
   if (Asset.IsState(state, Asset.States.AddedLocal))
     return "Added Local";
   if (Asset.IsState(state, Asset.States.AddedRemote))
     return "Added Remote";
   if (Asset.IsState(state, Asset.States.CheckedOutLocal) && !Asset.IsState(state, Asset.States.LockedLocal))
     return "Checked Out Local";
   if (Asset.IsState(state, Asset.States.CheckedOutRemote) && !Asset.IsState(state, Asset.States.LockedRemote))
     return "Checked Out Remote";
   if (Asset.IsState(state, Asset.States.Conflicted))
     return "Conflicted";
   if (Asset.IsState(state, Asset.States.DeletedLocal))
     return "Deleted Local";
   if (Asset.IsState(state, Asset.States.DeletedRemote))
     return "Deleted Remote";
   if (Asset.IsState(state, Asset.States.Local))
     return "Local";
   if (Asset.IsState(state, Asset.States.LockedLocal))
     return "Locked Local";
   if (Asset.IsState(state, Asset.States.LockedRemote))
     return "Locked Remote";
   if (Asset.IsState(state, Asset.States.OutOfSync))
     return "Out Of Sync";
   return string.Empty;
 }
Example #47
0
 /// <summary>
 /// <para>Reverts the specified assets by undoing any changes done since last time you synced.</para>
 /// </summary>
 /// <param name="assets">The list of assets to be reverted.</param>
 /// <param name="mode">How to revert the assets.</param>
 /// <param name="asset">The asset to be reverted.</param>
 public static Task Revert(Asset asset, RevertMode mode)
 {
     Asset[] assets = new Asset[] { asset };
     return Internal_Revert(assets, mode);
 }
Example #48
0
 private static extern bool Internal_UnlockIsValid(Asset[] assets);
Example #49
0
 public static bool RevertIsValid(Asset asset, RevertMode mode)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_RevertIsValid(assets, mode));
 }
		private void OnExpand(ChangeSet change, ListItem item)
		{
			if (!Provider.isActive)
			{
				return;
			}
			Task task = Provider.ChangeSetStatus(change);
			task.userIdentifier = item.Identifier;
			task.SetCompletionAction(CompletionAction.OnChangeContentsPendingWindow);
			if (!item.HasChildren)
			{
				Asset asset = new Asset("Updating...");
				ListItem listItem = this.pendingList.Add(item, asset.prettyPath, asset);
				listItem.Dummy = true;
				this.pendingList.Refresh(false);
				base.Repaint();
			}
		}
Example #51
0
 public static Task Add(Asset asset, bool recursive)
 {
     Asset[] assets = new Asset[] { asset };
     return(Internal_Add(assets, recursive));
 }