public override void OnInspectorGUI()
        {
            sky.Profile = JEditorCommon.ScriptableObjectField <JSkyProfile>("Profile", sky.Profile);
            profile     = sky.Profile;
            if (sky.Profile == null)
            {
                return;
            }
            dnc = sky.GetComponent <JDayNightCycle>();

            DrawSceneReferencesGUI();
            EditorGUI.BeginChangeCheck();
            DrawSkyGUI();
            DrawStarsGUI();
            DrawSunGUI();
            DrawMoonGUI();
            DrawHorizonCloudGUI();
            DrawOverheadCloudGUI();
            DrawDetailOverlayGUI();
            DrawUtilitiesGUI();

            if (EditorGUI.EndChangeCheck())
            {
                profile.UpdateMaterialProperties();
                EditorUtility.SetDirty(sky);
                EditorUtility.SetDirty(profile);
            }

            DrawAddDayNightCycleGUI();
        }
        public static JSky CreateStarryNightSky(MenuCommand cmd)
        {
            GameObject g = new GameObject("Starry Night Sky");

            if (cmd != null && cmd.context != null)
            {
                GameObject root = cmd.context as GameObject;
                GameObjectUtility.SetParentAndAlign(g, root);
            }

            JSky        skyComponent = g.AddComponent <JSky>();
            JSkyProfile profile      = JSkyProfile.CreateInstance <JSkyProfile>();
            string      fileName     = "SkyProfile-" + JCommon.GetUniqueID();
            string      filePath     = string.Format("Assets/{0}.asset", fileName);

            AssetDatabase.CreateAsset(profile, filePath);

            profile.CopyFrom(JJupiterSettings.Instance.DefaultProfileStarryNight);
            skyComponent.Profile        = profile;
            skyComponent.SunLightSource = null;

            Light[] lights = Object.FindObjectsOfType <Light>();
            for (int i = 0; i < lights.Length; ++i)
            {
                if (lights[i].type == LightType.Directional)
                {
                    skyComponent.MoonLightSource = lights[i];
                    break;
                }
            }

            return(skyComponent);
        }
        public override void OnInspectorGUI()
        {
            //sky.Profile = EditorGUILayout.ObjectField("Profile", sky.Profile, typeof(JSkyProfile), false) as JSkyProfile;
            sky.Profile = JEditorCommon.ScriptableObjectField <JSkyProfile>("Profile", sky.Profile);
            profile     = sky.Profile;
            if (sky.Profile == null)
            {
                return;
            }

            DrawSceneReferencesGUI();
            EditorGUI.BeginChangeCheck();
            DrawSkyGUI();
            DrawStarsGUI();
            DrawSunGUI();
            DrawMoonGUI();
            DrawHorizonCloudGUI();
            DrawOverheadCloudGUI();
            DrawDetailOverlayGUI();
            DrawUtilitiesGUI();

            if (EditorGUI.EndChangeCheck())
            {
                profile.UpdateMaterialProperties();
            }

            DrawAddDayNightCycleGUI();
        }
Exemple #4
0
        public void Reset()
        {
            JSkyProfile defaultProfile = JJupiterSettings.Instance.DefaultProfileSunnyDay;

            if (defaultProfile != this)
            {
                CopyFrom(defaultProfile);
            }
        }
 private void CheckDefaultProfileAndThrow(JSkyProfile p)
 {
     if (p == null)
     {
         return;
     }
     if (p == JJupiterSettings.Instance.DefaultProfileSunnyDay ||
         p == JJupiterSettings.Instance.DefaultProfileStarryNight)
     {
         throw new ArgumentException("Animating default sky profile is prohibited. You must create a new profile for your sky to animate it.");
     }
 }
 private void OnEnable()
 {
     sky     = target as JSky;
     profile = sky.Profile;
 }
 private void OnEnable()
 {
     instance = target as JSkyProfile;
 }
