private void OnGUI_ItemsList(Rect position, string headerName, ReorderablePropertyData reorderableProperty)
        {
            ReorderableList    reorderable  = reorderableProperty.Reorderable;
            SerializedProperty listProperty = reorderableProperty.Property;

            reorderable.drawHeaderCallback = ( Rect headerPos ) =>
            {
                EditorGUI.LabelField(headerPos, headerName);
            };

            reorderable.drawElementCallback = (Rect elementPos, int index, bool isActive, bool isFocused) =>
            {
                SerializedProperty elementProperty = listProperty.GetArrayElementAtIndex(index);
                elementPos.height = EditorGUI.GetPropertyHeight(elementProperty);
                elementPos.y     += EditorGUIUtility.standardVerticalSpacing;

                EditorGUI.PropertyField(elementPos, elementProperty);
            };

            reorderable.elementHeightCallback = ( int index ) =>
            {
                SerializedProperty elementProperty = listProperty.GetArrayElementAtIndex(index);
                float height = EditorGUI.GetPropertyHeight(elementProperty);

                return(height + EditorGUIUtility.singleLineHeight / 2f);
            };

            reorderable.DoList(position);
        }
        private ReorderablePropertyData GetReorderablePropertyData(SerializedProperty property)
        {
            if (m_propertyPathToReorderableProperties.TryGetValue(property.propertyPath, out ReorderablePropertyData data))
            {
                return(data);
            }

            data = new ReorderablePropertyData(property, k_itemsPropertyName);
            m_propertyPathToReorderableProperties.Add(property.propertyPath, data);

            return(data);
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            ReorderablePropertyData reorderableProperty = GetReorderablePropertyData(property);

            position = OnGUI_AllowEmptyRolls(position, property);
            OnGUI_ItemsList(position, property.displayName, reorderableProperty);

            if (property.serializedObject.hasModifiedProperties)
            {
                NormalizeWeights(reorderableProperty.Property);

                property.serializedObject.ApplyModifiedProperties();
            }
        }
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            ReorderablePropertyData reorderableProperty = GetReorderablePropertyData(property);

            return(EditorGUIUtility.singleLineHeight + reorderableProperty.Reorderable.GetHeight());
        }