public static void Init(AnimatedPNGsOutput _src, RenderTexture[] frames)
        {
            // Get existing open window or if none, make a new one:
            AnimatedPNGPreviewWindow window = (AnimatedPNGPreviewWindow)EditorWindow.GetWindow(typeof(AnimatedPNGPreviewWindow));

            window.m_Src    = _src;
            window.m_Frames = frames;
            window.m_SW     = Stopwatch.StartNew();
            window.Show();
        }
        public override void DrawNodePropertyEditor()
        {
            base.DrawNodePropertyEditor();

            m_StartAnimatedValue = RTEditorGUI.Slider("Start Animated Value ", m_StartAnimatedValue, -10, 10);
            m_EndAnimatedValue   = RTEditorGUI.Slider("End Animated Value ", m_EndAnimatedValue, -10, 10);
            m_LoopCount          = (int)RTEditorGUI.Slider("Frame Count ", m_LoopCount, 1, 64);
            if (m_LoopCount < 1)
            {
                m_LoopCount = 1;
            }

            if (GUILayout.Button("Choose OutputPath"))
            {
                m_PathName = EditorUtility.SaveFilePanel("SavePNG", "Assets/", m_PathName, "png");
            }
            if (GUILayout.Button("preview"))
            {
                if (m_Param == null)
                {
                    NodeEditor.RecalculateFrom(this);
                }


                RenderTexture[] frames = new RenderTexture[m_LoopCount];

                if (m_LoopCount > 0 && m_LoopCount < 500)
                {
                    Material m = GetMaterial("TextureOps");
                    foreach (var x in CalculateIE(0))
                    {
                        CreateOutputTexture();
                        if (m_Param != null && m_Param.m_Destination != null)
                        {
                            m.SetInt("_MainIsGrey", m_Param.IsGrey() ? 1 : 0);

                            RenderTexture rt = new RenderTexture(m_Param.m_Width, m_Param.m_Height, 0, RenderTextureFormat.ARGB32);
                            frames[x] = rt;
                            Graphics.Blit(m_Param.GetHWSourceTexture(), rt, m, (int)ShaderOp.CopyColorAndAlpha);
                        }
                    }
                    AnimatedPNGPreviewWindow.Init(this, frames);
                }
            }

            if (GUILayout.Button("save png's "))
            {
                foreach (var x in CalculateIE(0))
                {
                    CreateOutputTexture();
                    if (m_Param != null && m_Param.m_Destination != null)
                    {
                        string pathrename;
                        if (x < 10)
                        {
                            pathrename = m_PathName.Replace(".png", "0" + x + ".png");
                        }
                        else
                        {
                            pathrename = m_PathName.Replace(".png", "" + x + ".png");
                        }

                        m_Param.SavePNG(pathrename);
                    }
                    else
                    {
                        Debug.LogError(" null m_Param after rebuild all " + m_Param);
                        break;
                    }
                }

                /*
                 *      InputNode m_AnimatedValue = Inputs[2].connection.body as InputNode;
                 *      if (m_AnimatedValue != null)
                 *      {
                 *
                 *          if (!string.IsNullOrEmpty(m_PathName)&& m_LoopCount > 0 && m_LoopCount < 500)
                 *          {
                 *              int count = 0;
                 *              float step = (m_EndAnimatedValue - m_StartAnimatedValue)/ m_LoopCount;
                 *              for (float t = m_StartAnimatedValue; t < m_EndAnimatedValue; t += step)
                 *              {
                 *                  m_AnimatedValue.m_Value.Set(t);
                 *                  //NodeEditor.RecalculateFrom(m_AnimatedValue);
                 *
                 *
                 *                  if (m_Param != null && m_Param.m_Destination != null)
                 *                  {
                 *                      string pathrename;
                 *                      if(count<10)
                 *                          pathrename = m_PathName.Replace(".png", "0" + count + ".png");
                 *                      else
                 *                          pathrename = m_PathName.Replace(".png", "" + count + ".png");
                 *                      count++;
                 *                      m_Param.SavePNG(pathrename);
                 *                  }
                 *                  else
                 *                  {
                 *                      Debug.LogError(" null m_Param after rebuild all "+m_Param);
                 *                      break;
                 *                  }
                 *              }
                 *          }
                 *      }
                 */
            }
#if UNITY_EDITOR
            m_PathName = (string)GUILayout.TextField(m_PathName);
#endif


            /*
             *  GUILayout.BeginArea(new Rect(0, 40, 150, 256));
             *  if (m_Cached != null)
             *  {
             *      GUILayout.Label(m_Cached);
             *  }
             *  GUILayout.EndArea();
             */
        }