public bool Repopulate() { Profiler.BeginSample("SerializedPropertyDataStore.Repopulate.GatherDelegate"); UnityEngine.Object[] objs = m_GatherDel(); Profiler.EndSample(); if (m_Objects != null) { // If nothing's changed -> bail if (objs.Length == m_Objects.Length && ArrayUtility.ArrayReferenceEquals(objs, m_Objects)) { return(false); } Clear(); } // Recreate data store m_Objects = objs; m_Elements = new Data[objs.Length]; for (int i = 0; i < objs.Length; i++) { m_Elements[i] = new Data(objs[i], m_PropNames); } return(true); }
public bool Repopulate(out bool needsReload) { // this is done due to optimization reasons. we want to know if any major changes has happened to the data // without having to refetch it in another place and loop through it there needsReload = false; Profiler.BeginSample("SerializedPropertyDataStore.Repopulate.GatherDelegate"); UnityEngine.Object[] objs = m_GatherDel(); Profiler.EndSample(); if (m_Objects != null) { // If nothing's changed -> bail if (objs.Length == m_Objects.Length && ArrayUtility.ArrayReferenceEquals(objs, m_Objects)) { // The list of objects is the same, but since some should now potentially be hidden, we need to request a reload if (!ActiveObjectsEquals(objs, m_ActiveObjects)) { needsReload = true; } return(false); } Clear(); } // Recreate data store m_Objects = objs; m_Elements = new Data[objs.Length]; m_ActiveObjects = new bool[objs.Length]; int elementIndex = 0; for (int i = 0; i < objs.Length; i++) { // we don't want to list hidden objects if (objs[i] == null || objs[i].hideFlags == HideFlags.HideAndDontSave || objs[i].hideFlags == HideFlags.HideInHierarchy) { continue; } if (objs[i] is Component) { m_ActiveObjects[i] = ((Component)objs[i]).gameObject.activeInHierarchy; } m_Elements[elementIndex] = new Data(objs[i], m_PropNames); elementIndex++; } if (elementIndex < objs.Length) { System.Array.Resize(ref m_Elements, elementIndex); } needsReload = true; return(true); }
public bool Repopulate() { Profiler.BeginSample("SerializedPropertyDataStore.Repopulate.GatherDelegate"); UnityEngine.Object[] array = this.m_GatherDel(); Profiler.EndSample(); bool result; if (this.m_Objects != null) { if (array.Length == this.m_Objects.Length && ArrayUtility.ArrayReferenceEquals <UnityEngine.Object>(array, this.m_Objects)) { result = false; return(result); } this.Clear(); } this.m_Objects = array; this.m_Elements = new SerializedPropertyDataStore.Data[array.Length]; for (int i = 0; i < array.Length; i++) { this.m_Elements[i] = new SerializedPropertyDataStore.Data(array[i], this.m_PropNames); } result = true; return(result); }
public bool Repopulate() { Profiler.BeginSample("SerializedPropertyDataStore.Repopulate.GatherDelegate"); UnityEngine.Object[] objs = m_GatherDel(); Profiler.EndSample(); if (m_Objects != null) { // If nothing's changed -> bail if (objs.Length == m_Objects.Length && ArrayUtility.ArrayReferenceEquals(objs, m_Objects)) { return(false); } Clear(); } // Recreate data store m_Objects = objs; m_Elements = new Data[objs.Length]; int elementIndex = 0; for (int i = 0; i < objs.Length; i++) { // we don't want to list hidden objects if (objs[i].hideFlags == HideFlags.HideAndDontSave) { continue; } m_Elements[elementIndex] = new Data(objs[i], m_PropNames); elementIndex++; } if (elementIndex < objs.Length) { System.Array.Resize(ref m_Elements, elementIndex); } return(true); }