Beispiel #1
0
		HAPI_SetWorkitemIntData(
			ref HAPI_Session session,
			HAPI_NodeId node_id,
			HAPI_PDG_WorkitemId workitem_id,
			string data_name,
			int[] values_array,
			int length);
Beispiel #2
0
		HAPI_GetWorkitemStringData(
			ref HAPI_Session session,
			HAPI_NodeId node_id,
			HAPI_PDG_WorkitemId workitem_id,
			string data_name,
			StringBuilder data_array,
			int length);
Beispiel #3
0
		HAPI_GetWorkitemFloatData(
			ref HAPI_Session session,
			HAPI_NodeId node_id,
			HAPI_PDG_WorkitemId workitem_id,
			string data_name,
			[Out] float[] data_array,
			int length);
Beispiel #4
0
		HAPI_SetWorkitemStringData(
			ref HAPI_Session session,
			HAPI_NodeId node_id,
			HAPI_PDG_WorkitemId workitem_id,
			string data_name,
			int data_index,
			string value);
	private static HEU_TOPWorkResult GetWorkResultByID(HEU_TOPNodeData topNode, HAPI_PDG_WorkitemId workItemID)
	{
	    HEU_TOPWorkResult result = null;
	    foreach (HEU_TOPWorkResult res in topNode._workResults)
	    {
		if (res._workItemID == workItemID)
		{
		    result = res;
		    break;
		}
	    }
	    return result;
	}
Beispiel #6
0
        public static bool GetWorkitemFloatData(this HEU_SessionBase session, HAPI_NodeId node_id, HAPI_PDG_WorkitemId workitem_id, string data_name, [Out] float[] values_array, int length)
        {
            HAPI_Result result = HEU_HAPIImportsPDG.HAPI_GetWorkitemFloatData(ref session.GetSessionData()._HAPISession, node_id, workitem_id, data_name, values_array, length);

            session.HandleStatusResult(result, "Getting Workitem Float Data", false, true);
            return(result == HAPI_Result.HAPI_RESULT_SUCCESS);
        }
Beispiel #7
0
        public static bool GetWorkitemsDataLength(this HEU_SessionBase session, HAPI_NodeId node_id, HAPI_PDG_WorkitemId workitem_id, string data_name, out int length)
        {
            HAPI_Result result = HEU_HAPIImportsPDG.HAPI_GetWorkitemDataLength(ref session.GetSessionData()._HAPISession, node_id, workitem_id, data_name, out length);

            session.HandleStatusResult(result, "Getting Workitem Data Length", false, true);
            return(result == HAPI_Result.HAPI_RESULT_SUCCESS);
        }
