ValidatePluginSession() public static method

Returns true if the plugin is installed properly, and that a session (new or existing) can be established. Notifies user if either fails. This can be called before each operation into Houdini Engine to establish or reconnect to session.
public static ValidatePluginSession ( HEU_SessionBase session = null ) : bool
session HEU_SessionBase
return bool
Ejemplo n.º 1
0
	public static void LoadHoudiniAssetExpandedWindow()
	{
	    if (HEU_SessionManager.ValidatePluginSession())
	    {
		string hdaPath = EditorUtility.OpenFolderPanel("Load Houdini Digital Asset (Expanded)", HEU_PluginSettings.LastLoadHDAPath, "");
		LoadHoudiniAssetFromPath(hdaPath, false);
	    }
	}
Ejemplo n.º 2
0
        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();
                }
            }
        }
Ejemplo n.º 3
0
	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);
	    }
	}
Ejemplo n.º 4
0
		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);
					}
				}
			}
		}