mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Fixed, Edit Linedefs window: textures on selected sidedefs must be updated when toggling "Replace unused textures" setting.
Fixed, Texture Selector control: in some cases actual textures were never loaded/displayed when "Replace unused textures" setting was disabled. Fixed, Script Editor: auto-completion list is no longed displayed when editing comments, includes or strings.
This commit is contained in:
parent
503ce1bfaf
commit
ea02a5404f
7 changed files with 208 additions and 27 deletions
|
@ -67,7 +67,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
if(usepreviews ? !texture.IsPreviewLoaded : !texture.IsImageLoaded) timer.Start(); //mxd
|
||||
|
||||
// Set the image
|
||||
return (usepreviews ? texture.GetPreview() : texture.GetBitmap());
|
||||
return new Bitmap(usepreviews ? texture.GetPreview() : texture.GetBitmap());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1003,6 +1003,17 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
return false;
|
||||
}
|
||||
|
||||
// Don't show Auto-completion list when editing comment, include or string
|
||||
switch(GetScriptStyle(scriptedit.GetStyleAt(currentpos)))
|
||||
{
|
||||
case ScriptStyleType.Comment:
|
||||
case ScriptStyleType.String:
|
||||
case ScriptStyleType.Include:
|
||||
// Hide the list
|
||||
scriptedit.AutoCCancel();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter the list
|
||||
List<string> filtered = new List<string>();
|
||||
foreach(string s in autocompletelist)
|
||||
|
|
|
@ -74,10 +74,12 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
if(string.IsNullOrEmpty(texture.FilePathName) || texture is UnknownImage) DisplayImageSize(0, 0); //mxd
|
||||
else DisplayImageSize(texture.ScaledWidth, texture.ScaledHeight); //mxd
|
||||
if(usepreviews ? !texture.IsPreviewLoaded : !texture.IsImageLoaded) timer.Start(); //mxd
|
||||
|
||||
if(usepreviews && !texture.IsPreviewLoaded) timer.Start(); //mxd
|
||||
else if(!texture.IsImageLoaded) texture.LoadImage(); //mxd. In some cases the image may never me loaded by the DataManager
|
||||
|
||||
// Set the image
|
||||
return (usepreviews ? texture.GetPreview() : texture.GetBitmap());
|
||||
return new Bitmap((usepreviews ? texture.GetPreview() : texture.GetBitmap()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
2
Source/Core/Windows/LinedefEditForm.Designer.cs
generated
2
Source/Core/Windows/LinedefEditForm.Designer.cs
generated
|
@ -292,6 +292,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.replaceunusedfronttextures.TabIndex = 43;
|
||||
this.replaceunusedfronttextures.Text = "Replace unused textures";
|
||||
this.replaceunusedfronttextures.UseVisualStyleBackColor = true;
|
||||
this.replaceunusedfronttextures.CheckedChanged += new System.EventHandler(this.replaceunusedfronttextures_CheckedChanged);
|
||||
//
|
||||
//
|
||||
// labelFrontTextureOffset
|
||||
|
@ -401,6 +402,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.replaceunusedbacktextures.TabIndex = 44;
|
||||
this.replaceunusedbacktextures.Text = "Replace unused textures";
|
||||
this.replaceunusedbacktextures.UseVisualStyleBackColor = true;
|
||||
this.replaceunusedbacktextures.CheckedChanged += new System.EventHandler(this.replaceunusedbacktextures_CheckedChanged);
|
||||
//
|
||||
//
|
||||
// labelBackTextureOffset
|
||||
|
|
|
@ -150,8 +150,10 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
cancel.Top = apply.Top;
|
||||
|
||||
//mxd. Apply texture replacement settings
|
||||
preventchanges = true;
|
||||
replaceunusedfronttextures.Checked = General.Settings.ReadSetting("editlinedefswindow.replaceunusedfronttextures", true);
|
||||
replaceunusedbacktextures.Checked = General.Settings.ReadSetting("editlinedefswindow.replaceunusedbacktextures", true);
|
||||
preventchanges = false;
|
||||
|
||||
// Update window height
|
||||
this.Height = apply.Bottom + apply.Margin.Bottom * 2 + (this.Height - this.ClientRectangle.Height) + 1;
|
||||
|
@ -289,22 +291,22 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(l.Front != null)
|
||||
{
|
||||
//mxd
|
||||
if(fronthigh.TextureName != l.Front.HighTexture)
|
||||
if(!string.IsNullOrEmpty(fronthigh.TextureName) && fronthigh.TextureName != l.Front.HighTexture)
|
||||
{
|
||||
if(!fronthigh.Required && l.Front.HighRequired()) fronthigh.Required = true;
|
||||
fronthigh.MultipleTextures = true; //mxd
|
||||
fronthigh.MultipleTextures = true;
|
||||
fronthigh.TextureName = string.Empty;
|
||||
}
|
||||
if(frontmid.TextureName != l.Front.MiddleTexture)
|
||||
if(!string.IsNullOrEmpty(frontmid.TextureName) && frontmid.TextureName != l.Front.MiddleTexture)
|
||||
{
|
||||
if(!frontmid.Required && l.Front.MiddleRequired()) frontmid.Required = true;
|
||||
frontmid.MultipleTextures = true; //mxd
|
||||
frontmid.MultipleTextures = true;
|
||||
frontmid.TextureName = string.Empty;
|
||||
}
|
||||
if(frontlow.TextureName != l.Front.LowTexture)
|
||||
if(!string.IsNullOrEmpty(frontlow.TextureName) && frontlow.TextureName != l.Front.LowTexture)
|
||||
{
|
||||
if(!frontlow.Required && l.Front.LowRequired()) frontlow.Required = true;
|
||||
frontlow.MultipleTextures = true; //mxd
|
||||
frontlow.MultipleTextures = true;
|
||||
frontlow.TextureName = string.Empty;
|
||||
}
|
||||
if(frontsector.Text != l.Front.Sector.Index.ToString()) frontsector.Text = string.Empty;
|
||||
|
@ -316,22 +318,22 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(l.Back != null)
|
||||
{
|
||||
//mxd
|
||||
if(backhigh.TextureName != l.Back.HighTexture)
|
||||
if(!string.IsNullOrEmpty(backhigh.TextureName) && backhigh.TextureName != l.Back.HighTexture)
|
||||
{
|
||||
if(!backhigh.Required && l.Back.HighRequired()) backhigh.Required = true;
|
||||
backhigh.MultipleTextures = true; //mxd
|
||||
backhigh.MultipleTextures = true;
|
||||
backhigh.TextureName = string.Empty;
|
||||
}
|
||||
if(backmid.TextureName != l.Back.MiddleTexture)
|
||||
if(!string.IsNullOrEmpty(backmid.TextureName) && backmid.TextureName != l.Back.MiddleTexture)
|
||||
{
|
||||
if(!backmid.Required && l.Back.MiddleRequired()) backmid.Required = true;
|
||||
backmid.MultipleTextures = true; //mxd
|
||||
backmid.MultipleTextures = true;
|
||||
backmid.TextureName = string.Empty;
|
||||
}
|
||||
if(backlow.TextureName != l.Back.LowTexture)
|
||||
if(!string.IsNullOrEmpty(backlow.TextureName) && backlow.TextureName != l.Back.LowTexture)
|
||||
{
|
||||
if(!backlow.Required && l.Back.LowRequired()) backlow.Required = true;
|
||||
backlow.MultipleTextures = true; //mxd
|
||||
backlow.MultipleTextures = true;
|
||||
backlow.TextureName = string.Empty;
|
||||
}
|
||||
if(backsector.Text != l.Back.Sector.Index.ToString()) backsector.Text = string.Empty;
|
||||
|
@ -887,6 +889,86 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void replaceunusedfronttextures_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
//Re-apply front textures
|
||||
if(preventchanges) return;
|
||||
MakeUndo();
|
||||
|
||||
// Set values
|
||||
int i = 0;
|
||||
foreach(Linedef l in lines)
|
||||
{
|
||||
if(l.Front == null) continue;
|
||||
|
||||
// Update top texture
|
||||
if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(fronthigh.TextureName))
|
||||
l.Front.SetTextureHigh(linedefprops[i].Front != null ? linedefprops[i].Front.HighTexture : "-");
|
||||
else
|
||||
l.Front.SetTextureHigh(fronthigh.GetResult(l.Front.HighTexture));
|
||||
|
||||
// Update middle texture
|
||||
if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(frontmid.TextureName))
|
||||
l.Front.SetTextureMid(linedefprops[i].Front != null ? linedefprops[i].Front.MiddleTexture : "-");
|
||||
else
|
||||
l.Front.SetTextureMid(frontmid.GetResult(l.Front.MiddleTexture));
|
||||
|
||||
// Update bottom texture
|
||||
if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(frontlow.TextureName))
|
||||
l.Front.SetTextureLow(linedefprops[i].Front != null ? linedefprops[i].Front.LowTexture : "-");
|
||||
else
|
||||
l.Front.SetTextureLow(frontlow.GetResult(l.Front.LowTexture));
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
// Update the used textures
|
||||
General.Map.Data.UpdateUsedTextures();
|
||||
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void replaceunusedbacktextures_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
//Re-apply back textures
|
||||
if(preventchanges) return;
|
||||
MakeUndo();
|
||||
|
||||
// Set values
|
||||
int i = 0;
|
||||
foreach(Linedef l in lines)
|
||||
{
|
||||
if(l.Back == null) continue;
|
||||
|
||||
// Update top texture
|
||||
if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backhigh.TextureName))
|
||||
l.Back.SetTextureHigh(linedefprops[i].Back != null ? linedefprops[i].Back.HighTexture : "-");
|
||||
else
|
||||
l.Back.SetTextureHigh(backhigh.GetResult(l.Back.HighTexture));
|
||||
|
||||
// Update middle texture
|
||||
if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backmid.TextureName))
|
||||
l.Back.SetTextureMid(linedefprops[i].Back != null ? linedefprops[i].Back.MiddleTexture : "-");
|
||||
else
|
||||
l.Back.SetTextureMid(backmid.GetResult(l.Back.MiddleTexture));
|
||||
|
||||
// Update bottom texture
|
||||
if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backlow.TextureName))
|
||||
l.Back.SetTextureLow(linedefprops[i].Back != null ? linedefprops[i].Back.LowTexture : "-");
|
||||
else
|
||||
l.Back.SetTextureLow(backlow.GetResult(l.Back.LowTexture));
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
// Update the used textures
|
||||
General.Map.Data.UpdateUsedTextures();
|
||||
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void frontTextureOffset_OnValuesChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(preventchanges) return;
|
||||
|
|
|
@ -523,6 +523,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.replaceunusedfronttextures.TabIndex = 46;
|
||||
this.replaceunusedfronttextures.Text = "Replace unused textures";
|
||||
this.replaceunusedfronttextures.UseVisualStyleBackColor = true;
|
||||
this.replaceunusedfronttextures.CheckedChanged += new System.EventHandler(this.replaceunusedfronttextures_CheckedChanged);
|
||||
//
|
||||
// frontflagsgroup
|
||||
//
|
||||
|
@ -952,6 +953,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.replaceunusedbacktextures.TabIndex = 47;
|
||||
this.replaceunusedbacktextures.Text = "Replace unused textures";
|
||||
this.replaceunusedbacktextures.UseVisualStyleBackColor = true;
|
||||
this.replaceunusedbacktextures.CheckedChanged += new System.EventHandler(this.replaceunusedbacktextures_CheckedChanged);
|
||||
//
|
||||
// groupBox4
|
||||
//
|
||||
|
|
|
@ -234,8 +234,10 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
pfcBackScaleBottom.LinkValues = linkBackBottomScale;
|
||||
|
||||
// Apply texture replacement settings
|
||||
preventchanges = true;
|
||||
replaceunusedfronttextures.Checked = General.Settings.ReadSetting("editlinedefswindow.replaceunusedfronttextures", true);
|
||||
replaceunusedbacktextures.Checked = General.Settings.ReadSetting("editlinedefswindow.replaceunusedbacktextures", true);
|
||||
preventchanges = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -436,19 +438,19 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(l.Front != null)
|
||||
{
|
||||
//mxd
|
||||
if(fronthigh.TextureName != l.Front.HighTexture)
|
||||
if(!string.IsNullOrEmpty(fronthigh.TextureName) && fronthigh.TextureName != l.Front.HighTexture)
|
||||
{
|
||||
if(!fronthigh.Required && l.Front.HighRequired()) fronthigh.Required = true;
|
||||
fronthigh.MultipleTextures = true; //mxd
|
||||
fronthigh.MultipleTextures = true;
|
||||
fronthigh.TextureName = string.Empty;
|
||||
}
|
||||
if(frontmid.TextureName != l.Front.MiddleTexture)
|
||||
if(!string.IsNullOrEmpty(frontmid.TextureName) && frontmid.TextureName != l.Front.MiddleTexture)
|
||||
{
|
||||
if(!frontmid.Required && l.Front.MiddleRequired()) frontmid.Required = true;
|
||||
frontmid.MultipleTextures = true; //mxd
|
||||
frontmid.MultipleTextures = true;
|
||||
frontmid.TextureName = string.Empty;
|
||||
}
|
||||
if(frontlow.TextureName != l.Front.LowTexture)
|
||||
if(!string.IsNullOrEmpty(frontlow.TextureName) && frontlow.TextureName != l.Front.LowTexture)
|
||||
{
|
||||
if(!frontlow.Required && l.Front.LowRequired()) frontlow.Required = true;
|
||||
frontlow.MultipleTextures = true; //mxd
|
||||
|
@ -490,22 +492,22 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(l.Back != null)
|
||||
{
|
||||
//mxd
|
||||
if(backhigh.TextureName != l.Back.HighTexture)
|
||||
if(!string.IsNullOrEmpty(backhigh.TextureName) && backhigh.TextureName != l.Back.HighTexture)
|
||||
{
|
||||
if(!backhigh.Required && l.Back.HighRequired()) backhigh.Required = true;
|
||||
backhigh.MultipleTextures = true; //mxd
|
||||
backhigh.MultipleTextures = true;
|
||||
backhigh.TextureName = string.Empty;
|
||||
}
|
||||
if(backmid.TextureName != l.Back.MiddleTexture)
|
||||
if(!string.IsNullOrEmpty(backmid.TextureName) && backmid.TextureName != l.Back.MiddleTexture)
|
||||
{
|
||||
if(!backmid.Required && l.Back.MiddleRequired()) backmid.Required = true;
|
||||
backmid.MultipleTextures = true; //mxd
|
||||
backmid.MultipleTextures = true;
|
||||
backmid.TextureName = string.Empty;
|
||||
}
|
||||
if(backlow.TextureName != l.Back.LowTexture)
|
||||
if(!string.IsNullOrEmpty(backlow.TextureName) && backlow.TextureName != l.Back.LowTexture)
|
||||
{
|
||||
if(!backlow.Required && l.Back.LowRequired()) backlow.Required = true;
|
||||
backlow.MultipleTextures = true; //mxd
|
||||
backlow.MultipleTextures = true;
|
||||
backlow.TextureName = string.Empty;
|
||||
}
|
||||
if(backsector.Text != l.Back.Sector.Index.ToString()) backsector.Text = string.Empty;
|
||||
|
@ -1283,6 +1285,86 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void replaceunusedfronttextures_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
//Re-apply front textures
|
||||
if(preventchanges) return;
|
||||
MakeUndo();
|
||||
|
||||
// Set values
|
||||
int i = 0;
|
||||
foreach(Linedef l in lines)
|
||||
{
|
||||
if(l.Front == null) continue;
|
||||
|
||||
// Update top texture
|
||||
if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(fronthigh.TextureName))
|
||||
l.Front.SetTextureHigh(linedefprops[i].Front != null ? linedefprops[i].Front.HighTexture : "-");
|
||||
else
|
||||
l.Front.SetTextureHigh(fronthigh.GetResult(l.Front.HighTexture));
|
||||
|
||||
// Update middle texture
|
||||
if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(frontmid.TextureName))
|
||||
l.Front.SetTextureMid(linedefprops[i].Front != null ? linedefprops[i].Front.MiddleTexture : "-");
|
||||
else
|
||||
l.Front.SetTextureMid(frontmid.GetResult(l.Front.MiddleTexture));
|
||||
|
||||
// Update bottom texture
|
||||
if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(frontlow.TextureName))
|
||||
l.Front.SetTextureLow(linedefprops[i].Front != null ? linedefprops[i].Front.LowTexture : "-");
|
||||
else
|
||||
l.Front.SetTextureLow(frontlow.GetResult(l.Front.LowTexture));
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
// Update the used textures
|
||||
General.Map.Data.UpdateUsedTextures();
|
||||
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void replaceunusedbacktextures_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
//Re-apply back textures
|
||||
if(preventchanges) return;
|
||||
MakeUndo();
|
||||
|
||||
// Set values
|
||||
int i = 0;
|
||||
foreach(Linedef l in lines)
|
||||
{
|
||||
if(l.Back == null) continue;
|
||||
|
||||
// Update top texture
|
||||
if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backhigh.TextureName))
|
||||
l.Back.SetTextureHigh(linedefprops[i].Back != null ? linedefprops[i].Back.HighTexture : "-");
|
||||
else
|
||||
l.Back.SetTextureHigh(backhigh.GetResult(l.Back.HighTexture));
|
||||
|
||||
// Update middle texture
|
||||
if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backmid.TextureName))
|
||||
l.Back.SetTextureMid(linedefprops[i].Back != null ? linedefprops[i].Back.MiddleTexture : "-");
|
||||
else
|
||||
l.Back.SetTextureMid(backmid.GetResult(l.Back.MiddleTexture));
|
||||
|
||||
// Update bottom texture
|
||||
if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backlow.TextureName))
|
||||
l.Back.SetTextureLow(linedefprops[i].Back != null ? linedefprops[i].Back.LowTexture : "-");
|
||||
else
|
||||
l.Back.SetTextureLow(backlow.GetResult(l.Back.LowTexture));
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
// Update the used textures
|
||||
General.Map.Data.UpdateUsedTextures();
|
||||
|
||||
General.Map.IsChanged = true;
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Brightness changed
|
||||
|
|
Loading…
Reference in a new issue