public static T InlineObjectField <T>(GUIContent label, T obj, EditorGUIX.FieldIcon icon = EditorGUIX.FieldIcon.None)
            where T : UnityEngine.Object
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                var previousImage = label.image;
                label.image = EditorGUIX.GetIcon(icon, previousImage);
                EditorGUILayout.PrefixLabel(label);
                label.image = previousImage;

                var indent = EditorGUI.indentLevel;
                if (EditorGUI.indentLevel > 0)
                {
                    EditorGUI.indentLevel = 0;
                }

                obj = (T)EditorGUILayout.ObjectField(obj, typeof(T), false);

                EditorGUI.indentLevel = indent;
            }

            return(obj);
        }
        public static float VerticalHandle(int controlId, float size, float minSize = float.MinValue, float maxSize = float.MaxValue)
        {
            var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandWidth(true), GUILayout.Height(EditorGUIX.Styles.handleSize));

            return(EditorGUIX.VerticalHandle(controlId, rect, size, minSize, maxSize));
        }
Beispiel #3
0
 public static void Canvas(int controlId, ref Vector2 cameraPosition, ref float zoom, float[] zoomLevels = null, params GUILayoutOption[] options)
 {
     var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, options);
     EditorGUIX.Canvas(controlId, rect, ref cameraPosition, ref zoom, zoomLevels);
 }
        public static void DropZoneHint(GUIContent text = null, GUIContent icon = null)
        {
            var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            EditorGUIX.DropZoneHint(rect, text, icon);
        }
        public static bool DropZone(int controlId, Func <UnityObject[], string[], DragAndDropVisualMode> canAcceptCallback)
        {
            var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            return(EditorGUIX.DropZone(controlId, rect, canAcceptCallback));
        }
        public static bool InspectorFoldout(bool value, GUIContent content, EditorGUIX.FieldIcon icon = EditorGUIX.FieldIcon.None)
        {
            var rect = GUILayoutUtility.GetRect(content, EditorGUIX.Styles.inspectorBackground, GUILayout.ExpandWidth(true));

            return(EditorGUIX.InspectorFoldout(rect, value, content, icon));
        }