private void ExecuteActions() { if (_toggleFoldout) { _objectNode.Foldout = !_objectNode.Foldout; } if (_select) { _serializedContainer.ObjectField = _objectNode.Object; _serializedContainer.ResultType = null; _serializedContainer.ApplyModifiedProperties(); } if (_ping) { InterfaceableGUIHelper.PingObject(_objectNode.Object); } }
private static void DrawField(SerializedContainer serializedContainer, Rect rect, bool pingable) { var buttonId = GUIUtility.GetControlID(FocusType.Passive) + 1; if (GUI.Button(rect, GUIContent.none, GUIStyle.none)) { if (pingable) { InterfaceableGUIHelper.PingObject(serializedContainer.ObjectField); } } var pinging = GUIUtility.hotControl == buttonId && pingable; GUIStyle style; if (serializedContainer.Dropping) { style = InterfaceableGUIHelper.InspectorStyles.DropBox; } else if (pinging) { style = InterfaceableGUIHelper.InspectorStyles.Pinging; } else if (serializedContainer.Selecting) { style = InterfaceableGUIHelper.InspectorStyles.Selecting; } else { style = InterfaceableGUIHelper.InspectorStyles.Result; } if (serializedContainer.ObjectFieldProperty.hasMultipleDifferentValues || serializedContainer.ObjectField == null) { style.alignment = TextAnchor.MiddleCenter; style.imagePosition = ImagePosition.TextOnly; } else { style.alignment = TextAnchor.MiddleLeft; style.imagePosition = ImagePosition.ImageLeft; } GUI.Label(rect, GUIContent.none, style); GUIContentRect icon, label; serializedContainer.GetContainerContents(rect, serializedContainer.Dropping, out icon, out label); style.normal.background = null; if (icon.Content != null) { icon.SetWidth(InterfaceableGUIHelper.GetScaledTextureWidth(icon.Content.image, rect.height + 2.0f)); label.MoveNextTo(icon, -3.0f); GUI.Label(icon, icon, style); } GUI.Label(label, label, style); if (!SerializedContainer.AnyDropping && pingable) { EditorGUIUtility.AddCursorRect(rect, MouseCursor.Zoom); } }