Exemple #1
0
        private void DrawReorderableList(Rect position, SerializedProperty property, GUIContent label)
        {
            var labelRect = new Rect(position.xMin, position.yMin, position.width, 0f);

            if (_labelOption == DNAEvaluatorList.ConfigAttribute.LabelOptions.drawLabelAsFoldout)
            {
                labelRect           = new Rect(position.xMin, position.yMin, position.width, EditorGUIUtility.singleLineHeight);
                property.isExpanded = EditorGUI.Foldout(labelRect, property.isExpanded, label);
            }
            else if (_labelOption == DNAEvaluatorList.ConfigAttribute.LabelOptions.drawExpandedWithLabel)
            {
                labelRect = new Rect(position.xMin, position.yMin, position.width, EditorGUIUtility.singleLineHeight);
                EditorGUI.LabelField(labelRect, label);
            }
            if (property.isExpanded || _labelOption == DNAEvaluatorList.ConfigAttribute.LabelOptions.drawExpandedWithLabel || _labelOption == DNAEvaluatorList.ConfigAttribute.LabelOptions.drawExpandedNoLabel)
            {
                var contentRect = EditorGUI.IndentedRect(position);
                contentRect.yMin   = labelRect.yMax + _padding;
                contentRect.height = contentRect.height - labelRect.height;

                var dnaEvalListProp = property.FindPropertyRelative(DNAEVALUATORSPROPERTY);

                _dnaEvaluatorList = CachedReorderableList.GetListDrawer(dnaEvalListProp, DrawHeaderCallback, null, DrawElementCallback, DrawFooterCallback);

                _dnaEvaluatorList.DoList(contentRect);
            }
        }
        //Draws the plugins in 'By Converter' view
        private void DrawConverters()
        {
            GUIHelper.BeginVerticalPadded(3, new Color(0.75f, 0.875f, 1f, 0.3f));

            if (_target.PluginCount == 0)
            {
                EditorGUILayout.HelpBox("No Converters have been added yet. Use the 'Add' tool below to add some", MessageType.Info);
            }
            _convertersListProp = serializedObject.FindProperty("_plugins");

            _convertersROL = CachedReorderableList.GetListDrawer(_convertersListProp, DrawConverterListHeaderCallback, GetConverterListEntryHeightCallback, DrawConverterListEntryCallback, DrawConverterListFooterCallback);
            _convertersROL.headerHeight = 0f;
            _convertersROL.footerHeight = (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing * 2);
            _convertersROL.DoLayoutList();

            GUIHelper.EndVerticalPadded(3);
        }