コード例 #1
0
        /// <summary>
        /// Create the main heightfield network for input.
        /// </summary>
        /// <param name="session"></param>
        /// <param name="idt"></param>
        /// <returns>True if successfully created the network</returns>
        public bool CreateHeightFieldInputNode(HEU_SessionBase session, HEU_InputDataTerrain idt)
        {
            idt._heightfieldNodeID = HEU_Defines.HEU_INVALID_NODE_ID;
            idt._heightNodeID      = HEU_Defines.HEU_INVALID_NODE_ID;
            idt._maskNodeID        = HEU_Defines.HEU_INVALID_NODE_ID;
            idt._mergeNodeID       = HEU_Defines.HEU_INVALID_NODE_ID;

            // Create the HeightField node network
            bool bResult = session.CreateHeightFieldInput(idt._parentNodeID, idt._heightFieldName, idt._numPointsX, idt._numPointsY, idt._voxelSize,
                                                          HAPI_HeightFieldSampling.HAPI_HEIGHTFIELD_SAMPLING_CORNER,
                                                          out idt._heightfieldNodeID, out idt._heightNodeID, out idt._maskNodeID, out idt._mergeNodeID);

            if (!bResult ||
                idt._heightfieldNodeID == HEU_Defines.HEU_INVALID_NODE_ID ||
                idt._heightNodeID == HEU_Defines.HEU_INVALID_NODE_ID ||
                idt._maskNodeID == HEU_Defines.HEU_INVALID_NODE_ID ||
                idt._mergeNodeID == HEU_Defines.HEU_INVALID_NODE_ID)
            {
                Debug.LogError("Failed to create new heightfield node in Houdini session!");
                return(false);
            }

            if (!session.CookNode(idt._heightNodeID, false))
            {
                Debug.LogError("New input node failed to cook!");
                return(false);
            }

            return(true);
        }