예제 #1
0
        /// <summary>
        /// Saves the profile into the input configuration node.
        /// </summary>
        /// <param name="node"></param>
        public void SaveProfile(ConfigNode node)
        {
            if (ProfileName.StartsWith("Default-"))//provide in-config file warning for people to not trample on the default configs...
            {
                node.SetValue("name", ProfileName, "Current profile name.  Please make copies of the default profiles and specify new names if you wish to change settings.", true);
            }
            else
            {
                node.SetValue("name", ProfileName, true);
            }
            node.SetValue("hdr", HDREnabled, true);
            node.SetValue("antialiasing", AntiAliasing.ToString(), true);
            int len = Settings.Count;

            for (int i = 0; i < len; i++)
            {
                if (Settings[i].enabled)
                {
                    ConfigNode effectNode = new ConfigNode("EFFECT");
                    effectNode.SetValue("name", TUFXProfileManager.GetBuiltinEffect(Settings[i]).ToString(), true);
                    Settings[i].Save(effectNode);
                    node.AddNode(effectNode);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Loads the profile from the input configuration node.
        /// </summary>
        /// <param name="node"></param>
        public void LoadProfile(ConfigNode node)
        {
            ProfileName  = node.GetStringValue("name");
            HDREnabled   = node.GetBoolValue("hdr", false);
            AntiAliasing = node.GetEnumValue("antialiasing", PostProcessLayer.Antialiasing.None);
            Settings.Clear();
            ConfigNode[] effectNodes = node.GetNodes("EFFECT");
            int          len         = effectNodes.Length;

            for (int i = 0; i < len; i++)
            {
                BuiltinEffect             effect = effectNodes[i].GetEnumValue("name", BuiltinEffect.AmbientOcclusion);
                PostProcessEffectSettings set    = TUFXProfileManager.CreateEmptySettingsForEffect(effect);
                set.enabled.Override(true);
                set.Load(effectNodes[i]);
                Settings.Add(set);
            }
        }
예제 #3
0
        /// <summary>
        /// Saves the Unity PostProcessProfile into the input config node.<para/>
        /// It may or may not have a valid 'name' field, depending upon the name of the input profile.
        /// </summary>
        /// <param name="profile"></param>
        /// <param name="node"></param>
        public static void SaveProfile(PostProcessProfile profile, ConfigNode node)
        {
            node.SetValue("name", profile.name, true);
            node.SetValue("hdr", false, true);
            node.SetValue("antialiasing", PostProcessLayer.Antialiasing.None.ToString());
            int len = profile.settings.Count;

            for (int i = 0; i < len; i++)
            {
                if (profile.settings[i].enabled)
                {
                    ConfigNode effectNode = new ConfigNode("EFFECT");
                    effectNode.SetValue("name", TUFXProfileManager.GetBuiltinEffect(profile.settings[i]).ToString(), true);
                    profile.settings[i].Save(effectNode);
                    node.AddNode(effectNode);
                }
            }
        }