示例#1
0
 public static void SetKeyframeData(IBaseKeyframe keyframe, IKeyframeGroup group, KeyType keyType, SkyProfile profile)
 {
     KeyframeInspectorWindow.keyframe = keyframe;
     KeyframeInspectorWindow.@group   = group;
     KeyframeInspectorWindow.keyType  = keyType;
     KeyframeInspectorWindow.profile  = profile;
 }
 public static bool IsKeyframeSelected(IBaseKeyframe keyframe)
 {
     if (keyframe == null || TimelineSelection.selectedControlUUID == null ||
         TimelineSelection.selectedControlUUID != keyframe.id)
     {
         return(false);
     }
     return(true);
 }
 // Get the amount of time between 2 keyframes.
 public static float GetDurationBetweenKeyframes(IBaseKeyframe from, IBaseKeyframe to)
 {
     if (from.time <= to.time)
     {
         return(to.time - from.time);
     }
     else
     {
         return((1.0f - from.time) + to.time);
     }
 }
 // Keyframe time is pretty much 1.0f.
 public static bool IsKeyFrameAtEnd(IBaseKeyframe keyframe)
 {
     return(keyframe.time >= .99999f);
 }
 // Keyframe time is pretty much zero.
 public static bool IsKeyFrameAtStart(IBaseKeyframe keyframe)
 {
     return(keyframe.time >= 0 && keyframe.time < .00001f);
 }
示例#6
0
        private void OnGUI()
        {
            if (keyType == KeyType.None || keyframe == null)
            {
                keyType = KeyType.None;
                ShowEmptyState();
                return;
            }

            GUILayout.BeginVertical();
            GUILayout.Space(5);

            bool didModifyProfile = false;

            // Render time.
            didModifyProfile = RenderTimeValue();

            // Animation curve.
            didModifyProfile = RenderInterpolationCurveType();

            // Core layout for this type of keyframe.
            if (keyType == KeyType.Color)
            {
                didModifyProfile = RenderColorGUI();
            }
            else if (keyType == KeyType.Numeric)
            {
                didModifyProfile = RenderNumericGUI();
            }
            else if (keyType == KeyType.SpherePoint)
            {
                didModifyProfile = RenderSpherePointGUI();
            }

            GUILayout.FlexibleSpace();

            // Buttom buttons.
            GUILayout.BeginHorizontal();

            if (KeyFrameCount() > 1)
            {
                if (GUILayout.Button("Delete Keyframe"))
                {
                    Undo.RecordObject(profile, "Deleting keyframe");

                    @group.RemoveKeyFrame(keyframe);
                    keyframe = null;


                    didModifyProfile = true;
                    Close();
                }
            }

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Close"))
            {
                Close();
            }

            GUILayout.EndHorizontal();

            GUILayout.Space(5);
            GUILayout.EndVertical();

            if (didModifyProfile)
            {
                @group.SortKeyframes();
                EditorUtility.SetDirty(profile);
            }
        }
示例#7
0
 public void RemoveKeyFrame(IBaseKeyframe keyframe)
 {
     RemoveKeyFrame((T)keyframe);
 }