Beispiel #8
0
        public static bool SetWorkitemStringData(this HEU_SessionBase session, HAPI_NodeId node_id, HAPI_PDG_WorkitemId workitem_id, string data_name, int data_index, string value)
        {
            HAPI_Result result = HEU_HAPIImportsPDG.HAPI_SetWorkitemStringData(ref session.GetSessionData()._HAPISession, node_id, workitem_id, data_name, data_index, value);

            session.HandleStatusResult(result, "Setting Workitem String Data", false, true);
            return(result == HAPI_Result.HAPI_RESULT_SUCCESS);
        }
	/// <summary>
	/// Load the geometry generated as results of the given work item, of the given TOP node.
	/// The load will be done asynchronously.
	/// Results must be tagged with 'file', and must have a file path, otherwise will not be loaded.
	/// </summary>
	/// <param name="session">Houdini Engine session that the TOP node is in</param>
	/// <param name="topNode">TOP node that the work item belongs to</param>
	/// <param name="workItemInfo">Work item whose results to load</param>
	/// <param name="resultInfos">Results data</param>
	/// <param name="workItemID">The work item's ID. Required for clearning its results.</param>
	public void LoadResults(HEU_SessionBase session, HEU_TOPNodeData topNode, HAPI_PDG_WorkitemInfo workItemInfo, HAPI_PDG_WorkitemResultInfo[] resultInfos, HAPI_PDG_WorkitemId workItemID)
	{
	    // Create HEU_GeoSync objects, set results, and sync it

	    string workItemName = HEU_SessionManager.GetString(workItemInfo.nameSH, session);
	    //Debug.LogFormat("Work item: {0}:: name={1}, results={2}", workItemInfo.index, workItemName, workItemInfo.numResults);

	    // Clear previously generated result
	    ClearWorkItemResultByID(topNode, workItemID);

	    if (resultInfos == null || resultInfos.Length == 0)
	    {
		return;
	    }

	    HEU_TOPWorkResult result = GetWorkResultByID(topNode, workItemID);
	    if (result == null)
	    {
		result = new HEU_TOPWorkResult();
		result._workItemIndex = workItemInfo.index;
		result._workItemID = workItemID;

		topNode._workResults.Add(result);
	    }

	    // Load each result geometry
	    int numResults = resultInfos.Length;
	    for (int i = 0; i < numResults; ++i)
	    {
		if (resultInfos[i].resultTagSH <= 0 || resultInfos[i].resultSH <= 0)
		{
		    continue;
		}

		string tag = HEU_SessionManager.GetString(resultInfos[i].resultTagSH, session);
		string path = HEU_SessionManager.GetString(resultInfos[i].resultSH, session);


		//Debug.LogFormat("Result for work item {0}: result={1}, tag={2}, path={3}", result._workItemIndex, i, tag, path);

		if (string.IsNullOrEmpty(tag) || !tag.StartsWith("file"))
		{
		    continue;
		}

		string name = string.Format("{0}_{1}_{2}",
			topNode._parentName,
			workItemName,
			workItemInfo.index);

		// Get or create parent GO
		if (topNode._workResultParentGO == null)
		{
		    topNode._workResultParentGO = new GameObject(topNode._nodeName);
		    HEU_GeneralUtility.SetParentWithCleanTransform(GetLoadRootTransform(), topNode._workResultParentGO.transform);
		    topNode._workResultParentGO.SetActive(topNode._showResults);
		}

		GameObject newOrExistingGO = null;
		int existingObjectIndex = -1;
		
		for (int j = 0; j < result._generatedGOs.Count; j++)
		{
			if (result._generatedGOs[j] != null)
			{
				HEU_GeoSync oldGeoSync = result._generatedGOs[j].GetComponent<HEU_GeoSync>();
				if (oldGeoSync != null && oldGeoSync._filePath == path)
				{
					oldGeoSync.Reset();
					existingObjectIndex = j;
					newOrExistingGO = result._generatedGOs[j];
					break;
				}
			}
		}

		if (existingObjectIndex < 0)
		{
			newOrExistingGO = new GameObject(name);
			result._generatedGOs.Add(newOrExistingGO);
		}


		HEU_GeneralUtility.SetParentWithCleanTransform(topNode._workResultParentGO.transform, newOrExistingGO.transform);

		// HEU_GeoSync does the loading
		HEU_GeoSync geoSync = newOrExistingGO.GetComponent<HEU_GeoSync>();

		if (geoSync == null)
		{
			geoSync = newOrExistingGO.AddComponent<HEU_GeoSync>();
		}

		geoSync._filePath = path;
		geoSync.SetOutputCacheDirectory(_outputCachePathRoot);
		geoSync.StartSync();
	    }
	}
Beispiel #10
0
        public static bool CreateWorkitem(this HEU_SessionBase session, HAPI_NodeId node_id, out HAPI_PDG_WorkitemId workitem_id, string name, int index)
        {
            HAPI_Result result = HEU_HAPIImportsPDG.HAPI_CreateWorkitem(ref session.GetSessionData()._HAPISession, node_id, out workitem_id, name, index);

            session.HandleStatusResult(result, "Creating Workitem", false, true);
            return(result == HAPI_Result.HAPI_RESULT_SUCCESS);
        }
