public static ValidatePluginSession ( HEU_SessionBase session = null ) : bool | ||
session | HEU_SessionBase | |
return | bool |
public static void LoadHoudiniAssetExpandedWindow() { if (HEU_SessionManager.ValidatePluginSession()) { string hdaPath = EditorUtility.OpenFolderPanel("Load Houdini Digital Asset (Expanded)", HEU_PluginSettings.LastLoadHDAPath, ""); LoadHoudiniAssetFromPath(hdaPath, false); } }
private static void ProcessDragEvent(Event dragEvent, SceneView sceneView) { if (dragEvent != null && (dragEvent.type == EventType.DragUpdated || dragEvent.type == EventType.DragPerform)) { bool dragHDAs = false; List <string> hdaList = new List <string>(); foreach (string file in DragAndDrop.paths) { if (HEU_HAPIUtility.IsHoudiniAssetFile(file)) { dragHDAs = true; DragAndDrop.visualMode = DragAndDropVisualMode.Move; hdaList.Add(file); break; } } if (dragHDAs) { if (dragEvent.type == EventType.DragPerform) { if (HEU_SessionManager.ValidatePluginSession()) { Vector3 dropPos = Vector3.zero; if (sceneView != null) { Camera camera = sceneView.camera; Vector3 mousePos = HEU_EditorUI.GetMousePosition(ref dragEvent, camera); Ray ray = camera.ScreenPointToRay(mousePos); ray.origin = camera.transform.position; Plane plane = new Plane(); plane.SetNormalAndPosition(Vector3.up, Vector3.zero); float enter = 0f; plane.Raycast(ray, out enter); enter = Mathf.Clamp(enter, camera.nearClipPlane, camera.farClipPlane); dropPos = ray.origin + ray.direction * enter; } List <GameObject> createdGOs = new List <GameObject>(); foreach (string file in hdaList) { GameObject go = HEU_HAPIUtility.InstantiateHDA(file, dropPos, HEU_SessionManager.GetOrCreateDefaultSession(), true); if (go != null) { createdGOs.Add(go); } } // Select the created assets HEU_EditorUtility.SelectObjects(createdGOs.ToArray()); } } dragEvent.Use(); } } }
public static void LoadHoudiniAssetWindowMemory() { if (HEU_SessionManager.ValidatePluginSession()) { string[] extensions = { "HDAs", "otl,hda,otllc,hdalc,otlnc,hdanc" }; string hdaPath = EditorUtility.OpenFilePanelWithFilters("Load Houdini Digital Asset", HEU_PluginSettings.LastLoadHDAPath, extensions); LoadHoudiniAssetFromPath(hdaPath, true); } }
public static void LoadHoudiniAssetWindow() { if (HEU_SessionManager.ValidatePluginSession()) { string[] extensions = { "HDAs", "otl,hda,otllc,hdalc,otlnc,hdanc" }; string hdaPath = EditorUtility.OpenFilePanelWithFilters("Load Houdini Digital Asset", HEU_PluginSettings.LastLoadHDAPath, extensions); if (!string.IsNullOrEmpty(hdaPath)) { // Store HDA path for next time HEU_PluginSettings.LastLoadHDAPath = Path.GetDirectoryName(hdaPath); GameObject go = HEU_HAPIUtility.InstantiateHDA(hdaPath, Vector3.zero, HEU_SessionManager.GetOrCreateDefaultSession(), true); if (go != null) { HEU_EditorUtility.SelectObject(go); } } } }