Exemple #1
0
	public void UploadParameterPreset(HEU_SessionBase session, HAPI_NodeId geoID, HEU_HoudiniAsset parentAsset)
	{
	    // TODO FIXME
	    // This fixes up the geo IDs for curves, and upload parameter values to Houdini.
	    // This is required for curves in saved scenes, as its parameter data is not part of the parent asset's
	    // parameter preset. Also the _geoID and parameters._nodeID could be different so uploading the
	    // parameter values before cooking would not be valid for those IDs. This waits until after cooking
	    // to then upload and cook just the curve.
	    // Admittedly this is a temporary solution until a proper workaround is in place. Ideally for an asset reload
	    // the object node and geo node names can be used to match up the IDs and then parameter upload can happen
	    // before cooking.

	    _geoID = geoID;

	    if (_parameters != null)
	    {
		_parameters._nodeID = geoID;

		if (_bUploadParameterPreset)
		{
		    _parameters.UploadPresetData(session);
		    _parameters.UploadValuesToHoudini(session, parentAsset);

		    HEU_HAPIUtility.CookNodeInHoudini(session, geoID, false, _curveName);

		    _bUploadParameterPreset = false;
		}
	    }
	}
Exemple #2
0
        public static bool CreateAndCookCurveAsset(HEU_SessionBase session, string assetName, bool bCookTemplatedGeos, out HAPI_NodeId newAssetID)
        {
            newAssetID = HEU_Defines.HEU_INVALID_NODE_ID;
            if (!session.CreateNode(HEU_Defines.HEU_INVALID_NODE_ID, "SOP/curve", "Curve", true, out newAssetID))
            {
                return(false);
            }

            // Make sure cooking is successfull before proceeding. Any licensing or file data issues will be caught here.
            if (!HEU_HAPIUtility.ProcessHoudiniCookStatus(session, assetName))
            {
                return(false);
            }

            // In case the cooking wasn't done previously, force it now.
            bool bResult = HEU_HAPIUtility.CookNodeInHoudini(session, newAssetID, bCookTemplatedGeos, assetName);

            if (!bResult)
            {
                // When cook failed, delete the node created earlier
                session.DeleteNode(newAssetID);
                newAssetID = HEU_Defines.HEU_INVALID_NODE_ID;
                return(false);
            }

            return(true);
        }
Exemple #3
0
        public static bool CreateAndCookInputAsset(HEU_SessionBase session, string assetName, bool bCookTemplatedGeos, out HAPI_NodeId newAssetID)
        {
            newAssetID = HEU_Defines.HEU_INVALID_NODE_ID;
            if (!session.CreateInputNode(out newAssetID, null))
            {
                return(false);
            }

            // Make sure cooking is successfull before proceeding. Any licensing or file data issues will be caught here.
            if (!HEU_HAPIUtility.ProcessHoudiniCookStatus(session, assetName))
            {
                return(false);
            }

            // In case the cooking wasn't done previously, force it now.
            bool bResult = HEU_HAPIUtility.CookNodeInHoudini(session, newAssetID, bCookTemplatedGeos, assetName);

            if (!bResult)
            {
                // When cook failed, deleted the node created earlier
                session.DeleteNode(newAssetID);
                newAssetID = HEU_Defines.HEU_INVALID_NODE_ID;
                return(false);
            }

            // After cooking, set an empty partinfo
            HAPI_GeoInfo inputGeoInfo = new HAPI_GeoInfo();

            if (!session.GetDisplayGeoInfo(newAssetID, ref inputGeoInfo))
            {
                return(false);
            }

            HAPI_PartInfo newPart = new HAPI_PartInfo();

            newPart.init();
            newPart.id          = 0;
            newPart.vertexCount = 0;
            newPart.faceCount   = 0;
            newPart.pointCount  = 0;
            // TODO: always set to mesh type?
            newPart.type = HAPI_PartType.HAPI_PARTTYPE_MESH;

            if (!session.SetPartInfo(inputGeoInfo.nodeId, 0, ref newPart))
            {
                Debug.LogErrorFormat(HEU_Defines.HEU_NAME + ": Failed to set partinfo for input node!");
                return(false);
            }

            return(true);
        }
Exemple #4
0
		/// <summary>
		/// This reverts local modifcations, refresh upstream inputs, and cooks the editable node.
		/// This ensures that the node will use the latest upstream input data before applying its own changes.
		/// </summary>
		/// <param name="session"></param>
		public void RefreshUpstreamInputs(HEU_SessionBase session)
		{
			session.RevertGeo(_geoID);

			HEU_HAPIUtility.CookNodeInHoudini(session, _geoID, false, "");
		}