private static Object RevertObject(Object obj) { if (ObjectUtilities.ChangesStoredInScene(obj)) { SceneManagerUtilities.SaveActiveScene(); } bool success = VCCommands.Instance.Revert(obj.ToAssetPaths()); if (success && onHierarchyReverted != null) { onHierarchyReverted(obj); } return(obj); }
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); } }
public static void ApplyAndCommit(Object obj, string commitMessage = "", bool showCommitDialog = false) { var gameObject = obj as GameObject; if (ObjectUtilities.ChangesStoredInScene(obj)) { SceneManagerUtilities.SaveActiveScene(); } if (PrefabHelper.IsPrefab(gameObject, true, false) && !PrefabHelper.IsPrefabParent(obj)) { PrefabHelper.ApplyPrefab(gameObject); } if (onHierarchyCommit != null) { onHierarchyCommit(obj); } VCCommands.Instance.CommitDialog(obj.ToAssetPaths(), showCommitDialog, commitMessage); }