Exemplo n.º 1
0
        // Render texture property.
        public bool RenderTextureGroupProperty(ProfileGroupDefinition def)
        {
            EditorGUILayout.BeginHorizontal();

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

            EditorGUILayout.PrefixLabel(new GUIContent(group.name, def.tooltip));
            bool valueChanged = false;

            if (m_Profile.IsManagedByTimeline(def.propertyKey))
            {
                RenderManagedOnTimlineMessage();
            }
            else
            {
                TextureKeyframe frame = group.GetKeyframe(0);
                EditorGUI.BeginChangeCheck();
                Texture assignedTexture = (Texture)EditorGUILayout.ObjectField(frame.texture, typeof(Texture), true);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(m_Profile, "Changed texture keyframe value");
                    frame.texture = assignedTexture;
                    valueChanged  = true;
                }
            }

            EditorGUILayout.EndHorizontal();
            return(valueChanged);
        }
Exemplo n.º 2
0
        private void AddTextureGroup(string propKey, string groupName, Texture2D texture)
        {
            TextureKeyframeGroup group = new TextureKeyframeGroup(
                groupName, new TextureKeyframe(texture, 0));

            keyframeGroups[propKey] = group;
        }
Exemplo n.º 3
0
        public Texture GetTexturePropertyValue(string propertyKey, float timeOfDay)
        {
            TextureKeyframeGroup group = GetGroup <TextureKeyframeGroup>(propertyKey);

            if (group == null)
            {
                Debug.LogError("Can't find texture group with property key: " + propertyKey);
                return(null);
            }

            return(group.TextureForTime(timeOfDay));
        }
Exemplo n.º 4
0
        private void ApplyDefaultSettings(SkyProfile profile)
        {
            // Lightning art.
            if (profile.lightningArtSet == null)
            {
                profile.lightningArtSet = GetDefaultArtStyleWithName <LightningArtSet>("DefaultLightningArtSet");
            }

            // Splash art.
            if (profile.rainSplashArtSet == null)
            {
                profile.rainSplashArtSet = GetDefaultArtStyleWithName <RainSplashArtSet>("DefaultRainSplashArtSet");
            }

            // Rain near texture.
            TextureKeyframeGroup group = profile.GetGroup <TextureKeyframeGroup>(ProfilePropertyKeys.RainNearTextureKey);

            if (group.keyframes.Count == 1 && group.keyframes[0].texture == null)
            {
                group.keyframes[0].texture = SkyEditorUtility.LoadEditorResourceTexture("RainDownfall-1");
                if (group.keyframes[0].texture == null)
                {
                    Debug.LogWarning("Failed to locate default near rain texture");
                }
            }

            // Rain far texture.
            group = profile.GetGroup <TextureKeyframeGroup>(ProfilePropertyKeys.RainFarTextureKey);
            if (group.keyframes.Count == 1 && group.keyframes[0].texture == null)
            {
                group.keyframes[0].texture = SkyEditorUtility.LoadEditorResourceTexture("RainDownfall-3");
                if (group.keyframes[0].texture == null)
                {
                    Debug.LogWarning("Failed to locate default far rain texture");
                }
            }
        }