public override float GetElementHeight(GUIContent label, Facade <T> element, fiGraphMetadata metadata) { float height = 0; if (string.IsNullOrEmpty(label.text) == false || TypeOptions.Types.Length > 1) { height = LabelHeight; } var anim = metadata.GetMetadata <fiAnimationMetadata>(); if (anim.IsAnimating) { return(height + anim.AnimationHeight); } if (element == null) { element = new Facade <T>(); } if (element.InstanceType == null) { element.InstanceType = TypeOptions.Types[0]; } InspectedType inspectedType = InspectedType.Get(element.InstanceType); var serializer = (BaseSerializer)fiSingletons.Get(fiInstalledSerializerManager.DefaultMetadata.SerializerType); var deserializationOp = new ListSerializationOperator() { SerializedObjects = element.ObjectReferences }; var properties = inspectedType.GetProperties(InspectedMemberFilters.InspectableMembers); for (int i = 0; i < properties.Count; ++i) { InspectedProperty property = properties[i]; object propertyValue = DeserializeProperty(serializer, deserializationOp, property, element); height += fiEditorGUI.EditPropertyHeightDirect(property, propertyValue, metadata.Enter(property.Name)); height += SplitterHeight; } return(height); }
public override Facade <T> Edit(Rect region, GUIContent label, Facade <T> element, fiGraphMetadata metadata) { if (element == null) { element = new Facade <T>(); } if (element.InstanceType == null) { element.InstanceType = TypeOptions.Types[0]; } bool changedTypes; DrawHeader(ref region, label, element, out changedTypes); var facadeMembers = new Dictionary <string, string>(); var facadeReferences = new List <UnityObject>(); InspectedType inspectedType = InspectedType.Get(element.InstanceType); var serializer = (BaseSerializer)fiSingletons.Get(fiInstalledSerializerManager.DefaultMetadata.SerializerType); var deserializationOp = new ListSerializationOperator() { SerializedObjects = element.ObjectReferences }; var serializationOp = new ListSerializationOperator() { SerializedObjects = facadeReferences }; float usedHeight = 0; var anim = metadata.GetMetadata <fiAnimationMetadata>(); if (anim.IsAnimating) { fiEditorGUI.BeginFadeGroupHeight(LabelHeight, ref region, anim.AnimationHeight); fiEditorUtility.RepaintAllEditors(); } var properties = inspectedType.GetProperties(InspectedMemberFilters.InspectableMembers); for (int i = 0; i < properties.Count; ++i) { InspectedProperty property = properties[i]; object propertyValue = DeserializeProperty(serializer, deserializationOp, property, element); float height = fiEditorGUI.EditPropertyHeightDirect(property, propertyValue, metadata.Enter(property.Name)); Rect propertyRect = region; propertyRect.height = height; region.y += height; region.y += SplitterHeight; usedHeight += height + SplitterHeight; object updatedValue = fiEditorGUI.EditPropertyDirect(propertyRect, property, propertyValue, metadata.Enter(property.Name)); string data; if (TrySerializeProperty(serializer, serializationOp, property, updatedValue, out data)) { facadeMembers[property.Name] = data; } } if (anim.IsAnimating) { fiEditorGUI.EndFadeGroup(); } element.FacadeMembers = facadeMembers; element.ObjectReferences = facadeReferences; if (changedTypes && anim.UpdateHeight(usedHeight)) { fiEditorUtility.RepaintAllEditors(); } return(element); }