Ejemplo n.º 1
0
 public static void SetHidden(List <ShaderPart> parts, bool set_hidden)
 {
     foreach (ShaderPart part in parts)
     {
         if (part.GetType() == typeof(ShaderHeader) && part.options.is_hideable)
         {
             SetHidden((ShaderHeader)part, set_hidden, false);
         }
     }
     PersistentData.Set("HiddenHeaderNames", Parser.Serialize(headerHiddenSaved));
 }
Ejemplo n.º 2
0
        public static void SetHidden(ShaderHeader header, bool set_hidden)
        {
            bool contains = headerHiddenSaved.ContainsKey(header.materialProperty.name);

            if (!contains || (contains && headerHiddenSaved[header.materialProperty.name] != set_hidden))
            {
                headerHiddenSaved[header.materialProperty.name] = set_hidden;
                header.is_hidden = set_hidden;
                PersistentData.Set("HiddenHeaderNames", Parser.Serialize(headerHiddenSaved));
            }
        }
Ejemplo n.º 3
0
        public static Animation Parse(string path)
        {
            string data = FileHelper.ReadFileIntoString(path);

            List <PPtrCurve> pPtrCurves = new List <PPtrCurve>();
            int pptrIndex;
            int lastIndex = 0;

            while ((pptrIndex = data.IndexOf("m_PPtrCurves", lastIndex)) != -1)
            {
                lastIndex = pptrIndex + 1;
                int pptrEndIndex = data.IndexOf("  m_", pptrIndex);

                int curveIndex;
                int lastCurveIndex = pptrIndex;
                //find all curves
                while ((curveIndex = data.IndexOf("  - curve:", lastCurveIndex, pptrEndIndex - lastCurveIndex)) != -1)
                {
                    lastCurveIndex = curveIndex + 1;
                    int curveEndIndex = data.IndexOf("    script: ", curveIndex);

                    PPtrCurve           curve     = new PPtrCurve();
                    List <PPtrKeyframe> keyframes = new List <PPtrKeyframe>();

                    int keyFrameIndex;
                    int lastKeyFrameIndex = curveIndex;
                    while ((keyFrameIndex = data.IndexOf("    - time:", lastKeyFrameIndex, curveEndIndex - lastKeyFrameIndex)) != -1)
                    {
                        lastKeyFrameIndex = keyFrameIndex + 1;
                        int keyFrameEndIndex = data.IndexOf("}", keyFrameIndex);

                        PPtrKeyframe keyframe = new PPtrKeyframe();
                        keyframe.time = float.Parse(data.Substring(keyFrameIndex, data.IndexOf("\n", keyFrameIndex, keyFrameEndIndex)));
                        keyframes.Add(keyframe);
                    }

                    curve.curveType = data.IndexOf("    attribute: m_Materials", lastKeyFrameIndex, curveEndIndex - lastKeyFrameIndex) != -1 ? PPtrType.Material : PPtrType.None;
                    curve.keyframes = keyframes.ToArray();
                    pPtrCurves.Add(curve);
                }
            }
            Animation animation = new Animation();

            animation.pPtrCurves = pPtrCurves.ToArray();
            Debug.Log(Parser.Serialize(animation));
            return(animation);
        }