@@ -378,31 +378,42 @@ public void UpdateBottomBar(int gridX, int gridY)
378
378
379
379
public void SetSelectedBrush ( EditorBrush brush )
380
380
{
381
- m_selectedBrush = brush ;
382
- string colour = m_selectedBrush . Colour . ToString ( ) ;
383
-
384
- // Tidy this display up at some point
385
- BottomBarBrushLabel . Text = m_selectedBrush . Comment ;
386
-
387
- if ( m_selectedBrush . FrontAsset != null )
388
- {
389
- BottomBarBrushLabel . Text += " front: " + m_selectedBrush . FrontAsset . ToString ( ) ;
390
- }
391
-
392
- if ( m_selectedBrush . BackAsset != null )
393
- {
394
- BottomBarBrushLabel . Text += " back: " + m_selectedBrush . BackAsset . ToString ( ) ;
395
- }
396
-
397
- BottomBarBrushLabel . Text += " " + colour ;
398
-
399
- // Populate the colour box
400
- VisualRgbaBrushImageBox . Image = EditorHelpers . GetGeneratedRectangle ( 1 , 1 ,
401
- m_selectedBrush . Colour . R , m_selectedBrush . Colour . G ,
402
- m_selectedBrush . Colour . B , m_selectedBrush . Colour . A ) ;
403
-
404
- VisualGraphicBrushImageBox . Image = m_selectedBrush . GetAssetPreview ( ) ;
405
-
381
+ m_selectedBrush = brush ;
382
+
383
+ if ( brush != null )
384
+ {
385
+ string colour = m_selectedBrush . Colour . ToString ( ) ;
386
+
387
+ // Tidy this display up at some point
388
+ BottomBarBrushLabel . Text = m_selectedBrush . Comment ;
389
+
390
+ if ( m_selectedBrush . FrontAsset != null )
391
+ {
392
+ BottomBarBrushLabel . Text += " front: " + m_selectedBrush . FrontAsset . ToString ( ) ;
393
+ }
394
+
395
+ if ( m_selectedBrush . BackAsset != null )
396
+ {
397
+ BottomBarBrushLabel . Text += " back: " + m_selectedBrush . BackAsset . ToString ( ) ;
398
+ }
399
+
400
+ BottomBarBrushLabel . Text += " " + colour ;
401
+
402
+ // Populate the colour box
403
+ VisualRgbaBrushImageBox . Image = EditorHelpers . GetGeneratedRectangle ( 1 , 1 ,
404
+ m_selectedBrush . Colour . R , m_selectedBrush . Colour . G ,
405
+ m_selectedBrush . Colour . B , m_selectedBrush . Colour . A ) ;
406
+
407
+ VisualGraphicBrushImageBox . Image = m_selectedBrush . GetAssetPreview ( ) ;
408
+ }
409
+ else
410
+ {
411
+ Image white = EditorHelpers . GetGeneratedRectangle ( 1 , 1 , 255 , 255 , 255 , 255 ) ;
412
+ BottomBarBrushLabel . Text = "" ;
413
+ VisualRgbaBrushImageBox . Image = white ;
414
+ VisualGraphicBrushImageBox . Image = white ;
415
+ }
416
+
406
417
MainPictureBox . SetSelectedBrush ( m_selectedBrush ) ;
407
418
UpdatePropertiesPanel ( ) ;
408
419
}
@@ -1175,6 +1186,7 @@ private void deleteBrushToolStripMenuItem_Click(object sender, EventArgs e)
1175
1186
part . UpdateCompositeCollisionMap ( ) ;
1176
1187
}
1177
1188
1189
+ SetSelectedBrush ( null ) ;
1178
1190
SelectedMap = SelectedMap ;
1179
1191
}
1180
1192
}
0 commit comments