private void OnNewBrush(object sender, EventArgs e) { // create a new brush. BrushCreationDialog brushCreationDlg = new BrushCreationDialog(); DialogResult result = brushCreationDlg.ShowDialog(); if (result != DialogResult.OK) { return; } // create a new brush. string name = brushCreationDlg.tbName.Text; string category = brushCreationDlg.cbCategory.Text; Bootstrap.Brush selection = Bootstrap.Brush.Create(name, category); // make sure we contain the new brush. ReloadScripts(); if (selection != null) { // select the new brush. thumbnailSelector.SelectedName = selection.Name; } // save the new brush. Bootstrap.Brush.SaveBrushes(); }
public Bitmap GetThumbnail(Bootstrap.Brush brush) { // get the diffuse image and use that to display the brush. Bitmap image = null; string imageFile = brush.GetImageName(Bootstrap.Brush.Stage.Diffuse); // if there is no diffuse image, try to use the mask as our image. if (imageFile == "") { imageFile = brush.GetMaskName(); } // now try to create a valid thumbnail. if (imageFile != "") { image = GetThumbnail(imageFile); } // if we couldn't find a decent thumbnail, give it an error // image. if (image == null) { image = GetErrorThumbnail(); } return(image); }
private void PopulateThumbnails() { // remove existing brushes. thumbnailSelector.Clear(); // get all brushes from the loaded scripts. string[] brushNames = Bootstrap.Brush.GetBrushNameList(); // iterate through each brush and add a thumbnail. string selecting = ""; foreach (string name in brushNames) { // if this brush is being excluded, skip it. if (_exclude.ContainsKey(name)) { continue; } // create a manipulator for the current brush. using (Bootstrap.Brush brush = new Bootstrap.Brush(name)) { // add the thumbnail to the selection dialog. thumbnailSelector.Add(brush.Name, Program.ThumbnailMgr.GetThumbnail(brush), brush.Name); // if the brush editor's brush matches the current brush, // flag the current brush for selection. if (brushEditor.Brush != null && brushEditor.Brush.Name == name) { selecting = name;; } } } // select the appropriate brush. thumbnailSelector.SelectedName = selecting; if (selecting == "") { brushEditor.Brush = null; } }