/// <summary> /// Displays global PDG status /// </summary> private void DrawPDGStatus() { string pdgState = "PDG is NOT READY"; Color stateColor = Color.red; HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null) { if (pdgSession._pdgState == HAPI_PDG_State.HAPI_PDG_STATE_COOKING) { pdgState = "PDG is COOKING"; stateColor = Color.yellow; } else if (pdgSession._pdgState == HAPI_PDG_State.HAPI_PDG_STATE_READY) { pdgState = "PDG is READY"; stateColor = Color.green; } } EditorGUILayout.Space(); _boxStyleStatus.normal.textColor = stateColor; GUILayout.Box(pdgState, _boxStyleStatus); }
private void DrawPDGStatus() { string pdgState = "PDG is NOT READY"; Color stateColor = Color.red; HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null) { if (pdgSession._pdgState == HAPI_PDG_State.HAPI_PDG_STATE_COOKING) { pdgState = "PDG is COOKING"; stateColor = Color.yellow; //if (_assetLink != null) { //pdgState = string.Format("{0} ({1})", pdgState, _assetLink._workItemTally.ProgressRatio()); } } else if (pdgSession._pdgState == HAPI_PDG_State.HAPI_PDG_STATE_READY) { pdgState = "PDG is READY"; stateColor = Color.green; } } EditorGUILayout.Space(); _boxStyleStatus.normal.textColor = stateColor; GUILayout.Box(pdgState, _boxStyleStatus); }
/// <summary> /// Cook the specified TOP node. /// </summary> /// <param name="topNode"></param> public void CookTOPNode(HEU_TOPNodeData topNode) { HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null) { pdgSession.CookTOPNode(topNode._nodeID); } }
/// <summary> /// Dirty the specified TOP node and clear its work item results. /// </summary> /// <param name="topNode"></param> public void DirtyTOPNode(HEU_TOPNodeData topNode) { HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null && pdgSession.DirtyTOPNode(topNode._nodeID)) { ClearTOPNodeWorkItemResults(topNode); } }
private void OnDestroy() { HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null) { pdgSession.RemoveAsset(this); } }
private void OnDestroy() { HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null) { // Unregister on clean up pdgSession.RemoveAsset(this); } }
/// <summary> /// Dirty the currently selected TOP network and clear all work item results. /// </summary> public void DirtyAll() { HEU_TOPNetworkData topNetwork = GetSelectedTOPNetwork(); if (topNetwork != null) { HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null && pdgSession.DirtyAll(topNetwork._nodeID)) { ClearTOPNetworkWorkItemResults(topNetwork); } } }
/// <summary> /// Register self with the global HEU_PDGAssetLink list. /// </summary> private void HandleInitialLoad() { #if HOUDINIENGINEUNITY_ENABLED HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null) { pdgSession.AddAsset(this); } if (_linkState != LinkState.INACTIVE) { // On load this, need to relink _assetID = HEU_Defines.HEU_INVALID_NODE_ID; _linkState = LinkState.INACTIVE; // UI will take care of refreshing //Refresh(); } #endif }
/// <summary> /// Cancel the PDG cook of the currently selected TOP network /// </summary> public void CancelCook() { HEU_SessionBase session = GetHAPISession(); if (session == null || !session.IsSessionValid()) { return; } HEU_TOPNetworkData topNetwork = GetSelectedTOPNetwork(); if (topNetwork != null) { //Debug.Log("Cooking output!"); _workItemTally.ZeroAll(); ResetTOPNetworkWorkItemTally(topNetwork); HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null) { pdgSession.CancelCook(topNetwork); } } }
/// <summary> /// Cook the output TOP node of the currently selected TOP network. /// </summary> public void CookOutput() { HEU_SessionBase session = GetHAPISession(); if (session == null || !session.IsSessionValid()) { return; } HEU_TOPNetworkData topNetwork = GetSelectedTOPNetwork(); if (topNetwork != null) { //HEU_Logger.Log("Cooking output!"); _workItemTally.ZeroAll(); ResetTOPNetworkWorkItemTally(topNetwork); HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null) { pdgSession.CookTOPNetworkOutputNode(topNetwork, OnSyncComplete); } } }
/// <summary> /// Main function to display linked asset's info, and functions. /// </summary> private void DrawAssetLink() { HEU_PDGAssetLink.LinkState validState = _assetLink.AssetLinkState; using (new EditorGUILayout.VerticalScope(_backgroundStyle)) { EditorGUILayout.Space(); // Linked asset SerializedProperty assetGOProp = HEU_EditorUtility.GetSerializedProperty(serializedObject, "_assetGO"); if (assetGOProp != null) { EditorGUILayout.PropertyField(assetGOProp, _assetGOLabel, false); } EditorGUILayout.Space(); using (new EditorGUILayout.HorizontalScope()) { // Refresh button re-poplates the UI data from linked asset if (GUILayout.Button(_refreshContent, GUILayout.MaxHeight(_largButtonHeight))) { _assetLink.Refresh(); } // Reset button resets and recreates the HEU_PDGAssetLink if (GUILayout.Button(_resetContent, GUILayout.MaxHeight(_largButtonHeight))) { _assetLink.Reset(); } } // Autocook allows to automatically cook the TOP network when input assets are cooked _assetLink._autoCook = EditorGUILayout.Toggle(_autocookContent, _assetLink._autoCook); // Whether to use HEngine meta data to filter TOP networks and nodes _assetLink._useHEngineData = EditorGUILayout.Toggle(_useHEngineDataContent, _assetLink._useHEngineData); EditorGUILayout.Space(); // Asset status using (new EditorGUILayout.VerticalScope(HEU_EditorUI.GetSectionStyle())) { EditorGUILayout.LabelField("Asset is " + validState); if (validState == HEU_PDGAssetLink.LinkState.ERROR_NOT_LINKED) { EditorGUILayout.LabelField("Failed to link with HDA. Unable to proceed. Try rebuilding asset."); } else if (validState == HEU_PDGAssetLink.LinkState.LINKED) { EditorGUILayout.Space(); EditorGUILayout.LabelField(_assetStatusLabel); DrawWorkItemTally(_assetLink._workItemTally); EditorGUILayout.Space(); } } } if (validState == HEU_PDGAssetLink.LinkState.INACTIVE) { _assetLink.Refresh(); } else if (validState == HEU_PDGAssetLink.LinkState.LINKED) { using (new EditorGUILayout.VerticalScope(_backgroundStyle)) { EditorGUILayout.Space(); DrawSelectedTOPNetwork(); EditorGUILayout.Space(); DrawSelectedTOPNode(); } } // Display cook event messages string eventMsgs = "<color=#c0c0c0ff>Cook event messages and errors will be displayed here...</color>"; HEU_PDGSession pdgSession = HEU_PDGSession.GetPDGSession(); if (pdgSession != null) { string actualMsgs = pdgSession.GetEventMessages(); if (!string.IsNullOrEmpty(actualMsgs)) { eventMsgs = string.Format("{0}", actualMsgs); } } using (new EditorGUILayout.VerticalScope(_backgroundStyle)) { EditorGUILayout.Space(); _eventMessageScrollPos = EditorGUILayout.BeginScrollView(_eventMessageScrollPos, false, false); Vector2 textSize = _eventMessageStyle.CalcSize(new GUIContent(eventMsgs)); EditorGUILayout.PrefixLabel(_eventMessageContent); EditorGUILayout.SelectableLabel(eventMsgs, _eventMessageStyle, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y)); EditorGUILayout.EndScrollView(); } }