mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 09:16:01 +08:00
tooltips on label fields. serializedproperty.tooltip is broken and is always empty. (#294)
This commit is contained in:
parent
b6528a255c
commit
123415bd83
@ -59,6 +59,7 @@ namespace XNodeEditor {
|
|||||||
(showBacking == XNode.Node.ShowBackingValue.Unconnected && port.IsConnected);
|
(showBacking == XNode.Node.ShowBackingValue.Unconnected && port.IsConnected);
|
||||||
|
|
||||||
float spacePadding = 0;
|
float spacePadding = 0;
|
||||||
|
string tooltip = null;
|
||||||
foreach (var attr in propertyAttributes) {
|
foreach (var attr in propertyAttributes) {
|
||||||
if (attr is SpaceAttribute) {
|
if (attr is SpaceAttribute) {
|
||||||
if (usePropertyAttributes) GUILayout.Space((attr as SpaceAttribute).height);
|
if (usePropertyAttributes) GUILayout.Space((attr as SpaceAttribute).height);
|
||||||
@ -71,6 +72,8 @@ namespace XNodeEditor {
|
|||||||
position = EditorGUI.IndentedRect(position);
|
position = EditorGUI.IndentedRect(position);
|
||||||
GUI.Label(position, (attr as HeaderAttribute).header, EditorStyles.boldLabel);
|
GUI.Label(position, (attr as HeaderAttribute).header, EditorStyles.boldLabel);
|
||||||
} else spacePadding += EditorGUIUtility.singleLineHeight * 1.5f;
|
} else spacePadding += EditorGUIUtility.singleLineHeight * 1.5f;
|
||||||
|
} else if (attr is TooltipAttribute) {
|
||||||
|
tooltip = (attr as TooltipAttribute).tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,13 +86,13 @@ namespace XNodeEditor {
|
|||||||
switch (showBacking) {
|
switch (showBacking) {
|
||||||
case XNode.Node.ShowBackingValue.Unconnected:
|
case XNode.Node.ShowBackingValue.Unconnected:
|
||||||
// Display a label if port is connected
|
// Display a label if port is connected
|
||||||
if (port.IsConnected) EditorGUILayout.LabelField(label != null ? label : new GUIContent(property.displayName));
|
if (port.IsConnected) EditorGUILayout.LabelField(label != null ? label : new GUIContent(property.displayName, tooltip));
|
||||||
// Display an editable property field if port is not connected
|
// Display an editable property field if port is not connected
|
||||||
else EditorGUILayout.PropertyField(property, label, includeChildren, GUILayout.MinWidth(30));
|
else EditorGUILayout.PropertyField(property, label, includeChildren, GUILayout.MinWidth(30));
|
||||||
break;
|
break;
|
||||||
case XNode.Node.ShowBackingValue.Never:
|
case XNode.Node.ShowBackingValue.Never:
|
||||||
// Display a label
|
// Display a label
|
||||||
EditorGUILayout.LabelField(label != null ? label : new GUIContent(property.displayName));
|
EditorGUILayout.LabelField(label != null ? label : new GUIContent(property.displayName, tooltip));
|
||||||
break;
|
break;
|
||||||
case XNode.Node.ShowBackingValue.Always:
|
case XNode.Node.ShowBackingValue.Always:
|
||||||
// Display an editable property field
|
// Display an editable property field
|
||||||
@ -115,6 +118,7 @@ namespace XNodeEditor {
|
|||||||
(showBacking == XNode.Node.ShowBackingValue.Unconnected && port.IsConnected);
|
(showBacking == XNode.Node.ShowBackingValue.Unconnected && port.IsConnected);
|
||||||
|
|
||||||
float spacePadding = 0;
|
float spacePadding = 0;
|
||||||
|
string tooltip = null;
|
||||||
foreach (var attr in propertyAttributes) {
|
foreach (var attr in propertyAttributes) {
|
||||||
if (attr is SpaceAttribute) {
|
if (attr is SpaceAttribute) {
|
||||||
if (usePropertyAttributes) GUILayout.Space((attr as SpaceAttribute).height);
|
if (usePropertyAttributes) GUILayout.Space((attr as SpaceAttribute).height);
|
||||||
@ -127,6 +131,8 @@ namespace XNodeEditor {
|
|||||||
position = EditorGUI.IndentedRect(position);
|
position = EditorGUI.IndentedRect(position);
|
||||||
GUI.Label(position, (attr as HeaderAttribute).header, EditorStyles.boldLabel);
|
GUI.Label(position, (attr as HeaderAttribute).header, EditorStyles.boldLabel);
|
||||||
} else spacePadding += EditorGUIUtility.singleLineHeight * 1.5f;
|
} else spacePadding += EditorGUIUtility.singleLineHeight * 1.5f;
|
||||||
|
} else if (attr is TooltipAttribute) {
|
||||||
|
tooltip = (attr as TooltipAttribute).tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,13 +145,13 @@ namespace XNodeEditor {
|
|||||||
switch (showBacking) {
|
switch (showBacking) {
|
||||||
case XNode.Node.ShowBackingValue.Unconnected:
|
case XNode.Node.ShowBackingValue.Unconnected:
|
||||||
// Display a label if port is connected
|
// Display a label if port is connected
|
||||||
if (port.IsConnected) EditorGUILayout.LabelField(label != null ? label : new GUIContent(property.displayName), NodeEditorResources.OutputPort, GUILayout.MinWidth(30));
|
if (port.IsConnected) EditorGUILayout.LabelField(label != null ? label : new GUIContent(property.displayName, tooltip), NodeEditorResources.OutputPort, GUILayout.MinWidth(30));
|
||||||
// Display an editable property field if port is not connected
|
// Display an editable property field if port is not connected
|
||||||
else EditorGUILayout.PropertyField(property, label, includeChildren, GUILayout.MinWidth(30));
|
else EditorGUILayout.PropertyField(property, label, includeChildren, GUILayout.MinWidth(30));
|
||||||
break;
|
break;
|
||||||
case XNode.Node.ShowBackingValue.Never:
|
case XNode.Node.ShowBackingValue.Never:
|
||||||
// Display a label
|
// Display a label
|
||||||
EditorGUILayout.LabelField(label != null ? label : new GUIContent(property.displayName), NodeEditorResources.OutputPort, GUILayout.MinWidth(30));
|
EditorGUILayout.LabelField(label != null ? label : new GUIContent(property.displayName, tooltip), NodeEditorResources.OutputPort, GUILayout.MinWidth(30));
|
||||||
break;
|
break;
|
||||||
case XNode.Node.ShowBackingValue.Always:
|
case XNode.Node.ShowBackingValue.Always:
|
||||||
// Display an editable property field
|
// Display an editable property field
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user