/// <summary> /// Fill up the given detailPrototype with values from the specified heightfield part. /// </summary> /// <param name="session">Houdini Engine session to query</param> /// <param name="geoID">The geometry ID in Houdini</param> /// <param name="partID">The part ID in Houdini</param> /// <param name="detailPrototype">The detail prototype object to populate</param> public static void PopulateDetailPrototype(HEU_SessionBase session, HAPI_NodeId geoID, HAPI_PartId partID, ref HEU_DetailPrototype detailPrototype) { // Get the detail prototype properties from attributes on this layer if (detailPrototype == null) { detailPrototype = new HEU_DetailPrototype(); } HAPI_AttributeInfo prefabAttrInfo = new HAPI_AttributeInfo(); string[] prefabPaths = HEU_GeneralUtility.GetAttributeStringData(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_PREFAB, ref prefabAttrInfo); if (prefabAttrInfo.exists && prefabPaths.Length >= 1) { detailPrototype._prototypePrefab = prefabPaths[0]; } HAPI_AttributeInfo textureAttrInfo = new HAPI_AttributeInfo(); string[] texturePaths = HEU_GeneralUtility.GetAttributeStringData(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_TEXTURE, ref textureAttrInfo); if (textureAttrInfo.exists && texturePaths.Length >= 1) { detailPrototype._prototypeTexture = texturePaths[0]; } float fvalue = 0; if (HEU_GeneralUtility.GetAttributeFloatSingle(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_BENDFACTOR, out fvalue)) { detailPrototype._bendFactor = fvalue; } Color color = Color.white; if (HEU_GeneralUtility.GetAttributeColorSingle(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_DRYCOLOR, ref color)) { detailPrototype._dryColor = color; } if (HEU_GeneralUtility.GetAttributeColorSingle(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_HEALTHYCOLOR, ref color)) { detailPrototype._healthyColor = color; } if (HEU_GeneralUtility.GetAttributeFloatSingle(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_MAXHEIGHT, out fvalue)) { detailPrototype._maxHeight = fvalue; } if (HEU_GeneralUtility.GetAttributeFloatSingle(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_MAXWIDTH, out fvalue)) { detailPrototype._maxWidth = fvalue; } if (HEU_GeneralUtility.GetAttributeFloatSingle(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_MINHEIGHT, out fvalue)) { detailPrototype._minHeight = fvalue; } if (HEU_GeneralUtility.GetAttributeFloatSingle(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_MINWIDTH, out fvalue)) { detailPrototype._minWidth = fvalue; } if (HEU_GeneralUtility.GetAttributeFloatSingle(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_NOISESPREAD, out fvalue)) { detailPrototype._noiseSpread = fvalue; } int iValue = 0; if (HEU_GeneralUtility.GetAttributeIntSingle(session, geoID, partID, HEU_Defines.HEIGHTFIELD_DETAIL_PROTOTYPE_RENDERMODE, out iValue)) { detailPrototype._renderMode = iValue; } }