Exemplo n.º 1
0
    public static string GetObjectTypeName(Object obj)
    {
        string objectType = "Unknown Type";

        if (SVNUtility.IsPrefab(obj, false, true, true))
        {
            objectType = "Model";
        }
        if (SVNUtility.IsPrefab(obj, true, false, true))
        {
            objectType = "Prefab";
        }
        if (!SVNUtility.IsPrefab(obj, true, true, true))
        {
            objectType = "Scene";
        }

        if (SVNUtility.IsPrefabParent(obj))
        {
            objectType += " Asset";
        }
        else if (SVNUtility.IsPrefabRoot(obj))
        {
            objectType += " Root";
        }
        else
        {
            objectType += " Child";
        }

        return(objectType);
    }
Exemplo n.º 2
0
    public static string GetLockStatusMessage(SVNStatus svnStatus)
    {
        string prefabLockMessage = svnStatus.lockStatus.ToString();

        if (svnStatus.lockStatus == ESVNLockStatus.LockedOther)
        {
            prefabLockMessage = SVNTerminoligy.getlock + " by: " + svnStatus.owner;
        }
        if (svnStatus.lockStatus == ESVNLockStatus.LockedHere)
        {
            prefabLockMessage = SVNTerminoligy.getlock + " Here: " + svnStatus.owner;
        }
        if (svnStatus.lockStatus == ESVNLockStatus.NoLock)
        {
            prefabLockMessage = SVNUtility.ManagedByRepository(svnStatus) ? "Not " + SVNTerminoligy.getlock : "Not on SVN";
        }
        if (svnStatus.bypassRevisionControl)
        {
            prefabLockMessage = SVNTerminoligy.bypass;
            if ((svnStatus.lockStatus == ESVNLockStatus.LockedOther))
            {
                prefabLockMessage += " (" + SVNTerminoligy.getlock + " By: " + svnStatus.owner + " )";
            }
        }
        return(prefabLockMessage);
    }
Exemplo n.º 3
0
    static void SVNForceGetLockGameobjectContext(MenuCommand command)
    {
        string    assetPath = SVNUtility.GetAssetPath(command.context);
        SVNStatus svnStatus = SVNCommands.instance.GetAssetStatus(assetPath);

        if (svnStatus.lockStatus == ESVNLockStatus.LockedOther)
        {
            if (EditorUtility.DisplayDialog("Force " + SVNTerminoligy.getlock, "Are you sure you will steal the file from: [" + svnStatus.owner + "]", "Yes", "Cancel"))
            {
                SVNCommands.instance.SVNGetLock(new[] { assetPath }, true, false);
            }
        }
    }
    void DrawSVNStatusGUI()
    {
        SVNUtility.RefreshEditableObject(mGameObject);

        //GUILayout.Label("prefab type: " + EditorUtility.GetPrefabType(gameObject) + " svn: " + svnStatus.lockStatus);
        EditorGUILayout.BeginHorizontal();
        bool   isModified  = mSVNStatus.fileStatus == ESVNFileStatus.Modified;
        string labelPrefix = "";

        labelPrefix += (isModified ? "*" : "");
        labelPrefix += "[" + SVNGUIControls.GetObjectTypeName(mGameObject) + "] ";
        labelPrefix += SVNGUIControls.GetLockStatusMessage(mSVNStatus);
        var labelContent = new GUIContent(labelPrefix, mAssetpath);

        GUILayout.Label(labelContent, SVNGUIControls.GetLockStatusStyle(mSVNStatus));
        EditorGUILayout.EndHorizontal();
    }
