void ValidatePersistentDataOnSubTree(VisualElement root, bool enablePersistence) { // We don't want to persist when there is a high chance that there will // be persistenceKey conflicts and data sharing. Generally, if an element // has no persistenceKey, we do not persist it and any of its children. // There are some exceptions, hence the use of IsPersitenceSupportedOnChildren(). if (!root.IsPersitenceSupportedOnChildren()) { enablePersistence = false; } if (root.IsDirty(ChangeType.PersistentData)) { root.OnPersistentDataReady(enablePersistence); root.ClearDirty(ChangeType.PersistentData); } if (root.IsDirty(ChangeType.PersistentDataPath)) { for (int i = 0; i < root.shadow.childCount; ++i) { ValidatePersistentDataOnSubTree(root.shadow[i], enablePersistence); } root.ClearDirty(ChangeType.PersistentDataPath); } }
private void ValidatePersistentDataOnSubTree(VisualElement ve, bool enablePersistence) { // We don't want to persist when there is a high chance that there will // be persistenceKey conflicts and data sharing. Generally, if an element // has no persistenceKey, we do not persist it and any of its children. // There are some exceptions, hence the use of IsPersitenceSupportedOnChildren(). if (!ve.IsPersitenceSupportedOnChildren()) { enablePersistence = false; } if (m_UpdateList.Contains(ve)) { m_UpdateList.Remove(ve); ve.OnPersistentDataReady(enablePersistence); } if (m_ParentList.Contains(ve)) { m_ParentList.Remove(ve); for (int i = 0; i < ve.shadow.childCount; ++i) { ValidatePersistentDataOnSubTree(ve.shadow[i], enablePersistence); } } }
private void ValidatePersistentDataOnSubTree(VisualElement root, bool enablePersistence) { if (!root.IsPersitenceSupportedOnChildren()) { enablePersistence = false; } if (root.IsDirty(ChangeType.PersistentData)) { root.OnPersistentDataReady(enablePersistence); root.ClearDirty(ChangeType.PersistentData); } if (root.IsDirty(ChangeType.PersistentDataPath)) { for (int i = 0; i < root.shadow.childCount; i++) { this.ValidatePersistentDataOnSubTree(root.shadow[i], enablePersistence); } root.ClearDirty(ChangeType.PersistentDataPath); } }