Esempio n. 1
0
        private void DrawGenericPropertyField(Rect position, Rect valueRect)
        {
            if (IsConstantValueMultiline(constantValue))
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    position.y     += EditorGUIUtility.singleLineHeight;
                    position.height = GenericPropertyDrawer.GetHeight(constantValue, ValueType);

                    GenericPropertyDrawer.DrawPropertyDrawer(position, constantValue, ValueType);
                }
            }
            else
            {
                GenericPropertyDrawer.DrawPropertyDrawer(valueRect, constantValue, ValueType, false);
            }
        }
Esempio n. 2
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            SerializedProperty useConstant   = property.FindPropertyRelative(USE_CONSTANT_VALUE_PROPERTY_NAME);
            SerializedProperty constantValue = property.FindPropertyRelative(CONSTANT_VALUE_PROPERTY_NAME);

            if (useConstant.boolValue)
            {
                if (IsConstantValueMultiline(constantValue))
                {
                    return(GenericPropertyDrawer.GetHeight(constantValue, ValueType) + EditorGUIUtility.singleLineHeight);
                }
                else
                {
                    return(EditorGUIUtility.singleLineHeight);
                }
            }

            return(EditorGUIUtility.singleLineHeight);
        }
Esempio n. 3
0
 private bool IsConstantValueMultiline(SerializedProperty property)
 {
     return(GenericPropertyDrawer.GetHeight(property, ValueType) > MultilineThreshold);
 }
Esempio n. 4
0
 private Rect GetConstantMultilineRect(Rect position, Rect valueRect)
 {
     return(new Rect(position.x, valueRect.y + EditorGUIUtility.singleLineHeight, position.width, GenericPropertyDrawer.GetHeight(constantValue, ValueType)));
 }
Esempio n. 5
0
        private float GetHeight(int index)
        {
            SerializedProperty property = CollectionItemsProperty.GetArrayElementAtIndex(index);

            return(GenericPropertyDrawer.GetHeight(property, Target.Type) + EditorGUIUtility.standardVerticalSpacing);
        }