示例#1
0
        //============================================================
        public static void Save(EchoPFXManager iepfxm)
        {
            EchoPFXRenderGroup erg;
            StreamWriter       sw;
            string             fileName;

            fileName = EditorUtility.SaveFilePanel("Save PostFX setup", myPath, "echoPOSTFXSettings", "xml");

            if (fileName == null || fileName == "")
            {
                return;
            }

            xfile = new XmlDocument();

            xfile.AppendChild(xfile.CreateXmlDeclaration("1.0", null, null));

            root = xfile.CreateElement("PostFX");
            root.SetAttribute("FPS", iepfxm.frameRate.ToString());
            root.SetAttribute("DEPTH", iepfxm.managerCameraDepth.ToString());
            xfile.AppendChild(root);

            for (int loop = 0; loop < iepfxm.ergList.Count; loop++)
            {
                erg = iepfxm.ergList[loop];
                SaveRenderGroup(erg, root);
            }

            sw = new StreamWriter(fileName);
            xfile.Save(sw);
            sw.Close();
        }
示例#2
0
        //============================================================
        public static EchoPFXRenderGroup Load(EchoPFXManager iepfxm)
        {
            XmlNode      lroot;
            string       fileName;
            StreamReader sr;

            fileName = EditorUtility.OpenFilePanel("Open PostFX setup", myPath, "xml");

            if (fileName == null || fileName == "")
            {
                return(null);
            }

            sr = new StreamReader(fileName);

            xfile = new XmlDocument();
            xfile.LoadXml(sr.ReadToEnd());
            sr.Close();

            lroot = xfile["PostFX"];

            iepfxm.frameRate          = int.Parse(lroot.Attributes["FPS"].Value);
            iepfxm.managerCameraDepth = int.Parse(lroot.Attributes["DEPTH"].Value);

            // Render Groups
            iepfxm.ergList.Clear();
            _curID = 0;

            for (int loop = 0; loop < lroot.ChildNodes.Count; loop++)
            {
                iepfxm.ergList.Add(LoadRenderGroup(lroot.ChildNodes[loop]));
            }

            if (iepfxm.ergList.Count > 0)
            {
                return(iepfxm.ergList[0]);
            }

            return(null);
        }
示例#3
0
    //=========================================================================
    void OnEnable()
    {
        EchoPFXEffect epe;

        LoadPrefs();

        _customOpt = null;
        epfxm      = (EchoPFXManager)target;

        serializedObject.Update();
//		postFX.Update();

        if (epfxm.ergList.Count < 1)
        {
            SetNewRenderGroup(new EchoPFXRenderGroup(GetGroupID()), true);
        }

        if (_ergIndex < 0 || _ergIndex >= epfxm.ergList.Count)
        {
            _ergIndex = 0;
        }

        _erg = epfxm.ergList[_ergIndex];

        if (_epeIndex < 0 || _epeIndex >= _erg.epeList.Count)
        {
            if (_erg.epeList.Count < 1)
            {
                epe      = new EchoPFXEffect();
                epe.name = "New Effect";
                _erg.epeList.Add(epe);
                _epeIndex = _erg.epeList.IndexOf(epe);
            }
        }

        EditorApplication.playmodeStateChanged = AutoCompileShaders;

        //epfxm.UpdateAllRenderGroups();
    }