public ComparisonViewPopup(Object source, Object instance, PrefabOverride modification, PrefabOverridesTreeView owner) { m_Owner = owner; m_Source = source; m_Instance = instance; m_Modification = modification; if (modification != null) { m_Unappliable = !PrefabUtility.IsPartOfPrefabThatCanBeAppliedTo(modification.GetAssetObject()); } else { m_Unappliable = false; } if (m_Source != null) { m_SourceEditor = Editor.CreateEditor(m_Source); } if (m_Instance != null) { m_InstanceEditor = Editor.CreateEditor(m_Instance); } if (m_Source == null || m_Instance == null || m_Modification == null) { m_PreviewSize.x /= 2; } if (modification is ObjectOverride) { Undo.postprocessModifications += RecheckOverrideStatus; } }
bool OperateSelectedOverrides(PrefabUtility.OverrideOperation operation) { List <PrefabOverride> overrides = new List <PrefabOverride>(); // Get all overrides from selection. Immediately accept any overrides with no dependencies. var selection = m_TreeView.GetSelection(); for (int i = 0; i < selection.Count; i++) { PrefabOverride singleOverride = m_TreeView.FindOverride(selection[i]); if (singleOverride != null) { overrides.Add(singleOverride); } } bool success = PrefabUtility.ProcessMultipleOverrides(m_SelectedGameObjects[0], overrides, operation, InteractionMode.UserAction); if (success) { EditorUtility.ForceRebuildInspectors(); } return(success); }