private void CreateNewPresetButton(Rect buttonRect, object newPresetObject, PresetLibrary lib, bool isOpenForEdit)
{
EditorGUI.BeginDisabledGroup(!isOpenForEdit);
if (GUI.Button(buttonRect, !isOpenForEdit ? PresetLibraryEditor <T> .s_Styles.plusButtonTextNotCheckedOut : PresetLibraryEditor <T> .s_Styles.plusButtonText))
{
int itemIndex = this.CreateNewPreset(newPresetObject, string.Empty);
if (this.drawLabels)
{
this.BeginRenaming(string.Empty, itemIndex, 0f);
}
InspectorWindow.RepaintAllInspectors();
}
if (Event.current.type == EventType.Repaint)
{
Rect rect = new RectOffset(-3, -3, -3, -3).Add(buttonRect);
lib.Draw(rect, newPresetObject);
if (buttonRect.width > 30f)
{
PresetLibraryEditor <T> .LabelWithOutline(buttonRect, PresetLibraryEditor <T> .s_Styles.newPreset, new Color(0.1f, 0.1f, 0.1f), PresetLibraryEditor <T> .s_Styles.newPresetStyle);
}
else if ((lib.Count() == 0) && isOpenForEdit)
{
buttonRect.x = buttonRect.xMax + 5f;
buttonRect.width = 200f;
buttonRect.height = 16f;
EditorGUI.BeginDisabledGroup(true);
GUI.Label(buttonRect, "Click to add new preset");
EditorGUI.EndDisabledGroup();
}
}
EditorGUI.EndDisabledGroup();
}