Beispiel #1
0
        internal static void Initlize()
        {
            repoPathCached = Application.dataPath.Replace("/Assets", "").Replace("/", "\\");
            gitPathCached  = Application.dataPath.Replace("Assets", ".git");

            if (!IsValidRepo)
            {
                return;
            }

            LoadGitSettings();

            GitResourceManager.Initilize();
            GitCredentialsManager.Load();
            GitOverlay.Initlize();
            GitLfsManager.Load();
            GitHookManager.Load();
            GitExternalManager.Load();

            needsFetch                 = !EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isCompiling && !EditorApplication.isUpdating;
            repositoryDirty            = true;
            GitCallbacks.EditorUpdate += OnEditorUpdate;
        }
Beispiel #2
0
        internal static void Initlize()
        {
            repoPathCached = Application.dataPath.Replace("/Assets", "").Replace("/", "\\");

            if (!IsValidRepo)
            {
                return;
            }

            gitCredentials = EditorGUIUtility.Load("UniGit/Git-Credentials.asset") as GitCredentials;
            gitSettings    = EditorGUIUtility.Load("UniGit/Git-Settings.asset") as GitSettings;
            if (gitSettings == null)
            {
                gitSettings = ScriptableObject.CreateInstance <GitSettings>();
                AssetDatabase.CreateAsset(gitSettings, "Assets/Editor Default Resources/UniGit/Git-Settings.asset");
                AssetDatabase.SaveAssets();
            }

            if (IconStyle == null)
            {
                IconStyle = new GUIStyle
                {
                    imagePosition = ImagePosition.ImageOnly,
                    alignment     = TextAnchor.LowerLeft,
                    padding       = new RectOffset(2, 2, 2, 2)
                };
            }

            if (icons == null)
            {
                icons = new Icons()
                {
                    validIcon          = EditorGUIUtility.IconContent("UniGit/success"),
                    validIconSmall     = EditorGUIUtility.IconContent("UniGit/success_small"),
                    modifiedIcon       = EditorGUIUtility.IconContent("UniGit/error"),
                    modifiedIconSmall  = EditorGUIUtility.IconContent("UniGit/error_small"),
                    addedIcon          = EditorGUIUtility.IconContent("UniGit/add"),
                    addedIconSmall     = EditorGUIUtility.IconContent("UniGit/add_small"),
                    untrackedIcon      = EditorGUIUtility.IconContent("UniGit/info"),
                    untrackedIconSmall = EditorGUIUtility.IconContent("UniGit/info_small"),
                    ignoredIcon        = EditorGUIUtility.IconContent("UniGit/minus"),
                    ignoredIconSmall   = EditorGUIUtility.IconContent("UniGit/minus_small"),
                    conflictIcon       = EditorGUIUtility.IconContent("UniGit/warning"),
                    conflictIconSmall  = EditorGUIUtility.IconContent("UniGit/warning_small"),
                    deletedIcon        = EditorGUIUtility.IconContent("UniGit/deleted"),
                    deletedIconSmall   = EditorGUIUtility.IconContent("UniGit/deleted_small"),
                    renamedIcon        = EditorGUIUtility.IconContent("UniGit/renamed"),
                    renamedIconSmall   = EditorGUIUtility.IconContent("UniGit/renamed_small"),
                    loadingIconSmall   = EditorGUIUtility.IconContent("UniGit/loading"),
                    objectIcon         = EditorGUIUtility.IconContent("UniGit/object"),
                    objectIconSmall    = EditorGUIUtility.IconContent("UniGit/object_small"),
                    metaIcon           = EditorGUIUtility.IconContent("UniGit/meta"),
                    metaIconSmall      = EditorGUIUtility.IconContent("UniGit/meta_small")
                };
            }

            EditorApplication.projectWindowItemOnGUI += CustomIcons;

            GitLfsManager.Load();
            GitHookManager.Load();
            GitExternalManager.Load();
            GitCredentialsManager.Load();

            needsFetch                 = !EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isCompiling && !EditorApplication.isUpdating;
            repositoryDirty            = true;
            GitCallbacks.EditorUpdate += OnEditorUpdate;
        }
Beispiel #3
0
        internal static void Initlize()
        {
            if (!IsValidRepo)
            {
                return;
            }

            gitCredentials = EditorGUIUtility.Load("UniGit/Git-Credentials.asset") as GitCredentials;
            gitSettings    = EditorGUIUtility.LoadRequired("UniGit/Git-Settings.asset") as GitSettings;
            if (gitSettings == null)
            {
                gitSettings = ScriptableObject.CreateInstance <GitSettings>();
                AssetDatabase.CreateAsset(gitSettings, "Assets/Editor Default Resources/UniGit/Git-Settings.asset");
                AssetDatabase.SaveAssets();
            }
            repository = new Repository(RepoPath);
            Update();

            if (IconStyle == null)
            {
                IconStyle = new GUIStyle
                {
                    imagePosition = ImagePosition.ImageOnly,
                    alignment     = TextAnchor.LowerLeft,
                    padding       = new RectOffset(2, 2, 2, 2)
                };
            }

            if (icons == null)
            {
                icons = new Icons()
                {
                    validIcon          = EditorGUIUtility.IconContent("UniGit/success"),
                    validIconSmall     = EditorGUIUtility.IconContent("UniGit/success_small"),
                    modifiedIcon       = EditorGUIUtility.IconContent("UniGit/error"),
                    modifiedIconSmall  = EditorGUIUtility.IconContent("UniGit/error_small"),
                    addedIcon          = EditorGUIUtility.IconContent("UniGit/add"),
                    addedIconSmall     = EditorGUIUtility.IconContent("UniGit/add_small"),
                    untrackedIcon      = EditorGUIUtility.IconContent("UniGit/info"),
                    untrackedIconSmall = EditorGUIUtility.IconContent("UniGit/info_small"),
                    ignoredIcon        = EditorGUIUtility.IconContent("UniGit/minus"),
                    ignoredIconSmall   = EditorGUIUtility.IconContent("UniGit/minus_small"),
                    conflictIcon       = EditorGUIUtility.IconContent("UniGit/warning"),
                    conflictIconSmall  = EditorGUIUtility.IconContent("UniGit/warning_small"),
                    deletedIcon        = EditorGUIUtility.IconContent("UniGit/deleted"),
                    deletedIconSmall   = EditorGUIUtility.IconContent("UniGit/deleted_small"),
                    renamedIcon        = EditorGUIUtility.IconContent("UniGit/renamed"),
                    renamedIconSmall   = EditorGUIUtility.IconContent("UniGit/renamed_small")
                };
            }

            EditorApplication.projectWindowItemOnGUI += CustomIcons;

            GitLfsManager.Load();
            GitHookManager.Load();
            GitExternalManager.Load();
            GitCredentialsManager.Load();

            needsFetch = true;
            EditorApplication.update += OnEditorUpdate;
        }