private bool HandleDropData() { if(m_CurrentAsset == null) return false; if(sidePanelViewMode == SidePanelMode.InputFrames && DragAndDrop.paths.Length > 0) { DragAndDrop.visualMode = DragAndDropVisualMode.Link; if( Event.current.type == EventType.DragExited) { List<string> texturePaths = new List<string>(); foreach(string path in DragAndDrop.paths) { if (VFXToolboxUtility.IsDirectory(path)) texturePaths.AddRange(VFXToolboxUtility.GetAllTexturesInPath(path)); else { VFXToolboxGUIUtility.DisplayProgressBar("Image Sequencer", "Discovering Assets...", 0.5f); Texture2D t = AssetDatabase.LoadAssetAtPath<Texture2D>(path); if(t != null) texturePaths.Add(path); } } AddInputFrame(m_InputFramesReorderableList, texturePaths); VFXToolboxGUIUtility.ClearProgressBar(); return true; } } return false; }
private void AddInputFrame(ReorderableList list) { if (Selection.activeObject == null) { Debug.LogWarning("Could not add frames with no selection : please select input frames to add in the project view and click the add button. Or drag & drop directly into the Image Sequencer Editor Window"); return; } string[] guids; List <string> names = new List <string>(); if (VFXToolboxUtility.IsDirectorySelected()) { names.AddRange(VFXToolboxUtility.GetAllTexturesInPath(AssetDatabase.GetAssetPath(Selection.activeObject))); } else { guids = Selection.assetGUIDs; foreach (string s in guids) { string path = AssetDatabase.GUIDToAssetPath(s); Texture2D t = AssetDatabase.LoadAssetAtPath <Texture2D>(path); if (t != null) { names.Add(path); } } } if (names.Count > 0) { Undo.RecordObject(m_CurrentAsset, "Add Input Frames"); AddInputFrame(list, names); } else { Debug.LogWarning("No suitable textures found in selection, make sure you selected either a directory containing textures or texture themselves in project view."); } }