public virtual void OnGUI() { if (m_bgBrightness < 0.0f) { ResetBrightness(); } // Focus taken when clicked in viewport if (Event.current.type == EventType.mouseDown && m_Rect.Contains(Event.current.mousePosition)) { GUI.FocusControl(""); } if (texture != null && Event.current.type == EventType.Repaint) { if (m_IsDirtyRenderTarget) { UpdateRenderTarget(); } if (m_bNeedRedraw) { BlitIntoRenderTarget(); m_bNeedRedraw = false; } } GUI.BeginGroup(m_Rect); Rect LocalRect = new Rect(Vector2.zero, m_Rect.size); GL.sRGBWrite = (QualitySettings.activeColorSpace == ColorSpace.Linear); GUI.DrawTextureWithTexCoords(LocalRect, BackgroundTexture, new Rect(0, 0, m_Rect.width / 64, m_Rect.height / 64)); GL.sRGBWrite = false; if (texture != null) { HandleKeyboardEvents(); GL.sRGBWrite = (QualitySettings.activeColorSpace == ColorSpace.Linear); DrawCurrentTexture(); GL.sRGBWrite = false; if (showGrid) { DrawGrid(); } if (onCanvasGUI != null) { onCanvasGUI(); } } else { GUI.Label(LocalRect, VFXToolboxGUIUtility.Get("No Texture"), EditorStyles.centeredGreyMiniLabel); } GL.sRGBWrite = false; GUI.EndGroup(); }
public static string[] GetAllTexturesInPath(string path) { List <string> files = new List <string>(); string absolutePath = Application.dataPath + "/" + path.Remove(0, 7); string [] fileEntries = Directory.GetFiles(absolutePath); int count = fileEntries.Length; int i = 0; foreach (string fileName in fileEntries) { string fname = fileName.Replace('\\', '/'); int index = fname.LastIndexOf('/'); string localPath = path; if (index > 0) { localPath += fname.Substring(index); } VFXToolboxGUIUtility.DisplayProgressBar("Image Sequencer", "Discovering Assets in folder...", (float)i / count); Texture2D t = AssetDatabase.LoadAssetAtPath <Texture2D>(localPath); if (t != null) { files.Add(localPath); } i++; } VFXToolboxGUIUtility.ClearProgressBar(); return(files.ToArray()); }