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();
				}
			}
		}
예제 #2
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();
	    }
	}
예제 #3
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();
				}
			}
		}