Exemple #8
0
        public void CopyFrom(JSkyProfile p)
        {
            SkyColor         = p.SkyColor;
            HorizonColor     = p.HorizonColor;
            GroundColor      = p.GroundColor;
            HorizonThickness = p.HorizonThickness;
            HorizonExponent  = p.HorizonExponent;
            HorizonStep      = p.HorizonStep;
            FogSyncOption    = p.FogSyncOption;
            FogColor         = p.FogColor;

            EnableStars        = p.EnableStars;
            StarsStartPosition = p.StarsStartPosition;
            StarsEndPosition   = p.StarsEndPosition;
            StarsOpacity       = p.StarsOpacity;
            StarsLayerCount    = p.StarsLayerCount;
            StarsColor0        = p.StarsColor0;
            StarsColor1        = p.StarsColor1;
            StarsColor2        = p.StarsColor2;
            StarsDensity0      = p.StarsDensity0;
            StarsDensity1      = p.StarsDensity1;
            StarsDensity2      = p.StarsDensity2;
            StarsSize0         = p.StarsSize0;
            StarsSize1         = p.StarsSize1;
            StarsSize2         = p.StarsSize2;
            StarsGlow0         = p.StarsGlow0;
            StarsGlow1         = p.StarsGlow1;
            StarsGlow2         = p.StarsGlow2;
            StarsTwinkle0      = p.StarsTwinkle0;
            StarsTwinkle1      = p.StarsTwinkle1;
            StarsTwinkle2      = p.StarsTwinkle2;
            UseBakedStars      = p.UseBakedStars;
            StarsCubemap       = p.StarsCubemap;
            StarsTwinkleMap    = p.StarsTwinkleMap;

            EnableSun         = p.EnableSun;
            SunTexture        = p.SunTexture;
            SunColor          = p.SunColor;
            SunSize           = p.SunSize;
            SunSoftEdge       = p.SunSoftEdge;
            SunGlow           = p.SunGlow;
            UseBakedSun       = p.UseBakedSun;
            SunCubemap        = p.SunCubemap;
            SunLightColor     = p.SunLightColor;
            SunLightIntensity = p.SunLightIntensity;

            EnableMoon         = p.EnableMoon;
            MoonTexture        = p.MoonTexture;
            MoonColor          = p.MoonColor;
            MoonSize           = p.MoonSize;
            MoonSoftEdge       = p.MoonSoftEdge;
            MoonGlow           = p.MoonGlow;
            UseBakedMoon       = p.UseBakedMoon;
            MoonCubemap        = p.MoonCubemap;
            MoonLightColor     = p.MoonLightColor;
            MoonLightIntensity = p.MoonLightIntensity;

            CustomCloudTexture = p.CustomCloudTexture;

            EnableHorizonCloud         = p.EnableHorizonCloud;
            HorizonCloudColor          = p.HorizonCloudColor;
            HorizonCloudStartPosition  = p.HorizonCloudStartPosition;
            HorizonCloudEndPosition    = p.HorizonCloudEndPosition;
            HorizonCloudSize           = p.HorizonCloudSize;
            HorizonCloudStep           = p.HorizonCloudStep;
            HorizonCloudAnimationSpeed = p.HorizonCloudAnimationSpeed;

            EnableOverheadCloud         = p.EnableOverheadCloud;
            OverheadCloudColor          = p.OverheadCloudColor;
            OverheadCloudAltitude       = p.OverheadCloudAltitude;
            OverheadCloudSize           = p.OverheadCloudSize;
            OverheadCloudStep           = p.OverheadCloudStep;
            OverheadCloudAnimationSpeed = p.OverheadCloudAnimationSpeed;
            OverheadCloudFlowDirectionX = p.OverheadCloudFlowDirectionX;
            OverheadCloudFlowDirectionZ = p.OverheadCloudFlowDirectionZ;

            EnableDetailOverlay        = p.EnableDetailOverlay;
            DetailOverlayTintColor     = p.DetailOverlayTintColor;
            DetailOverlayCubeMap       = p.DetailOverlayCubeMap;
            DetailOverlayLayer         = p.DetailOverlayLayer;
            DetailOverlayRotationSpeed = p.DetailOverlayRotationSpeed;

            AllowStepEffect = p.AllowStepEffect;

            UpdateMaterialProperties();
        }
 public static JSkyProfileInspectorDrawer Create(JSkyProfile instance)
 {
     return(new JSkyProfileInspectorDrawer(instance));
 }
 private JSkyProfileInspectorDrawer(JSkyProfile instance)
 {
     this.instance = instance;
 }