Exemple #1
0
        public void AddFromComponent(GameObject obj, Component component)
        {
            if (Application.isPlaying)
            {
                return;
            }

            if (obj == null || component == null)
            {
                return;
            }

            var serializedObject        = new SerializedObject(component);
            SerializedProperty property = serializedObject.GetIterator();

            while (property.NextVisible(true))
            {
                if (property.hasVisibleChildren || !AnimatedParameterExtensions.IsAnimatable(property.propertyType))
                {
                    continue;
                }

                AddPropertyModification(component, property.propertyPath);
            }
        }
        private static bool InternalAddParameter(TimelineClip clip, string parameterName, ref EditorCurveBinding binding, out SerializedProperty property)
        {
            property = null;
            bool result;

            if (clip.IsParameterAnimated(parameterName))
            {
                result = false;
            }
            else
            {
                SerializedObject serializedObject = AnimatedParameterExtensions.GetSerializedObject(clip);
                if (serializedObject == null)
                {
                    result = false;
                }
                else
                {
                    property = serializedObject.FindProperty(parameterName);
                    if (property == null || !AnimatedParameterExtensions.IsAnimatable(property.get_propertyType()))
                    {
                        result = false;
                    }
                    else
                    {
                        AnimatedParameterExtensions.CreateCurvesIfRequired(clip, null);
                        binding = clip.GetCurveBinding(parameterName);
                        result  = true;
                    }
                }
            }
            return(result);
        }
        public static bool IsParameterAnimatable(this TimelineClip clip, string parameterName)
        {
            bool result;

            if (clip.asset == null || Attribute.IsDefined(clip.asset.GetType(), typeof(NotKeyableAttribute)))
            {
                result = false;
            }
            else if (!clip.HasScriptPlayable())
            {
                result = false;
            }
            else
            {
                SerializedObject serializedObject = AnimatedParameterExtensions.GetSerializedObject(clip);
                if (serializedObject == null)
                {
                    result = false;
                }
                else
                {
                    bool flag = clip.asset is IPlayableBehaviour;
                    SerializedProperty serializedProperty = serializedObject.FindProperty(parameterName);
                    result = (serializedProperty != null && AnimatedParameterExtensions.IsAnimatable(serializedProperty.get_propertyType()) && AnimatedParameterExtensions.IsKeyable(clip.asset.GetType(), parameterName) && (flag || clip.IsAnimatablePath(serializedProperty.get_propertyPath())));
                }
            }
            return(result);
        }
Exemple #4
0
        public static bool CanRecord(SerializedProperty property, WindowState state)
        {
            if (IsPlayableAssetProperty(property))
            {
                return(AnimatedParameterExtensions.IsAnimatable(property.propertyType));
            }

            if (GetRecordingTrack(property, state) == null)
            {
                return(false);
            }

            s_TempPropertyModifications.Clear();
            GatherModifications(property, s_TempPropertyModifications);
            return(s_TempPropertyModifications.Any());
        }
 public void AddFromComponent(GameObject obj, Component component)
 {
     if (!Application.get_isPlaying())
     {
         if (!(obj == null) && !(component == null))
         {
             SerializedObject   serializedObject = new SerializedObject(component);
             SerializedProperty iterator         = serializedObject.GetIterator();
             while (iterator.NextVisible(true))
             {
                 if (!iterator.get_hasVisibleChildren() && AnimatedParameterExtensions.IsAnimatable(iterator.get_propertyType()))
                 {
                     PropertyCollector.AddPropertyModification(component, iterator.get_propertyPath());
                 }
             }
         }
     }
 }
        public static bool HasAnyAnimatableParameters(this TimelineClip clip)
        {
            bool result;

            if (clip.asset == null || Attribute.IsDefined(clip.asset.GetType(), typeof(NotKeyableAttribute)))
            {
                result = false;
            }
            else if (!clip.HasScriptPlayable())
            {
                result = false;
            }
            else
            {
                SerializedObject serializedObject = AnimatedParameterExtensions.GetSerializedObject(clip);
                if (serializedObject == null)
                {
                    result = false;
                }
                else
                {
                    SerializedProperty iterator = serializedObject.GetIterator();
                    bool flag  = true;
                    bool flag2 = clip.asset is IPlayableBehaviour;
                    bool flag3 = false;
                    while (iterator.NextVisible(flag))
                    {
                        if (AnimatedParameterExtensions.IsAnimatable(iterator.get_propertyType()) && AnimatedParameterExtensions.IsKeyable(clip.asset.GetType(), iterator.get_propertyPath()))
                        {
                            flag3 |= (flag2 || clip.IsAnimatablePath(iterator.get_propertyPath()));
                        }
                    }
                    result = flag3;
                }
            }
            return(result);
        }