Esempio n. 1
0
        private void ProcessGeoCurve(HEU_SessionBase session)
        {
            HEU_HoudiniAsset parentAsset = ParentAsset;

            string curveName = GenerateGeoCurveName();

            curveName = HEU_EditorUtility.GetUniqueNameForSibling(ParentAsset.RootGameObject.transform, curveName);

            if (_geoCurve == null)
            {
                // New geo curve
                _geoCurve = HEU_Curve.CreateSetupCurve(parentAsset, Editable, curveName, GeoID, true);
            }
            else
            {
                _geoCurve.UploadParameterPreset(session, GeoID, parentAsset);
            }

            SetupGeoCurveGameObjectAndTransform(_geoCurve);
            _geoCurve.SetCurveName(curveName);

            _geoCurve.SyncFromParameters(session, parentAsset);

            // If geo node has part, generate the mesh using position attribute.
            // Note that without any parts we can't generate a mesh so we pass in an invalid part ID
            // to at least set default values.
            HAPI_PartId partID = _geoInfo.partCount > 0 ? 0 : HEU_Defines.HEU_INVALID_NODE_ID;

            _geoCurve.UpdateCurve(session, partID);
            _geoCurve.GenerateMesh(_geoCurve._targetGameObject);

            bool bIsVisible = IsVisible() && HEU_PluginSettings.Curves_ShowInSceneView;

            _geoCurve.SetCurveGeometryVisibility(bIsVisible);
        }
        /// <summary>
        /// Calculate the visibility of this geo node and its parts, based on whether the parent is visible.
        /// </summary>
        /// <param name="bParentVisibility">True if parent is visible</param>
        internal void CalculateVisiblity(bool bParentVisibility)
        {
            if (_geoCurve != null)
            {
                bool curveVisiblity = bParentVisibility && HEU_PluginSettings.Curves_ShowInSceneView;
                _geoCurve.SetCurveGeometryVisibility(curveVisiblity);
            }

            int numParts = _parts.Count;

            for (int i = 0; i < numParts; ++i)
            {
                _parts[i].CalculateVisibility(bParentVisibility, Displayable);
            }
        }