Beispiel #11
0
		HAPI_CreateWorkitem(
			ref HAPI_Session session,
			HAPI_NodeId node_id,
			out HAPI_PDG_WorkitemId workitem_id,
			string name,
			int index);
Beispiel #12
0
		HAPI_GetWorkitemResultInfo(
			ref HAPI_Session session,
			HAPI_NodeId node_id,
			HAPI_PDG_WorkitemId workitem_id,
			[Out] HAPI_PDG_WorkitemResultInfo[] resultinfo_array,
			int resultinfo_count);
Beispiel #13
0
		HAPI_GetWorkitemDataLength(
			ref HAPI_Session session,
			HAPI_NodeId node_id,
			HAPI_PDG_WorkitemId workitem_id,
			string data_name,
			out int length);
Beispiel #14
0
        public static bool GetWorkitemStringData(this HEU_SessionBase session, HAPI_NodeId node_id, HAPI_PDG_WorkitemId workitem_id, string data_name, StringBuilder values, int length)
        {
            Debug.AssertFormat(values.Capacity >= length, "StringBuilder must be atleast of size {0}.", length);
            HAPI_Result result = HEU_HAPIImportsPDG.HAPI_GetWorkitemStringData(ref session.GetSessionData()._HAPISession, node_id, workitem_id, data_name, values, length);

            session.HandleStatusResult(result, "Getting Workitem String Data", false, true);
            return(result == HAPI_Result.HAPI_RESULT_SUCCESS);
        }
Beispiel #15
0
		HAPI_GetWorkitemInfo(
			ref HAPI_Session session,
			HAPI_PDG_GraphContextId graph_context_id,
			HAPI_PDG_WorkitemId workitem_id,
			ref HAPI_PDG_WorkitemInfo workitem_info);
Beispiel #16
0
        public static bool GetWorkitemResultInfo(this HEU_SessionBase session, HAPI_NodeId node_id, HAPI_PDG_WorkitemId workitem_id, [Out] HAPI_PDG_WorkitemResultInfo[] resultinfo_array, int resultinfo_count)
        {
            HAPI_Result result = HEU_HAPIImportsPDG.HAPI_GetWorkitemResultInfo(ref session.GetSessionData()._HAPISession, node_id, workitem_id, resultinfo_array, resultinfo_count);

            session.HandleStatusResult(result, "Getting Workitem Result Info", false, true);
            return(result == HAPI_Result.HAPI_RESULT_SUCCESS);
        }
	public static void ClearWorkItemResultByID(HEU_TOPNodeData topNode, HAPI_PDG_WorkitemId workItemID)
	{
	    HEU_TOPWorkResult result = GetWorkResultByID(topNode, workItemID);
	    ClearWorkItemResult(topNode, result);
	}
Beispiel #18
0
        public static bool GetWorkItemInfo(this HEU_SessionBase session, HAPI_PDG_GraphContextId graph_context_id, HAPI_PDG_WorkitemId workitem_id, ref HAPI_PDG_WorkitemInfo workitem_info)
        {
            HAPI_Result result = HEU_HAPIImportsPDG.HAPI_GetWorkitemInfo(ref session.GetSessionData()._HAPISession, graph_context_id, workitem_id, ref workitem_info);

            session.HandleStatusResult(result, "Getting WorkItem", false, true);
            return(result == HAPI_Result.HAPI_RESULT_SUCCESS);
        }
Beispiel #19
0
        public static bool SetWorkitemIntData(this HEU_SessionBase session, HAPI_NodeId node_id, HAPI_PDG_WorkitemId workitem_id, string data_name, int[] values_array, int length)
        {
            HAPI_Result result = HEU_HAPIFunctions.HAPI_SetWorkitemIntData(ref session.GetSessionData()._HAPISession, node_id, workitem_id, data_name.AsByteArray(), values_array, length);

            session.HandleStatusResult(result, "Setting Workitem Int Data", false, true);
            return(result == HAPI_Result.HAPI_RESULT_SUCCESS);
        }