Exemplo n.º 5
0
    public static void SVNStatusGUI(GUIStyle style, SVNStatus svnStatus, Object obj, bool showAddCommit, bool showLockBypass, bool showRevert)
    {
        bool svnBusy = SVNCommands.instance.svnBusy;

        using (new PushState <bool>(GUI.enabled, !svnBusy, v => GUI.enabled = v))
        {
            if (svnStatus.lockStatus == ESVNLockStatus.LockedHere || svnStatus.bypassRevisionControl || !SVNUtility.ManagedByRepository(svnStatus))
            {
                if (!svnStatus.bypassRevisionControl && SVNUtility.GetAssetPath(obj) != "" && showAddCommit)
                {
                    if (GUILayout.Button((SVNUtility.ManagedByRepository(svnStatus) ? SVNTerminoligy.commit : SVNTerminoligy.add), GetPrefabToolbarStyle(style, true)))
                    {
                        SVNUtility.CommitPrefab(obj, SVNTerminoligy.commit + " from Inspector");
                    }
                }
            }

            if (!SVNUtility.HaveSVNLock(svnStatus) && SVNUtility.ManagedByRepository(svnStatus) && showLockBypass)
            {
                if (svnStatus.lockStatus != ESVNLockStatus.LockedOther)
                {
                    if (GUILayout.Button(SVNTerminoligy.getlock, GetPrefabToolbarStyle(style, true)))
                    {
                        SVNUtility.GetSVNLock(obj);
                    }
                }
                if (!svnStatus.bypassRevisionControl)
                {
                    if (GUILayout.Button(SVNTerminoligy.bypass, GetPrefabToolbarStyle(style, true)))
                    {
                        SVNUtility.SetBypass(obj);
                    }
                }
            }

            if (showRevert)
            {
                if (GUILayout.Button(SVNTerminoligy.revert, GetPrefabToolbarStyle(style, SVNUtility.ShouldSVNRevert(obj))))
                {
                    SVNUtility.Revert(obj);
                }
            }
        }
    }
    void DrawPrefabGUI()
    {
        var prefabType   = EditorUtility.GetPrefabType(mGameObject);
        var prefabParent = EditorUtility.GetPrefabParent(mGameObject) as GameObject;

        EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
        GUIStyle buttonStyle    = EditorStyles.toolbarButton;
        bool     showAddCommit  = SVNUtility.IsPrefab(mGameObject, true, false, false);
        bool     showLockByPass = SVNUtility.IsPrefab(mGameObject, true, false, false);
        bool     showRevert     = SVNUtility.IsPrefab(mGameObject) && SVNUtility.HaveAssetControl(mSVNStatus);

        SVNGUIControls.SVNStatusGUI(buttonStyle, mSVNStatus, mGameObject, showAddCommit, showLockByPass, showRevert);
        if (!SVNUtility.IsPrefabParent(mGameObject))
        {
            if (SVNUtility.IsPrefab(mGameObject, true, false, true)) // non-model prefabs
            {
                if (GUILayout.Button("Apply", buttonStyle))
                {
                    SVNUtility.ApplyPrefab(mGameObject);
                    SVNCommands.UpdateLocalSVNStatus();
                }
            }
            if (SVNUtility.IsPrefab(mGameObject, true, false, true)) // non-model prefabs
            {
                if (GUILayout.Button("Disconnect", buttonStyle))
                {
                    SVNUtility.DisconnectPrefab(mGameObject);
                }
            }
            if (prefabParent != null) // has a prefab parent (prefab on disk)
            {
                if (GUILayout.Button("Select", buttonStyle))
                {
                    SVNUtility.SelectPrefab(mGameObject);
                }
            }
        }
        EditorGUILayout.EndHorizontal();
    }
Exemplo n.º 7
0
 public static Texture2D GetSVNBackgroundTexture(SVNStatus svnStatus)
 {
     if (svnStatus.bypassRevisionControl)
     {
         return(BackgroundTextures.instance.bypassTexture);
     }
     if (SVNUtility.ManagedByRepository(svnStatus))
     {
         if (svnStatus.lockStatus == ESVNLockStatus.NoLock)
         {
             return(BackgroundTextures.instance.noLockTexture);
         }
         if (svnStatus.lockStatus == ESVNLockStatus.LockedHere)
         {
             return(BackgroundTextures.instance.lockedTexture);
         }
         if (svnStatus.lockStatus == ESVNLockStatus.LockedOther)
         {
             return(BackgroundTextures.instance.lockedByOtherTexture);
         }
     }
     return(BackgroundTextures.instance.noSVNTexture);
 }
Exemplo n.º 8
0
 public static void SVNBypassLockGameobjectContext(MenuCommand command)
 {
     SVNCommands.SVNBypassRevision(new[] { SVNUtility.GetAssetPath(command.context) });
 }
Exemplo n.º 9
0
 static void SVNRevertGameobjectContext(MenuCommand command)
 {
     SVNCommands.instance.SVNRevert(new[] { SVNUtility.GetAssetPath(command.context) });
 }
Exemplo n.º 10
0
 static void SVNGetLockGameobjectContext(MenuCommand command)
 {
     SVNCommands.instance.SVNGetLock(new[] { SVNUtility.GetAssetPath(command.context) }, false);
 }
Exemplo n.º 11
0
 void RefreshFromDatabase()
 {
     mAssetpath = SVNUtility.GetAssetPath(mGameObject);
     mSVNStatus = SVNCommands.instance.GetAssetStatus(mAssetpath);
     //Debug.Log("Refresh from database: " + mAssetpath + " " + mSVNStatus.lockStatus);
 }