public static void RenderSpherePointRow(Rect rect, SkyProfile profile, SpherePointKeyframeGroup group)
        {
            bool sortGroup = false;

            RenderColorGradients(rect, group);

            for (int i = 0; i < group.keyframes.Count; i++)
            {
                SpherePointKeyframe currentKey = group.GetKeyframe(i);

                // Track key marker mouse events and render.
                bool didSingleClick  = false;
                bool isDragging      = false;
                bool keyframeUpdated = false;
                SkyEditorUtility.DrawHorizontalKeyMarker(rect, currentKey, profile,
                                                         out didSingleClick, out isDragging, out keyframeUpdated);

                if (keyframeUpdated)
                {
                    sortGroup = true;
                }

                // Show the color keyframe property window.
                if (didSingleClick || isDragging)
                {
                    // Load info about this keyframe and show the editor window.
                    KeyframeInspectorWindow.SetKeyframeData(
                        currentKey, group, KeyframeInspectorWindow.KeyType.SpherePoint, profile);

                    if (didSingleClick)
                    {
                        KeyframeInspectorWindow.ShowWindow();
                    }
                }
            }

            if (sortGroup)
            {
                group.SortKeyframes();
            }
        }
Ejemplo n.º 2
0
        private bool RenderSpherePointPropertyGroup(ProfileGroupDefinition def)
        {
            EditorGUILayout.BeginHorizontal();
            bool valueChanged = false;

            SpherePointKeyframeGroup group = m_Profile.GetGroup <SpherePointKeyframeGroup>(def.propertyKey);

            if (m_Profile.IsManagedByTimeline(def.propertyKey))
            {
                EditorGUILayout.PrefixLabel(new GUIContent(def.groupName, def.tooltip));
                RenderManagedOnTimlineMessage();
            }
            else
            {
                SpherePointKeyframe frame = group.GetKeyframe(0);

                EditorGUILayout.BeginVertical();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent(group.name, def.tooltip));
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();

                EditorGUI.BeginChangeCheck();
                EditorGUI.indentLevel += 1;
                SpherePoint selectedPoint = SpherePointGUI.SpherePointField(
                    frame.spherePoint, true, frame.id);
                EditorGUI.indentLevel -= 1;
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(m_Profile, "Changed sphere point");
                    frame.spherePoint = selectedPoint;
                }

                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.EndHorizontal();
            return(valueChanged);
        }