Exemple #1
0
    private void DrawSaveBrush()
    {
        EditorGUILayout.Separator();

        var rect   = P3D_Helper.Reserve(16.0f, true);
        var exists = PresetBrushes.Exists(b => b.Name == currentBrush.Name);

        if (GUI.Button(rect, exists == true ? "Overwrite Preset" : "Save Preset") == true)
        {
            var presetBrush = PresetBrushes.Find(b => b.Name == currentBrush.Name);

            if (presetBrush == null)
            {
                presetBrush = new P3D_Brush();

                PresetBrushes.Add(presetBrush);
            }

            currentBrush.Name = currentBrush.Name.Replace("\n", "");

            currentBrush.CopyTo(presetBrush);

            SavePresets();
        }
    }
    private void DrawSaveBrush()
    {
        EditorGUILayout.Separator();

        var rect   = P3D_Helper.Reserve(16.0f, true);
        var exists = PresetBrushes.Exists(b => b.Name == currentBrush.Name);

        if (GUI.Button(rect, exists == true ? "Overwrite Preset" : "Save Preset") == true)
        {
            var presetBrush = PresetBrushes.Find(b => b.Name == currentBrush.Name);

            if (presetBrush == null)
            {
                presetBrush = new P3D_Brush();

                PresetBrushes.Add(presetBrush);
            }

            presetBrush.Name        = currentBrush.Name.Replace("\n", "");
            presetBrush.Blend       = currentBrush.Blend;
            presetBrush.Color       = currentBrush.Color;
            presetBrush.Direction   = currentBrush.Direction;
            presetBrush.Shape       = currentBrush.Shape;
            presetBrush.Size        = currentBrush.Size;
            presetBrush.Detail      = currentBrush.Detail;
            presetBrush.DetailScale = currentBrush.DetailScale;

            SavePresets();
        }
    }