예제 #1
0
        private static bool ShouleBeEditable(GameObject gameObject)
        {
            var assetPath = gameObject.GetAssetPath();

            if (assetPath == "")
            {
                return(true);
            }
            var assetStatus = gameObject.GetAssetStatus();

            if (!VCUtility.ManagedByRepository(assetStatus))
            {
                return(true);
            }
            bool isPrefab = ObjectUtilities.ChangesStoredInPrefab(gameObject);

            if (isPrefab && LockPrefab(assetPath))
            {
                return(VCUtility.HaveAssetControl(assetStatus));
            }
            else // Treat as scene object
            {
                string scenePath = ObjectUtilities.ObjectToAssetPath(gameObject, false);
                if (scenePath == "")
                {
                    return(true);
                }
                var  vcSceneStatus    = VCCommands.Instance.GetAssetStatus(scenePath);
                bool haveSceneControl = VCUtility.HaveAssetControl(vcSceneStatus);
                bool lockScene        = LockScene(scenePath);
                return(haveSceneControl || !lockScene);
            }
        }
예제 #2
0
        private static bool ShouleBeEditable(GameObject gameObject)
        {
            //Debug.Log(gameObject.name + " - " +
            //    gameObject.GetAssetPath() + " - " +
            //    VCUtility.ManagedByRepository(gameObject.GetAssetStatus()) +  " - " +
            //    ObjectUtilities.ChangesStoredInPrefab(gameObject) + " - " +
            //    LockPrefab(gameObject.GetAssetPath()) + " - " +
            //    VCUtility.HaveAssetControl(gameObject.GetAssetStatus()) + " - " +
            //    ObjectUtilities.ObjectToAssetPath(gameObject, false) + " - " +
            //    PrefabUtility.GetPrefabType(gameObject).ToString());

            var assetPath = gameObject.GetAssetPath();

            if (assetPath == "")
            {
                return(true);
            }
            var assetStatus = gameObject.GetAssetStatus();

            if (!VCUtility.ManagedByRepository(assetStatus))
            {
                return(true);
            }
            bool isPrefab = ObjectUtilities.ChangesStoredInPrefab(gameObject);

            if (isPrefab)
            {
                if (LockPrefab(assetPath))
                {
                    return(VCUtility.HaveAssetControl(assetStatus));
                }
                else //Stella: if not-locked prefab, allow editing even though this might affect scene
                {
                    return(true);
                }
            }
            else // Treat as scene object
            {
                string scenePath = ObjectUtilities.ObjectToAssetPath(gameObject, false);
                if (scenePath == "")
                {
                    return(true);
                }
                var  vcSceneStatus    = VCCommands.Instance.GetAssetStatus(scenePath);
                bool haveSceneControl = VCUtility.HaveAssetControl(vcSceneStatus);
                bool lockScene        = LockScene(scenePath);
                return(haveSceneControl || !lockScene);
            }
        }