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; } partData.OutputGameObject.isStatic = partTransform.parent.gameObject.isStatic; // Reset to origin partTransform.localPosition = Vector3.zero; partTransform.localRotation = Quaternion.identity; partTransform.localScale = Vector3.one; }
private bool DrawDetailsGeometry() { bool bChanged = false; EditorGUIUtility.labelWidth = 250; { bool oldValue = HEU_PluginSettings.Curves_ShowInSceneView; bool newValue = HEU_EditorUI.DrawToggleLeft(oldValue, "Show Curves in Scene View"); if (newValue != oldValue) { HEU_PluginSettings.Curves_ShowInSceneView = newValue; HEU_HoudiniAsset.SetCurvesVisibilityInScene(newValue); bChanged = true; } } HEU_EditorUI.DrawSeparator(); { float oldValue = HEU_PluginSettings.NormalGenerationThresholdAngle; float newValue = EditorGUILayout.DelayedFloatField("Normal Generation Threshold Angle", oldValue); if (newValue != oldValue) { HEU_PluginSettings.NormalGenerationThresholdAngle = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); EditorGUIUtility.labelWidth = 0; return bChanged; }
public bool GetUpdatedPosition(HEU_HoudiniAsset asset, ref Vector3 inPosition) { if (_handleParamTranslateBinding == null || _handleParamTranslateBinding._bDisabled) { return false; } HEU_SessionBase session = asset.GetAssetSession(true); if(session == null) { return false; } if (IsSpecialRSTOrder(_rstOrder)) { HAPI_TransformEuler transformEuler = _convertedTransformEuler; transformEuler.position[0] = inPosition[0]; transformEuler.position[1] = inPosition[1]; transformEuler.position[2] = inPosition[2]; HAPI_TransformEuler newTransformEuler; if (!session.ConvertTransform(ref transformEuler, _rstOrder, _xyzOrder, out newTransformEuler)) { return false; } inPosition[0] = newTransformEuler.position[0]; inPosition[1] = newTransformEuler.position[1]; inPosition[2] = newTransformEuler.position[2]; } inPosition[0] = -inPosition[0]; return true; }
private void DrawInputNodesSection(HEU_HoudiniAsset asset, SerializedObject assetObject) { List<HEU_InputNode> inputNodes = asset.GetNonParameterInputNodes(); if (inputNodes.Count > 0) { HEU_EditorUI.BeginSection(); SerializedProperty showInputNodesProperty = HEU_EditorUtility.GetSerializedProperty(assetObject, "_showInputNodesSection"); if (showInputNodesProperty != null) { showInputNodesProperty.boolValue = HEU_EditorUI.DrawFoldOut(showInputNodesProperty.boolValue, "INPUT NODES"); if (showInputNodesProperty.boolValue) { foreach (HEU_InputNode inputNode in inputNodes) { HEU_InputNodeUI.EditorDrawInputNode(inputNode); if (inputNodes.Count > 1) { HEU_EditorUI.DrawSeparator(); } } } HEU_EditorUI.DrawSeparator(); } HEU_EditorUI.EndSection(); HEU_EditorUI.DrawSeparator(); } }
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; } } }
public void SetupMeshAndMaterials(HEU_HoudiniAsset asset, HAPI_PartType partType, GameObject outputGameObject) { _outputMesh = null; _outputGameObject = null; if (HEU_HAPIUtility.IsSupportedPolygonType(partType)) { // Get the generated mesh. If mesh is missing, nothing we can do. MeshFilter meshFilter = outputGameObject.GetComponent<MeshFilter>(); if (meshFilter != null && meshFilter.sharedMesh != null) { _outputMesh = meshFilter.sharedMesh; } else { // Without a valid mesh, we won't be able to paint so nothing else to do return; } _outputGameObject = outputGameObject; if (_localMaterial == null) { MeshRenderer meshRenderer = _outputGameObject.GetComponent<MeshRenderer>(); if(meshRenderer != null) { _localMaterial = HEU_MaterialFactory.GetNewMaterialWithShader(null, HEU_PluginSettings.DefaultVertexColorShader, HEU_Defines.EDITABLE_MATERIAL, false); } } } }
private void ClearCache() { if (_toolsInfoSerializedObject != null) { SerializedProperty isPaintingProperty = HEU_EditorUtility.GetSerializedProperty(_toolsInfoSerializedObject, "_isPainting"); PaintingFinished(isPaintingProperty); } _selectedAttributesStore = null; _selectedAttributeData = null; _attributesStores.Clear(); _serializedAttributesStoresCache.Clear(); if(_editPointBoxMaterial != null) { HEU_MaterialFactory.DestroyNonAssetMaterial(_editPointBoxMaterial, false); _editPointBoxMaterial = null; } DestroyEditPointBoxMesh(); _dragMouseDown = false; _asset = null; _toolsInfo = null; }
private void CookCompletedCallback(HEU_HoudiniAsset asset, bool bSuccess, List<GameObject> outputs) { if (_status == HEU_Task.TaskStatus.STARTED) { HEU_TaskManager.CompleteTask(this, bSuccess ? TaskResult.SUCCESS : TaskResult.FAILED); } }
/// <summary> /// Draw Asset Events section. /// </summary> /// <param name="asset"></param> /// <param name="assetObject"></param> private void DrawEventsSection(HEU_HoudiniAsset asset, SerializedObject assetObject) { HEU_EditorUI.BeginSection(); { SerializedProperty showEventsProperty = assetObject.FindProperty("_showEventsSection"); showEventsProperty.boolValue = HEU_EditorUI.DrawFoldOut(showEventsProperty.boolValue, "EVENTS"); if (showEventsProperty.boolValue) { HEU_EditorUI.DrawSeparator(); SerializedProperty reloadEvent = assetObject.FindProperty("_reloadEvent"); EditorGUILayout.PropertyField(reloadEvent, new GUIContent("Reload Events")); HEU_EditorUI.DrawSeparator(); SerializedProperty recookEvent = assetObject.FindProperty("_cookedEvent"); EditorGUILayout.PropertyField(recookEvent, new GUIContent("Cooked Events")); HEU_EditorUI.DrawSeparator(); SerializedProperty bakedEvent = assetObject.FindProperty("_bakedEvent"); EditorGUILayout.PropertyField(bakedEvent, new GUIContent("Baked Events")); } } HEU_EditorUI.EndSection(); HEU_EditorUI.DrawSeparator(); }
public void SetupMeshAndMaterials(HEU_HoudiniAsset asset, HAPI_PartType partType, GameObject outputGameObject) { _outputMesh = null; _outputGameObject = null; if (partType == HAPI_PartType.HAPI_PARTTYPE_MESH || partType == HAPI_PartType.HAPI_PARTTYPE_BOX || partType == HAPI_PartType.HAPI_PARTTYPE_SPHERE) { // Get the generated mesh. If mesh is missing, nothing we can do. MeshFilter meshFilter = outputGameObject.GetComponent<MeshFilter>(); if (meshFilter != null && meshFilter.sharedMesh != null) { _outputMesh = meshFilter.sharedMesh; } else { // Without a valid mesh, we won't be able to paint so nothing else to do return; } _outputGameObject = outputGameObject; if (_localMaterial == null) { MeshRenderer meshRenderer = _outputGameObject.GetComponent<MeshRenderer>(); if(meshRenderer != null) { _localMaterial = HEU_MaterialFactory.GetNewMaterialWithShader(null, HEU_MaterialFactory.GetHoudiniShaderPath(HEU_Defines.DEFAULT_VERTEXCOLOR_SHADER), HEU_Defines.EDITABLE_MATERIAL, false); } } } }
public void Start() { // Grab the HEU_HoduiniAsset _evergreenAsset = _evergreenGameObject.GetComponent <HEU_HoudiniAssetRoot>() != null?_evergreenGameObject.GetComponent <HEU_HoudiniAssetRoot>().HoudiniAsset : null; // Always get the latest parms after each cook List <HEU_ParameterData> parms = _evergreenAsset.Parameters.GetParameters(); foreach (HEU_ParameterData parmData in parms) { HEU_Logger.Log(parmData._labelName); if (parmData._parmInfo.type == HAPI_ParmType.HAPI_PARMTYPE_BUTTON) { // Display a button: parmData._intValues[0]; } else if (parmData._parmInfo.type == HAPI_ParmType.HAPI_PARMTYPE_FLOAT) { // Display a float: parmData._floatValues[0]; // You can set a float this way HEU_ParameterUtility.SetFloat(_evergreenAsset, parmData._name, 1f); // Or this way (the index is 0, unless its for array of floats) parmData._floatValues[0] = 1; } } // Make sure to cook after changing _evergreenAsset.RequestCook(true, false, true, true); // Start a repeating updater InvokeRepeating("UpdateGravity", _updateRate, _updateRate); }
private static void ProcessPendingBuildAction( HEU_HoudiniAsset.AssetBuildAction pendingBuildAction, SerializedProperty pendingBuildProperty, HEU_HoudiniAssetRoot assetRoot, SerializedObject assetRootSerializedObject, HEU_HoudiniAsset asset, SerializedObject assetObject) { if (pendingBuildAction != HEU_HoudiniAsset.AssetBuildAction.NONE) { // Sanity check to make sure the asset is part of the AssetUpater HEU_AssetUpdater.AddAssetForUpdate(asset); // Apply pending build action based on user UI interaction above pendingBuildProperty.enumValueIndex = (int)pendingBuildAction; if (pendingBuildAction == HEU_HoudiniAsset.AssetBuildAction.COOK) { // Recook should only update parameters that haven't changed. Otherwise if not checking and updating parameters, // then buttons will trigger callbacks on Recook which is not desired. SerializedProperty checkParameterChange = HEU_EditorUtility.GetSerializedProperty(assetObject, "_checkParameterChangeForCook"); if (checkParameterChange != null) { checkParameterChange.boolValue = true; } // But we do want to always upload input geometry on user hitting Recook expliclity SerializedProperty forceUploadInputs = HEU_EditorUtility.GetSerializedProperty(assetObject, "_forceUploadInputs"); if (forceUploadInputs != null) { forceUploadInputs.boolValue = true; } } } }
/// <summary> /// Draw asset options for given asset. /// </summary> /// <param name="asset">The HDA asset</param> /// <param name="assetObject">Serialized HDA asset object</param> private void DrawAssetOptions(HEU_HoudiniAsset asset, SerializedObject assetObject) { HEU_EditorUI.BeginSection(); { SerializedProperty showHDAOptionsProperty = assetObject.FindProperty("_showHDAOptions"); showHDAOptionsProperty.boolValue = HEU_EditorUI.DrawFoldOut(showHDAOptionsProperty.boolValue, "ASSET OPTIONS"); if (showHDAOptionsProperty.boolValue) { EditorGUI.indentLevel++; HEU_EditorUI.DrawPropertyField(assetObject, "_autoCookOnParameterChange", "Auto-Cook On Parameter Change"); HEU_EditorUI.DrawPropertyField(assetObject, "_pushTransformToHoudini", "Push Transform To Houdini"); HEU_EditorUI.DrawPropertyField(assetObject, "_transformChangeTriggersCooks", "Transform Change Triggers Cooks"); HEU_EditorUI.DrawPropertyField(assetObject, "_cookingTriggersDownCooks", "Cooking Triggers Downstream Cooks"); HEU_EditorUI.DrawPropertyField(assetObject, "_generateUVs", "Generate UVs"); HEU_EditorUI.DrawPropertyField(assetObject, "_generateTangents", "Generate Tangents"); HEU_EditorUI.DrawPropertyField(assetObject, "_ignoreNonDisplayNodes", "Ignore NonDisplay Nodes"); if (asset.NumAttributeStores() > 0) { HEU_EditorUI.DrawPropertyField(assetObject, "_editableNodesToolsEnabled", "Enable Editable Node Tools"); } if (asset.NumHandles() > 0) { HEU_EditorUI.DrawPropertyField(assetObject, "_handlesEnabled", "Enable Handles"); } EditorGUI.indentLevel--; } } HEU_EditorUI.EndSection(); HEU_EditorUI.DrawSeparator(); }
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> /// Draw the Object Instance Inputs section for given asset. /// </summary> /// <param name="asset">The HDA asset</param> /// <param name="assetObject">Serialized HDA asset object</param> private void DrawInstanceInputs(HEU_HoudiniAsset asset, SerializedObject assetObject) { if (_instanceInputUI == null) { _instanceInputUI = new HEU_InstanceInputUI(); } _instanceInputUI.DrawInstanceInputs(asset, assetObject); }
public void Start() { // Grab the HEU_HoduiniAsset _evergreenAsset = _evergreenGameObject.GetComponent <HEU_HoudiniAssetRoot>() != null?_evergreenGameObject.GetComponent <HEU_HoudiniAssetRoot>()._houdiniAsset : null; // Start a repeating updater InvokeRepeating("UpdateGravity", _updateRate, _updateRate); }
public void Initialize(HEU_SessionBase session, HAPI_ObjectInfo objectInfo, HAPI_Transform objectTranform, HEU_HoudiniAsset parentAsset) { _objectInfo = objectInfo; _objectTransform = objectTranform; _parentAsset = parentAsset; SyncWithObjectInfo(session); // Translate transform to Unity (TODO) List<HAPI_GeoInfo> geoInfos = new List<HAPI_GeoInfo>(); // Get display geo info HAPI_GeoInfo displayGeoInfo = new HAPI_GeoInfo(); if(!session.GetDisplayGeoInfo(_objectInfo.nodeId, ref displayGeoInfo)) { return; } //Debug.LogFormat("Found geoinfo with name {0} and id {1}", HEU_SessionManager.GetString(displayGeoInfo.nameSH, session), displayGeoInfo.nodeId); geoInfos.Add(displayGeoInfo); // TODO: The following editable node query also retrieves geo nodes for terrain with visualization nodes. Need to review to check if we're using the // correct query flags, and handling returned nodes correctly. // Get editable nodes, cook em, then create geo nodes for them HAPI_NodeId[] editableNodes = null; HEU_SessionManager.GetComposedChildNodeList(session, _objectInfo.nodeId, (int)HAPI_NodeType.HAPI_NODETYPE_SOP, (int)HAPI_NodeFlags.HAPI_NODEFLAGS_EDITABLE, true, out editableNodes); if(editableNodes != null) { foreach(HAPI_NodeId editNodeID in editableNodes) { if (editNodeID != displayGeoInfo.nodeId) { session.CookNode(editNodeID, HEU_PluginSettings.CookTemplatedGeos); HAPI_GeoInfo editGeoInfo = new HAPI_GeoInfo(); if (session.GetGeoInfo(editNodeID, ref editGeoInfo)) { geoInfos.Add(editGeoInfo); } } } } //Debug.LogFormat("Object id={5}, name={0}, isInstancer={1}, isInstanced={2}, instancePath={3}, instanceId={4}", // HEU_SessionManager.GetString(objectInfo.nameSH, session), objectInfo.isInstancer, objectInfo.isInstanced, // HEU_SessionManager.GetString(objectInfo.objectInstancePathSH, session), objectInfo.objectToInstanceId, objectInfo.nodeId); // Go through geo infos to create geometry int numGeoInfos = geoInfos.Count; for(int i = 0; i < numGeoInfos; ++i) { // Create GeoNode for each _geoNodes.Add(CreateGeoNode(session, geoInfos[i])); } // This has been moved to GenerateGeometry but kept here just in case. //ApplyObjectTransformToGeoNodes(); }
/// <summary> /// Query object nodes in the Asset. An object node represents a Houdini transform node. /// Each object might have any number of SOP geometry containers and a transform. /// <param name="houdiniAsset">The HEU_HoudiniAsset of the loaded asset</param> /// </summary> public static void QueryObjects(HEU_HoudiniAsset houdiniAsset) { // Get access to the Houdini Engine session used by this asset. // This gives access to call Houdini Engine APIs directly. HEU_SessionBase session = houdiniAsset.GetAssetSession(true); if (session == null || !session.IsSessionValid()) { Debug.LogWarningFormat("Invalid Houdini Engine session! Try restarting session."); return; } HAPI_ObjectInfo[] objectInfos = null; HAPI_Transform[] objectTransforms = null; HAPI_NodeInfo assetNodeInfo = houdiniAsset.NodeInfo; // Fill in object infos and transforms based on node type and number of child objects. // This the hiearchy of the HDA when loaded in Houdini Engine. It can contain subnets with // multiple objects containing multiple geometry, or a single object containting any number of geometry. // This automatically handles object-level HDAs and geometry (SOP) HDAs. if (!HEU_HAPIUtility.GetObjectInfos(session, houdiniAsset.AssetID, ref assetNodeInfo, out objectInfos, out objectTransforms)) { return; } // For each object, get the display and editable geometries contained inside. for (int i = 0; i < objectInfos.Length; ++i) { // Get display SOP geo info HAPI_GeoInfo displayGeoInfo = new HAPI_GeoInfo(); if (!session.GetDisplayGeoInfo(objectInfos[i].nodeId, ref displayGeoInfo)) { return; } QueryGeoParts(session, ref displayGeoInfo); // Optional: Get editable nodes, cook em, then create geo nodes for them HAPI_NodeId[] editableNodes = null; HEU_SessionManager.GetComposedChildNodeList(session, objectInfos[i].nodeId, (int)HAPI_NodeType.HAPI_NODETYPE_SOP, (int)HAPI_NodeFlags.HAPI_NODEFLAGS_EDITABLE, true, out editableNodes); if (editableNodes != null) { foreach (HAPI_NodeId editNodeID in editableNodes) { if (editNodeID != displayGeoInfo.nodeId) { session.CookNode(editNodeID, HEU_PluginSettings.CookTemplatedGeos); HAPI_GeoInfo editGeoInfo = new HAPI_GeoInfo(); if (session.GetGeoInfo(editNodeID, ref editGeoInfo)) { QueryGeoParts(session, ref editGeoInfo); } } } } } }
public static bool SetInputNode(HEU_HoudiniAsset asset, string paramName, GameObject obj, int index) { if (asset == null || asset.Parameters == null) { return false; } return asset.Parameters.SetAssetRefParameterValue(paramName, obj); }
public void Reset() { _objName = ""; _parentAsset = null; _objectInfo = new HAPI_ObjectInfo(); _geoNodes = new List<HEU_GeoNode>(); _objectTransform = new HAPI_Transform(true); }
public static void AddAssetForUpdate(HEU_HoudiniAsset asset) { #if UNITY_EDITOR && HOUDINIENGINEUNITY_ENABLED if (!_allHoudiniAssets.Contains(asset)) { _allHoudiniAssets.Add(asset); } #endif }
public static bool SetInt(HEU_HoudiniAsset asset, string paramName, int setValue) { if (asset == null || asset.Parameters == null) { return false; } return asset.Parameters.SetIntParameterValue(paramName, setValue); }
public static bool SetFloats(HEU_HoudiniAsset asset, string paramName, float[] setValues) { if (asset == null || asset.Parameters == null) { return false; } return asset.Parameters.SetFloatParameterValues(paramName, setValues); }
internal static bool CreateInputNodeWithMultiAssets(HEU_SessionBase session, HEU_HoudiniAsset parentAsset, ref HAPI_NodeId connectMergeID, ref List<HEU_InputHDAInfo> inputAssetInfos, bool bKeepWorldTransform, HAPI_NodeId mergeParentID = -1) { // Create the merge SOP node that the input nodes are going to connect to. if (!session.CreateNode(mergeParentID, "SOP/merge", null, true, out connectMergeID)) { HEU_Logger.LogErrorFormat("Unable to create merge SOP node for connecting input assets."); return false; } int numInputs = inputAssetInfos.Count; for (int i = 0; i < numInputs; ++i) { inputAssetInfos[i]._connectedInputNodeID = HEU_Defines.HEU_INVALID_NODE_ID; if (inputAssetInfos[i]._pendingGO == null) { continue; } // ID of the asset that will be connected HAPI_NodeId inputAssetID = HEU_Defines.HEU_INVALID_NODE_ID; HEU_HoudiniAssetRoot inputAssetRoot = inputAssetInfos[i]._pendingGO.GetComponent<HEU_HoudiniAssetRoot>(); if (inputAssetRoot != null && inputAssetRoot._houdiniAsset != null) { if (!inputAssetRoot._houdiniAsset.IsAssetValidInHoudini(session)) { // Force a recook if its not valid (in case it hasn't been loaded into the session) inputAssetRoot._houdiniAsset.RequestCook(true, false, true, true); } inputAssetID = inputAssetRoot._houdiniAsset.AssetID; } if (inputAssetID == HEU_Defines.HEU_INVALID_NODE_ID) { continue; } if (!session.ConnectNodeInput(connectMergeID, i, inputAssetID)) { HEU_Logger.LogErrorFormat("Unable to connect input nodes!"); return false; } inputAssetInfos[i]._connectedInputNodeID = inputAssetID; inputAssetInfos[i]._connectedGO = inputAssetInfos[i]._pendingGO; inputAssetInfos[i]._connectedMergeNodeID = connectMergeID; parentAsset.ConnectToUpstream(inputAssetRoot._houdiniAsset); } return true; }
public static GameObject CreateNewAsset(HEU_HoudiniAsset.HEU_AssetType assetType, string rootName = "HoudiniAsset", Transform parentTransform = null, HEU_SessionBase session = null, bool bBuildAsync = true) { if (session == null) { session = HEU_SessionManager.GetOrCreateDefaultSession(); } if (!session.IsSessionValid()) { Debug.LogWarning("Invalid Houdini Engine session!"); return(null); } // This will be the root GameObject for the HDA. Adding HEU_HoudiniAssetRoot // allows to use a custom Inspector. GameObject rootGO = new GameObject(); HEU_HoudiniAssetRoot assetRoot = rootGO.AddComponent <HEU_HoudiniAssetRoot>(); // Set the game object's name to the asset's name rootGO.name = string.Format("{0}{1}", rootName, rootGO.GetInstanceID()); // Under the root, we'll add the HEU_HoudiniAsset onto another GameObject // This will be marked as EditorOnly to strip out for builds GameObject hdaGEO = new GameObject(HEU_PluginSettings.HDAData_Name); hdaGEO.transform.parent = rootGO.transform; // This holds all Houdini Engine data HEU_HoudiniAsset asset = hdaGEO.AddComponent <HEU_HoudiniAsset>(); // Marking as EditorOnly to be excluded from builds if (HEU_GeneralUtility.DoesUnityTagExist(HEU_PluginSettings.EditorOnly_Tag)) { hdaGEO.tag = HEU_PluginSettings.EditorOnly_Tag; } // Bind the root to the asset assetRoot._houdiniAsset = asset; // Populate asset with what we know asset.SetupAsset(assetType, null, rootGO, session); // Build it in Houdini Engine asset.RequestReload(bBuildAsync); if (parentTransform != null) { rootGO.transform.parent = parentTransform; rootGO.transform.localPosition = Vector3.zero; } else { rootGO.transform.position = Vector3.zero; } return(rootGO); }
public void Setup(HEU_HoudiniAsset hdaAsset) { _heu = hdaAsset; _assetGO = _heu.RootGameObject; _assetPath = _heu.AssetPath; _assetName = _heu.AssetName; Reset(); Refresh(); }
public static bool GetFloats(HEU_HoudiniAsset asset, string paramName, out float[] outValues) { outValues = null; if (asset == null || asset.Parameters == null) { return false; } return asset.Parameters.GetFloatParameterValues(paramName, out outValues); }
public static bool GetInt(HEU_HoudiniAsset asset, string paramName, out int outValue) { outValue = 0; if (asset == null || asset.Parameters == null) { return false; } return asset.Parameters.GetIntParameterValue(paramName, out outValue); }
public static bool GetInputNode(HEU_HoudiniAsset asset, string paramName, int index, out GameObject obj) { obj = null; if (asset == null || asset.Parameters == null) { return false; } return asset.Parameters.GetAssetRefParameterValue(paramName, out obj); }
private void UpdateViewMode(HEU_HoudiniAsset asset, int controlID, EventType eventType, Vector3 mousePosition, List<SerializedObject> updatedCurves) { Event currentEvent = Event.current; switch (eventType) { case EventType.MouseDown: { break; } case EventType.MouseUp: { break; } case EventType.KeyUp: { if (!currentEvent.alt && currentEvent.keyCode == KeyCode.Space) { // Toggle modes SwitchToMode(HEU_Curve.Interaction.ADD); } else if (currentEvent.keyCode == KeyCode.F1) { _showInfo = !_showInfo; } break; } case EventType.KeyDown: { break; } case EventType.Repaint: { foreach (HEU_Curve curve in _curves) { // Draw the cooked curve using its vertices DrawCurveUsingVertices(curve, _unselectedCurveColor); DrawPointCaps(curve, _viewPointColor); } break; } case EventType.Layout: { break; } } }