private void SetupGameObjectAndTransform(HEU_PartData partData, HEU_HoudiniAsset parentAsset) { // Set a valid gameobject for this part if (partData.OutputGameObject == null) { partData.SetGameObject(new GameObject()); } // The parent is either the asset root, OR if this is instanced and not visible, then the HDA data is the parent // The parent transform is either the asset root (for a display node), // or the HDA_Data gameobject (for instanced, not visible, intermediate, editable non-display nodes) Transform partTransform = partData.OutputGameObject.transform; if (partData.IsPartInstanced() || (_containerObjectNode.IsInstanced() && !_containerObjectNode.IsVisible()) || partData.IsPartCurve() || (IsIntermediateOrEditable() && !Displayable)) { partTransform.parent = parentAsset.OwnerGameObject.transform; } else { partTransform.parent = parentAsset.RootGameObject.transform; } HEU_GeneralUtility.CopyFlags(partTransform.parent.gameObject, partData.OutputGameObject, true); // Reset to origin partTransform.localPosition = Vector3.zero; partTransform.localRotation = Quaternion.identity; partTransform.localScale = Vector3.one; }
private void SetupGeoCurveGameObjectAndTransform(HEU_Curve curve) { if (curve._targetGameObject == null) { curve._targetGameObject = new GameObject(); } // For geo curve, the parent is the HDA_Data Transform curveTransform = curve._targetGameObject.transform; curveTransform.parent = ParentAsset.OwnerGameObject.transform; HEU_GeneralUtility.CopyFlags(curveTransform.parent.gameObject, curve._targetGameObject, true); // Reset to origin curveTransform.localPosition = Vector3.zero; curveTransform.localRotation = Quaternion.identity; curveTransform.localScale = Vector3.one; }