private void DrawMoonGUI()
        {
            string label = "Moon";
            string id    = "moon" + profile.GetInstanceID();

            JEditorCommon.Foldout(label, false, id, () =>
            {
                cycle.UseMoonPivot = EditorGUILayout.Toggle("Custom Pivot", cycle.UseMoonPivot);
                if (cycle.UseMoonPivot)
                {
                    cycle.MoonOrbitPivot = EditorGUILayout.ObjectField("Pivot", cycle.MoonOrbitPivot, typeof(Transform), true) as Transform;
                }
                JEditorCommon.Separator();

                DisplayAddedProperties("Moon");
                if (GUILayout.Button("Add"))
                {
                    DisplayAllPropertiesAsContext("Moon");
                }
            });
        }
        private void DisplayAddedProperties(string group)
        {
            EditorGUI.indentLevel -= 1;
            JAnimatedProperty        toRemoveProp = null;
            List <JAnimatedProperty> props        = profile.AnimatedProperties.FindAll(p => p.DisplayName.StartsWith(group));

            for (int i = 0; i < props.Count; ++i)
            {
                EditorGUILayout.BeginHorizontal();
                JAnimatedProperty p = props[i];
                if (GUILayout.Button("▬", EditorStyles.miniLabel, GUILayout.Width(12)))
                {
                    toRemoveProp = p;
                }

                string itemLabel = p.DisplayName.Substring(p.DisplayName.IndexOf("/") + 1);
                itemLabel = ObjectNames.NicifyVariableName(itemLabel);
                if (p.CurveOrGradient == JCurveOrGradient.Curve)
                {
                    p.Curve = EditorGUILayout.CurveField(itemLabel, p.Curve);
                }
                else
                {
                    p.Gradient = EditorGUILayout.GradientField(itemLabel, p.Gradient);
                }

                EditorGUILayout.EndHorizontal();
            }
            if (props.Count > 0)
            {
                JEditorCommon.Separator();
            }

            if (toRemoveProp != null)
            {
                profile.AnimatedProperties.Remove(toRemoveProp);
            }
            EditorGUI.indentLevel += 1;
        }
        private void DrawStarsGUI()
        {
            string label = "Stars";
            string id    = "stars" + profile.GetInstanceID();;

            JEditorCommon.Foldout(label, false, id, () =>
            {
                profile.EnableStars = EditorGUILayout.Toggle("Enable", profile.EnableStars);
                if (profile.EnableStars)
                {
                    profile.UseBakedStars = EditorGUILayout.Toggle("Baked", profile.UseBakedStars);
                }
                if (profile.EnableStars && !profile.UseBakedStars)
                {
                    profile.StarsStartPosition = Slider("Start", profile.StarsStartPosition, -1, 1, nameof(profile.StarsStartPosition));
                    profile.StarsEndPosition   = Slider("End", profile.StarsEndPosition, -1, 1, nameof(profile.StarsEndPosition));
                    profile.StarsOpacity       = Slider("Opacity", profile.StarsOpacity, 0f, 1f, nameof(profile.StarsOpacity));
                    profile.StarsLayerCount    = EditorGUILayout.DelayedIntField("Layers", profile.StarsLayerCount);

                    if (profile.StarsLayerCount > 0)
                    {
                        JEditorCommon.Separator();
                        EditorGUILayout.LabelField("Layer 0");
                        EditorGUI.indentLevel += 1;
                        profile.StarsColor0    = ColorField("Color", profile.StarsColor0, true, true, true, nameof(profile.StarsColor0));
                        profile.StarsDensity0  = Slider("Density", profile.StarsDensity0, 0.01f, 1f, nameof(profile.StarsDensity0));
                        profile.StarsSize0     = Slider("Size", profile.StarsSize0, 0.01f, 1f, nameof(profile.StarsSize0));
                        profile.StarsGlow0     = Slider("Glow", profile.StarsGlow0, 0f, 1f, nameof(profile.StarsGlow0));
                        profile.StarsTwinkle0  = FloatField("Twinkle", profile.StarsTwinkle0, nameof(profile.StarsTwinkle0));
                        EditorGUI.indentLevel -= 1;
                    }

                    if (profile.StarsLayerCount > 1)
                    {
                        JEditorCommon.Separator();
                        EditorGUILayout.LabelField("Layer 1");
                        EditorGUI.indentLevel += 1;
                        profile.StarsColor1    = ColorField("Color", profile.StarsColor1, true, true, true, nameof(profile.StarsColor1));
                        profile.StarsDensity1  = Slider("Density", profile.StarsDensity1, 0.01f, 1f, nameof(profile.StarsDensity1));
                        profile.StarsSize1     = Slider("Size", profile.StarsSize1, 0.01f, 1f, nameof(profile.StarsSize1));
                        profile.StarsGlow1     = Slider("Glow", profile.StarsGlow1, 0f, 1f, nameof(profile.StarsGlow1));
                        profile.StarsTwinkle1  = FloatField("Twinkle", profile.StarsTwinkle1, nameof(profile.StarsTwinkle1));
                        EditorGUI.indentLevel -= 1;
                    }

                    if (profile.StarsLayerCount > 2)
                    {
                        JEditorCommon.Separator();
                        EditorGUILayout.LabelField("Layer 2");
                        EditorGUI.indentLevel += 1;
                        profile.StarsColor2    = ColorField("Color", profile.StarsColor2, true, true, true, nameof(profile.StarsColor2));
                        profile.StarsDensity2  = Slider("Density", profile.StarsDensity2, 0.01f, 1f, nameof(profile.StarsDensity2));
                        profile.StarsSize2     = Slider("Size", profile.StarsSize2, 0.01f, 1f, nameof(profile.StarsSize2));
                        profile.StarsGlow2     = Slider("Glow", profile.StarsGlow2, 0f, 1f, nameof(profile.StarsGlow2));
                        profile.StarsTwinkle2  = FloatField("Twinkle", profile.StarsTwinkle2, nameof(profile.StarsTwinkle2));
                        EditorGUI.indentLevel -= 1;
                    }
                }
                if (profile.EnableStars && profile.UseBakedStars)
                {
                    profile.StarsCubemap    = JEditorCommon.InlineCubemapField("Cubemap", profile.StarsCubemap, -1);
                    profile.StarsTwinkleMap = JEditorCommon.InlineTexture2DField("Twinkle Map", profile.StarsTwinkleMap, -1);
                    profile.StarsOpacity    = Slider("Opacity", profile.StarsOpacity, 0f, 1f, nameof(profile.StarsOpacity));
                }
            });
        }
        private void DrawStarsGUI()
        {
            string label = "Stars";
            string id    = "stars" + instance.GetInstanceID();;

            JEditorCommon.Foldout(label, false, id, () =>
            {
                instance.EnableStars = EditorGUILayout.Toggle("Enable", instance.EnableStars);
                if (instance.EnableStars)
                {
                    instance.UseBakedStars = EditorGUILayout.Toggle("Baked", instance.UseBakedStars);
                }
                if (instance.EnableStars && !instance.UseBakedStars)
                {
                    instance.StarsStartPosition = EditorGUILayout.Slider("Start", instance.StarsStartPosition, -1, 1);
                    instance.StarsEndPosition   = EditorGUILayout.Slider("End", instance.StarsEndPosition, -1, 1);
                    instance.StarsOpacity       = EditorGUILayout.Slider("Opacity", instance.StarsOpacity, 0f, 1f);
                    instance.StarsLayerCount    = EditorGUILayout.DelayedIntField("Layers", instance.StarsLayerCount);

                    if (instance.StarsLayerCount > 0)
                    {
                        JEditorCommon.Separator();
                        EditorGUILayout.LabelField("Layer 0");
                        EditorGUI.indentLevel += 1;
                        instance.StarsColor0   = EditorGUILayout.ColorField(new GUIContent("Color"), instance.StarsColor0, true, true, true);
                        instance.StarsDensity0 = EditorGUILayout.Slider("Density", instance.StarsDensity0, 0.01f, 1f);
                        instance.StarsSize0    = EditorGUILayout.Slider("Size", instance.StarsSize0, 0.01f, 1f);
                        instance.StarsGlow0    = EditorGUILayout.Slider("Glow", instance.StarsGlow0, 0f, 1f);
                        instance.StarsTwinkle0 = EditorGUILayout.FloatField("Twinkle", instance.StarsTwinkle0);
                        EditorGUI.indentLevel -= 1;
                    }

                    if (instance.StarsLayerCount > 1)
                    {
                        JEditorCommon.Separator();
                        EditorGUILayout.LabelField("Layer 1");
                        EditorGUI.indentLevel += 1;
                        instance.StarsColor1   = EditorGUILayout.ColorField(new GUIContent("Color"), instance.StarsColor1, true, true, true);
                        instance.StarsDensity1 = EditorGUILayout.Slider("Density", instance.StarsDensity1, 0.01f, 1f);
                        instance.StarsSize1    = EditorGUILayout.Slider("Size", instance.StarsSize1, 0.01f, 1f);
                        instance.StarsGlow1    = EditorGUILayout.Slider("Glow", instance.StarsGlow1, 0f, 1f);
                        instance.StarsTwinkle1 = EditorGUILayout.FloatField("Twinkle", instance.StarsTwinkle1);
                        EditorGUI.indentLevel -= 1;
                    }

                    if (instance.StarsLayerCount > 2)
                    {
                        JEditorCommon.Separator();
                        EditorGUILayout.LabelField("Layer 2");
                        EditorGUI.indentLevel += 1;
                        instance.StarsColor2   = EditorGUILayout.ColorField(new GUIContent("Color"), instance.StarsColor2, true, true, true);
                        instance.StarsDensity2 = EditorGUILayout.Slider("Density", instance.StarsDensity2, 0.01f, 1f);
                        instance.StarsSize2    = EditorGUILayout.Slider("Size", instance.StarsSize2, 0.01f, 1f);
                        instance.StarsGlow2    = EditorGUILayout.Slider("Glow", instance.StarsGlow2, 0f, 1f);
                        instance.StarsTwinkle2 = EditorGUILayout.FloatField("Twinkle", instance.StarsTwinkle2);
                        EditorGUI.indentLevel -= 1;
                    }
                }
                if (instance.EnableStars && instance.UseBakedStars)
                {
                    instance.StarsCubemap    = JEditorCommon.InlineCubemapField("Cubemap", instance.StarsCubemap, -1);
                    instance.StarsTwinkleMap = JEditorCommon.InlineTexture2DField("Twinkle Map", instance.StarsTwinkleMap, -1);
                    instance.StarsOpacity    = EditorGUILayout.Slider("Opacity", instance.StarsOpacity, 0f, 1f);
                }
            });
        }