IsSerializedByFullInspector() public static méthode

Returns true if the given property should be serialized.
This assumes that the property is r/w!
public static IsSerializedByFullInspector ( InspectedProperty property ) : bool
property InspectedProperty
Résultat bool
Exemple #1
0
 public bool IsInterested(InspectedProperty property)
 {
     return
         (property.CanWrite &&
          InspectedType.IsSerializedByFullInspector(property) &&
          InspectedType.IsSerializedByUnity(property) == false);
 }
Exemple #2
0
        /// <summary>
        /// Returns true if the given property should be displayed in the inspector. This method
        /// assumes that the property type is inspectable.
        /// </summary>
        private static bool ShouldDisplayProperty(InspectedProperty property)
        {
            var memberInfo = property.MemberInfo;

            // note: we do opt-out before opt-in so that we can still serialize
            //       a field but not display it in the inspector (as the serialize
            //       annotations automatically cause a field to be displayed)
            if (memberInfo.IsDefined(typeof(HideInInspector), /*inherit:*/ true) ||
                memberInfo.IsDefined(typeof(NotSerializedAttribute), /*inherit:*/ true) ||
                fiInstalledSerializerManager.SerializationOptOutAnnotations.Any(t => memberInfo.IsDefined(t, /*inherit*/ true)))
            {
                return(false);
            }

            if (memberInfo.IsDefined(typeof(ShowInInspectorAttribute), /*inherit:*/ true) ||
                (property.IsStatic == false && fiInstalledSerializerManager.SerializationOptInAnnotations.Any(t => memberInfo.IsDefined(t, /*inherit*/ true))))
            {
                return(true);
            }

            if (property.MemberInfo is PropertyInfo && fiSettings.InspectorRequireShowInInspector)
            {
                return(false);
            }

            return
                (InspectedType.IsSerializedByFullInspector(property) ||
                 InspectedType.IsSerializedByUnity(property));
        }
Exemple #3
0
        /// <summary>
        /// Returns true if the given property should be displayed in the
        /// inspector. This method assumes that the property type is inspectable.
        /// </summary>
        private static bool ShouldDisplayProperty(InspectedProperty property)
        {
            var memberInfo = property.MemberInfo;

            // If ShowInInspector is present, we will *always* display the
            // attribute.
            if (memberInfo.IsDefined(typeof(ShowInInspectorAttribute), /*inherit:*/ true))
            {
                return(true);
            }

            // note: we do opt-out serialization annotations before opt-in
            //       annotations so that we can still serialize a field but not
            //       display it in the inspector (as the serialize annotations
            //       automatically cause a field to be displayed)
            if (memberInfo.IsDefined(typeof(HideInInspector), /*inherit:*/ true) ||
                memberInfo.IsDefined(typeof(NotSerializedAttribute), /*inherit:*/ true) ||
                fiInstalledSerializerManager.SerializationOptOutAnnotations.Any(t => memberInfo.IsDefined(t, /*inherit*/ true)))
            {
                return(false);
            }

            // Show the property if any of the opt-in annotations are present.
            if (property.IsStatic == false &&
                fiInstalledSerializerManager.SerializationOptInAnnotations.Any(t => memberInfo.IsDefined(t, /*inherit*/ true)))
            {
                return(true);
            }

            if (property.MemberInfo is PropertyInfo && fiSettings.InspectorRequireShowInInspector)
            {
                return(false);
            }

            return
                // IsSerializedByFullInspector will return false for BaseObject
                // types, so we want to special case support for them being
                // inspected.
                (typeof(BaseObject).Resolve().IsAssignableFrom(property.StorageType.Resolve()) ||
                 InspectedType.IsSerializedByFullInspector(property) ||
                 InspectedType.IsSerializedByUnity(property));
        }