示例#1
0
	/// <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();
	    }
	}
示例#2
0
	/// <summary>
	/// Displays a dropdown list of TOP nodes, and shows the selected TOP node info
	/// </summary>
	private void DrawSelectedTOPNode()
	{
	    HEU_TOPNetworkData topNetworkData = _assetLink.GetSelectedTOPNetwork();
	    if (topNetworkData == null)
	    {
		return;
	    }

	    using (new EditorGUILayout.VerticalScope(_backgroundStyle))
	    {
		int numTopNodes = topNetworkData._topNodeNames.Length;
		if (numTopNodes > 0)
		{
		    using (new EditorGUILayout.HorizontalScope())
		    {
			EditorGUILayout.PrefixLabel(_topNodeChooseLabel);

			int selectedIndex = Mathf.Clamp(topNetworkData._selectedTOPIndex, 0, numTopNodes);
			int newSelectedIndex = EditorGUILayout.Popup(selectedIndex, topNetworkData._topNodeNames);
			if (newSelectedIndex != selectedIndex)
			{
			    _assetLink.SelectTOPNode(topNetworkData, newSelectedIndex);
			}
		    }
		}
		else
		{
		    EditorGUILayout.PrefixLabel(_topNodeNoneLabel);
		}

		EditorGUILayout.Space();

		HEU_TOPNodeData topNode = _assetLink.GetSelectedTOPNode();
		if (topNode != null)
		{
		    topNode._tags._autoload = EditorGUILayout.Toggle(_autoloadContent, topNode._tags._autoload);

		    bool showResults = topNode._showResults;
		    showResults = EditorGUILayout.Toggle(_showHideResultsContent, showResults);
		    if (showResults != topNode._showResults)
		    {
			topNode._showResults = showResults;
			_assetLink.UpdateTOPNodeResultsVisibility(topNode);
		    }

		    EditorGUILayout.Space();

		    using (new EditorGUILayout.HorizontalScope())
		    {
			if (GUILayout.Button(_buttonDirtyContent))
			{
			    _assetLink.DirtyTOPNode(topNode);
			}

			if (GUILayout.Button(_buttonCookContent))
			{
			    _assetLink.CookTOPNode(topNode);
			}
		    }

		    EditorGUILayout.Space();

		    using (new EditorGUILayout.VerticalScope(HEU_EditorUI.GetSectionStyle()))
		    {
			EditorGUILayout.LabelField("TOP Node State: " + _assetLink.GetTOPNodeStatus(topNode));

			EditorGUILayout.Space();

			EditorGUILayout.LabelField(_topNodeStatusLabel);
			DrawWorkItemTally(topNode._workItemTally);
		    }
		}
	    }
	}
		private void DrawAssetLink()
		{
			HEU_PDGAssetLink.LinkState validState = _assetLink.AssetLinkState;

			using (new EditorGUILayout.VerticalScope(_backgroundStyle))
			{
				EditorGUILayout.Space();

				SerializedProperty assetGOProp = HEU_EditorUtility.GetSerializedProperty(serializedObject, "_assetGO");
				if (assetGOProp != null)
				{
					EditorGUILayout.PropertyField(assetGOProp, _assetGOLabel, false);
				}

				EditorGUILayout.Space();

				using (new EditorGUILayout.HorizontalScope())
				{
					if (GUILayout.Button(_refreshContent, GUILayout.MaxHeight(_largButtonHeight)))
					{
						_assetLink.Refresh();
					}

					if (GUILayout.Button(_resetContent, GUILayout.MaxHeight(_largButtonHeight)))
					{
						_assetLink.Reset();
					}
				}

				_assetLink._autoCook = EditorGUILayout.Toggle(_autocookContent, _assetLink._autoCook);
				_assetLink._useHEngineData = EditorGUILayout.Toggle(_useHEngineDataContent, _assetLink._useHEngineData);

				EditorGUILayout.Space();

				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();

					// Dropdown list of TOP network names
					DrawSelectedTOPNetwork();

					EditorGUILayout.Space();

					// Dropdown list of TOP nodes
					DrawSelectedTOPNode();
				}
			}
		}
示例#4
0
	/// <summary>
	/// Displays a dropdown list of TOP nodes, and shows the selected TOP node info
	/// </summary>
	private void DrawSelectedTOPNode()
	{
	    HEU_TOPNetworkData topNetworkData = _assetLink.GetSelectedTOPNetwork();
	    if (topNetworkData == null)
	    {
		return;
	    }

	    using (new EditorGUILayout.VerticalScope(_backgroundStyle))
	    {
		List<KeyValuePair<int, HEU_TOPNodeData>> displayNodeData = _assetLink.GetNonHiddenTOPNodes(topNetworkData);
		int numTopNodes = displayNodeData.Count;
		if (numTopNodes > 0)
		{
		    using (new EditorGUILayout.HorizontalScope())
		    {
			EditorGUILayout.PrefixLabel(_topNodeChooseLabel);

			int currentSelectedIndex = -1;
			for (int i = 0; i < displayNodeData.Count; i++)
			{
			    if (displayNodeData[i].Key == topNetworkData._selectedTOPIndex)
			    {
				currentSelectedIndex = i;
				break;
			    }
			}

			int selectedIndex = Mathf.Clamp(currentSelectedIndex, 0, displayNodeData.Count);
			int newSelectedIndex = EditorGUILayout.Popup(selectedIndex, topNetworkData._topNodeNames);
			if (newSelectedIndex != selectedIndex)
			{
			    _assetLink.SelectTOPNode(topNetworkData, displayNodeData[newSelectedIndex].Key);
			}
		    }
		}
		else
		{
		    EditorGUILayout.PrefixLabel(_topNodeNoneLabel);
		}

		EditorGUILayout.Space();

		HEU_TOPNodeData topNode = _assetLink.GetSelectedTOPNode();
		if (topNode != null)
		{
		    topNode._tags._autoload = EditorGUILayout.Toggle(_autoloadContent, topNode._tags._autoload);

		    bool showResults = topNode._showResults;
		    showResults = EditorGUILayout.Toggle(_showHideResultsContent, showResults);
		    if (showResults != topNode._showResults)
		    {
			topNode._showResults = showResults;
			_assetLink.UpdateTOPNodeResultsVisibility(topNode);
		    }

		    EditorGUILayout.Space();

		    using (new EditorGUILayout.HorizontalScope())
		    {
			if (GUILayout.Button(_buttonDirtyContent))
			{
			    _assetLink.DirtyTOPNode(topNode);
			}

			if (GUILayout.Button(_buttonCookContent))
			{
			    _assetLink.CookTOPNode(topNode);
			}
		    }

		    EditorGUILayout.Space();

		    using (new EditorGUILayout.VerticalScope(HEU_EditorUI.GetSectionStyle()))
		    {
			EditorGUILayout.LabelField("TOP Node State: " + _assetLink.GetTOPNodeStatus(topNode));

			EditorGUILayout.Space();

			EditorGUILayout.LabelField(_topNodeStatusLabel);
			DrawWorkItemTally(topNode._workItemTally);
		    }
		}
	    }
	}
示例#5
0
		/// <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();
				}
			}
		}