Example #1
0
	public static void LoadGeoFile()
	{
	    GameObject newGO = HEU_HAPIUtility.LoadGeoWithNewGeoSync();
	    if (newGO != null)
	    {
		HEU_EditorUtility.SelectObject(newGO);
	    }
	}
Example #2
0
	public static void CreateNewInputAsset()
	{
	    GameObject newCurveGO = HEU_HAPIUtility.CreateNewInputAsset();
	    if (newCurveGO != null)
	    {
		HEU_EditorUtility.SelectObject(newCurveGO);
	    }
	}
        /// <summary>
        /// Create a new Input SOP with given name.
        /// </summary>
        void CreateInput(string name)
        {
            GameObject newCurveGO = HEU_HAPIUtility.CreateNewInputAsset(name: name);

            if (newCurveGO != null)
            {
                HEU_EditorUtility.SelectObject(newCurveGO);
            }
        }
Example #4
0
	public static void CreateNewCurveAsset()
	{
	    GameObject newCurveGO = HEU_HAPIUtility.CreateNewCurveAsset();
	    if (newCurveGO != null)
	    {
		HEU_Curve.PreferredNextInteractionMode = HEU_Curve.Interaction.ADD;
		HEU_EditorUtility.SelectObject(newCurveGO);
	    }
	}
        /// <summary>
        /// Create a new Curve SOP with given name.
        /// </summary>
        void CreateCurve(string name)
        {
            GameObject newCurveGO = HEU_HAPIUtility.CreateNewCurveAsset(name: name);

            if (newCurveGO != null)
            {
                HEU_Curve.PreferredNextInteractionMode = HEU_Curve.Interaction.ADD;
                HEU_EditorUtility.SelectObject(newCurveGO);
            }
        }
Example #6
0
		public static void ExecuteToolNoInput(string toolName, string toolPath)
		{
			GameObject go = HEU_HAPIUtility.InstantiateHDA(toolPath, Vector3.zero, HEU_SessionManager.GetOrCreateDefaultSession(), false);
			if (go == null)
			{
				Debug.LogWarningFormat("Failed to instantiate tool: {0}", toolName);
			}
			else
			{
				HEU_EditorUtility.SelectObject(go);
			}
		}
		private static void LoadHoudiniAssetFromPath(string hdaPath)
		{
			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);
				}
			}
		}
Example #8
0
		public static void ExecuteToolGenerator(string toolName, string toolPath, Vector3 targetPosition, Quaternion targetRotation, Vector3 targetScale)
		{
			GameObject go = HEU_HAPIUtility.InstantiateHDA(toolPath, targetPosition, HEU_SessionManager.GetOrCreateDefaultSession(), true);
			if (go != null)
			{
				go.transform.rotation = targetRotation;
				go.transform.localScale = targetScale;

				HEU_EditorUtility.SelectObject(go);
			}
			else
			{
				Debug.LogWarningFormat("Failed to instantiate tool: {0}", toolName);
			}
		}
		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);
					}
				}
			}
		}
Example #10
0
		public static void ExecuteToolOperatorSingle(string toolName, string toolPath, GameObject[] inputObjects)
		{
			GameObject go = HEU_HAPIUtility.InstantiateHDA(toolPath, Vector3.zero, HEU_SessionManager.GetOrCreateDefaultSession(), true);
			if (go != null)
			{
				HEU_HoudiniAssetRoot assetRoot = go.GetComponent<HEU_HoudiniAssetRoot>();
				if (assetRoot != null)
				{
					//assetRoot._houdiniAsset
					// TODO
				}

				HEU_EditorUtility.SelectObject(go);
			}
			else
			{
				Debug.LogWarningFormat("Failed to instantiate tool: {0}", toolName);
			}
		}
Example #11
0
		public static void ExecuteToolOperatorMultiple(string toolName, string toolPath, GameObject[] inputObjects)
		{
			GameObject outputObjectToSelect = null;

			GameObject go = HEU_HAPIUtility.InstantiateHDA(toolPath, Vector3.zero, HEU_SessionManager.GetOrCreateDefaultSession(), false);
			if(go == null)
			{
				Debug.LogWarningFormat("Failed to instantiate tool: {0}", toolName);
				return;
			}

			HEU_HoudiniAssetRoot assetRoot = go.GetComponent<HEU_HoudiniAssetRoot>();
			if (assetRoot != null)
			{
				HEU_HoudiniAsset asset = assetRoot._houdiniAsset;
				HEU_SessionBase session = asset.GetAssetSession(true);

				int numInputs = inputObjects.Length;

				List<HEU_InputNode> inputNodes = asset.GetInputNodes();
				if (inputNodes == null || inputNodes.Count == 0)
				{
					Debug.LogErrorFormat("Unable to assign input geometry due to no asset inputs on selected tool.");
				}
				else
				{
					// User could have selected any number of inputs objects, and asset could have any number of inputs.
					// So use minimum of either to set input object into asset input.
					int minInputCount = Mathf.Min(inputNodes.Count, numInputs);
					for (int i = 0; i < minInputCount; ++i)
					{
						if (!IsValidInput(inputObjects[i]))
						{
							continue;
						}
						GameObject inputObject = inputObjects[i];

						HEU_InputNode inputNode = inputNodes[i];
						inputNode.ResetInputNode(session);

						inputNode.ChangeInputType(session, HEU_InputNode.InputObjectType.UNITY_MESH);

						HEU_InputObjectInfo inputInfo = inputNode.AddInputEntryAtEnd(inputObject);
						inputInfo._useTransformOffset = false;
						inputNode.KeepWorldTransform = true;
						inputNode.PackGeometryBeforeMerging = false;

						inputNode.RequiresUpload = true;
					}

					asset.RequestCook(true, true, true, true);

					outputObjectToSelect = assetRoot.gameObject;
				}
			}

			if (outputObjectToSelect != null)
			{
				HEU_EditorUtility.SelectObject(outputObjectToSelect);
			}
		}