Set Default Textures: empty textures can now be used as default ones.

Sector Edit forms: floor/ceiling textures can be cleared with right-click on texture selectors.
This commit is contained in:
MaxED 2013-08-26 10:51:33 +00:00
parent 3e11ae734d
commit 04ee4717b4
4 changed files with 7 additions and 15 deletions

View file

@ -545,13 +545,13 @@ namespace CodeImp.DoomBuilder.Config
if(General.Map == null) return;
// Default texture missing?
if((defaulttexture == null) || defaulttexture.StartsWith("-"))
if(defaulttexture == null || (!gzForceDefaultTextures && defaulttexture == "-")) //mxd
{
// Find default texture from map
foundone = false;
foreach(Sidedef sd in General.Map.Map.Sidedefs)
{
if(!sd.MiddleTexture.StartsWith("-"))
if(sd.MiddleTexture != "-")
{
defaulttexture = sd.MiddleTexture;
if(General.Map.Data.GetTextureExists(defaulttexture))

View file

@ -37,7 +37,6 @@ namespace CodeImp.DoomBuilder.Controls
private Bitmap bmp;
private bool ismouseinside;
private MouseButtons button;
protected bool allowclear;
private string previousImageName; //mxd
#endregion
@ -92,7 +91,7 @@ namespace CodeImp.DoomBuilder.Controls
ShowPreview(FindImage(name.Text));
if(button == MouseButtons.Right)
{
if(allowclear) name.Text = "-";
name.Text = "-";
}
else if(button == MouseButtons.Left)
{
@ -111,7 +110,7 @@ namespace CodeImp.DoomBuilder.Controls
private void preview_MouseDown(object sender, MouseEventArgs e)
{
button = e.Button;
if((button == MouseButtons.Left) || ((button == MouseButtons.Right) && allowclear))
if((button == MouseButtons.Left) || ((button == MouseButtons.Right)))
{
//ispressed = true;
preview.BackColor = AdjustedColor(SystemColors.Highlight, 0.2f);

View file

@ -39,7 +39,6 @@ namespace CodeImp.DoomBuilder.Controls
// Fill autocomplete list
name.AutoCompleteCustomSource.AddRange(General.Map.Data.TextureNames.ToArray());
allowclear = true;
}
// This finds the image we need for the given texture name

View file

@ -27,15 +27,9 @@ namespace CodeImp.DoomBuilder.Windows
}
private void bApply_Click(object sender, EventArgs e) {
if(General.Map.Data.GetTextureExists(ceiling.TextureName))
General.Settings.DefaultCeilingTexture = ceiling.TextureName;
if(General.Map.Data.GetTextureExists(floor.TextureName))
General.Settings.DefaultFloorTexture = floor.TextureName;
if(General.Map.Data.GetTextureExists(walls.TextureName))
General.Settings.DefaultTexture = walls.TextureName;
General.Settings.DefaultCeilingTexture = string.IsNullOrEmpty(ceiling.TextureName) ? "-" : ceiling.TextureName;
General.Settings.DefaultFloorTexture = string.IsNullOrEmpty(floor.TextureName) ? "-" : floor.TextureName;
General.Settings.DefaultTexture = string.IsNullOrEmpty(walls.TextureName) ? "-" : walls.TextureName;
General.Settings.GZForceDefaultTextures = cbForceDefault.Checked;
Close();
}