public bool CommitDialog(IEnumerable <string> assets, bool showUserConfirmation = true, string commitMessage = "") { int initialAssetCount = assets.Count(); if (initialAssetCount == 0) { return(true); } assets = assets.AddFilesInFolders().AddFolders(vcc).AddMoveMatches(vcc); var dependencies = VCSettings.IncludeDepedenciesAsDefault ? assets.GetDependencies().AddFilesInFolders().AddFolders(vcc).Concat(assets.AddDeletedInFolders(vcc)) : new List <string>(); var allAssets = assets.Concat(dependencies).Distinct().ToList(); var localModified = allAssets.LocalModified(vcc); if (assets.Contains(SceneManagerUtilities.GetCurrentScenePath())) { SceneManagerUtilities.SaveCurrentModifiedScenesIfUserWantsTo(); } if (PreCommit != null) { PreCommit(allAssets); } if (VCSettings.RequireLockBeforeCommit && localModified.Any()) { string title = string.Format("{0} '{1}' files?", Terminology.getlock, Terminology.localModified); string message = string.Format("You are trying to commit files which are '{0}'.\nDo you want to '{1}' these files first?", Terminology.localModified, Terminology.getlock); if (EditorUtility.DisplayDialog(title, message, Terminology.getlock, "Abort")) { GetLock(localModified); } else { return(false); } } if (showUserConfirmation || initialAssetCount < (assets.Count() + dependencies.Count())) { return(OpenCommitDialogWindow(assets, dependencies)); } return(Commit(assets, commitMessage, VCSettings.NonRecursiveAdd)); }
internal static void RefreshEditableObject(GameObject gameObject) { bool editable = ShouleBeEditable(gameObject); bool parentEditable = gameObject.transform.parent ? ShouleBeEditable(gameObject.transform.parent.gameObject) : VCUtility.HaveAssetControl(SceneManagerUtilities.GetCurrentScenePath()); bool prefabHeadEditable = PrefabHelper.IsPrefabRoot(gameObject) && parentEditable; if (prefabHeadEditable) { SetEditable(gameObject, true); } else { SetEditable(gameObject, editable); } foreach (var componentIt in gameObject.GetComponents <Component>()) { if (prefabHeadEditable && componentIt == gameObject.transform) { SetEditable(gameObject.transform, true); } else { RefreshEditableComponent(gameObject, componentIt); } } }
public static bool ChangesStoredInScene(Object obj) { obj = GetObjectIndirection(obj); return(obj.GetAssetPath() == SceneManagerUtilities.GetCurrentScenePath()); }