コード例 #1
0
 private void ShowPlayableAssetInspector()
 {
     if (this.m_SelectionInfo.selectedAssetTypesAreHomogeneous)
     {
         if (this.m_SelectedPlayableAssetsInspector != null)
         {
             foreach (ClipInspector.EditorClipSelection current in this.m_SelectionCache)
             {
                 ClipInspector.PreparePlayableAsset(current);
             }
             EditorGUI.BeginChangeCheck();
             this.m_SelectedPlayableAssetsInspector.OnInspectorGUI();
             if (EditorGUI.EndChangeCheck())
             {
                 if (TimelineWindow.IsEditingTimelineAsset(this.m_TimelineAsset) && TimelineWindow.instance.state != null)
                 {
                     TimelineWindow.instance.state.rebuildGraph = true;
                     TimelineWindow.instance.Repaint();
                 }
             }
         }
     }
 }
コード例 #2
0
        private static void PreparePlayableAsset(ClipInspector.EditorClipSelection selectedItem)
        {
            if (Event.get_current().get_type() == 7)
            {
                if (selectedItem.playableAssetObject != null)
                {
                    TimelineClip clip = selectedItem.clip;
                    if (clip != null && !(clip.curves == null))
                    {
                        TimelineWindow instance = TimelineWindow.instance;
                        if (!(instance == null) && instance.state != null)
                        {
                            if (!instance.state.previewMode)
                            {
                                selectedItem.lastEvalTime = -1.0;
                            }
                            else
                            {
                                double num = instance.state.time;
                                num = clip.ToLocalTime(num);
                                if (selectedItem.lastEvalTime == num)
                                {
                                    int version = AnimationClipCurveCache.Instance.GetCurveInfo(clip.curves).version;
                                    if (version == selectedItem.lastCurveVersion)
                                    {
                                        return;
                                    }
                                    selectedItem.lastCurveVersion = version;
                                }
                                selectedItem.lastEvalTime = num;
                                AnimationClipCurveInfo curveInfo = AnimationClipCurveCache.Instance.GetCurveInfo(clip.curves);
                                if (curveInfo.bindings.Length != 0)
                                {
                                    selectedItem.playableAssetObject.Update();
                                    SerializedProperty iterator = selectedItem.playableAssetObject.GetIterator();
                                    while (iterator.NextVisible(true))
                                    {
                                        if (clip.IsParameterAnimated(iterator.get_propertyPath()))
                                        {
                                            AnimationCurve         animatedParameter = clip.GetAnimatedParameter(iterator.get_propertyPath());
                                            SerializedPropertyType propertyType      = iterator.get_propertyType();
                                            switch (propertyType)
                                            {
                                            case 0:
                                                iterator.set_intValue(Mathf.FloorToInt(animatedParameter.Evaluate((float)num)));
                                                continue;

                                            case 1:
                                                iterator.set_boolValue(animatedParameter.Evaluate((float)num) > 0f);
                                                continue;

                                            case 2:
                                                iterator.set_floatValue(animatedParameter.Evaluate((float)num));
                                                continue;

                                            case 3:
                                            case 5:
                                            case 6:
                                            case 7:
IL_18C:
                                                if (propertyType != 17)
                                                {
                                                    continue;
                                                }
                                                goto IL_222;

                                            case 4:
                                                ClipInspector.SetAnimatedValue(clip, iterator, "r", num);
                                                ClipInspector.SetAnimatedValue(clip, iterator, "g", num);
                                                ClipInspector.SetAnimatedValue(clip, iterator, "b", num);
                                                ClipInspector.SetAnimatedValue(clip, iterator, "a", num);
                                                continue;

                                            case 8:
                                                goto IL_248;

                                            case 9:
                                                goto IL_235;

                                            case 10:
                                                goto IL_222;
                                            }
                                            goto IL_18C;
                                            continue;
IL_248:
                                            ClipInspector.SetAnimatedValue(clip, iterator, "x", num);
                                            ClipInspector.SetAnimatedValue(clip, iterator, "y", num);
                                            continue;
IL_235:
                                            ClipInspector.SetAnimatedValue(clip, iterator, "z", num);
                                            goto IL_248;
IL_222:
                                            ClipInspector.SetAnimatedValue(clip, iterator, "w", num);
                                            goto IL_235;
                                        }
                                    }
                                    selectedItem.playableAssetObject.ApplyModifiedPropertiesWithoutUndo();
                                }
                            }
                        }
                    }
                }
            }
        }