示例#1
0
        protected virtual void DrawMultiLineProperty(Rect rect, GUIContent label, SerializedProperty referenceProp, SerializedProperty valueProp, Flowchart flowchart,
                                                     VariableInfoAttribute typeInfo)
        {
            const int popupWidth = 100;

            Rect controlRect = rect;
            Rect valueRect   = controlRect;
            //valueRect.width = controlRect.width - 5;
            Rect popupRect = controlRect;

            popupRect.height = EditorGUIUtility.singleLineHeight;

            if (referenceProp.objectReferenceValue == null)
            {
                //EditorGUI.PropertyField(valueRect, valueProp, label);
                CustomVariableDrawerLookup.DrawCustomOrPropertyField(typeof(T), valueRect, valueProp, label);
                popupRect.x     = rect.width - popupWidth + 5;
                popupRect.width = popupWidth;
            }
            else
            {
                popupRect = EditorGUI.PrefixLabel(rect, label);
            }

            EditorGUI.PropertyField(popupRect, referenceProp, GUIContent.none);
        }
示例#2
0
        protected virtual void DrawSingleLineProperty(Rect rect, GUIContent label, SerializedProperty referenceProp, SerializedProperty valueProp, Flowchart flowchart,
                                                      VariableInfoAttribute typeInfo)
        {
            int       popupWidth = Mathf.RoundToInt(EditorGUIUtility.singleLineHeight);
            const int popupGap   = 5;

            //get out starting rect with intent honoured
            Rect controlRect = EditorGUI.PrefixLabel(rect, label);
            Rect valueRect   = controlRect;

            valueRect.width = controlRect.width - popupWidth - popupGap;
            Rect popupRect = controlRect;

            //we are overriding much of the auto layout to cram this all on 1 line so zero the intend and restore it later
            var prevIndent = EditorGUI.indentLevel;

            EditorGUI.indentLevel = 0;

            if (referenceProp.objectReferenceValue == null)
            {
                CustomVariableDrawerLookup.DrawCustomOrPropertyField(typeof(T), valueRect, valueProp, GUIContent.none);
                popupRect.x    += valueRect.width + popupGap;
                popupRect.width = popupWidth;
            }

            EditorGUI.PropertyField(popupRect, referenceProp, GUIContent.none);
            EditorGUI.indentLevel = prevIndent;
        }
示例#3
0
 public static void VariableDrawProperty(Variable variable, Rect rect, SerializedProperty valueProp, VariableInfoAttribute info)
 {
     if (valueProp == null)
     {
         EditorGUI.LabelField(rect, "N/A");
     }
     else if (info.IsPreviewedOnly)
     {
         EditorGUI.LabelField(rect, variable.ToString());
     }
     else
     {
         CustomVariableDrawerLookup.DrawCustomOrPropertyField(variable.GetType(), rect, valueProp, GUIContent.none);
     }
 }