Fixed, Sector Edit window, UDMF: sector brightness was applied twice.

Fixed, Tags selector, UDMF: tags from sector with the longest array of tags was applied to sectors with shorter arrays of tags.
Fixed, Draw Settings panel: sidedef texture overrides were not applied when "Auto-clear sidedef textures" setting was enabled.
Added, Thing Edit window, UDMF: added "Show user-added custom fields only" checkbox.
This commit is contained in:
MaxED 2016-02-07 23:04:20 +00:00
parent db42e17a86
commit bd56f1db22
6 changed files with 66 additions and 16 deletions

View file

@ -61,6 +61,7 @@ namespace CodeImp.DoomBuilder.Controls
private string lasteditfieldname;
private bool autoinsertuserprefix;
private Dictionary<string, UniversalType> uifields;//mxd
private bool showfixedfields = true; //mxd
#endregion
@ -73,7 +74,8 @@ namespace CodeImp.DoomBuilder.Controls
public bool PropertyColumnVisible { get { return fieldname.Visible; } set { fieldname.Visible = value; UpdateValueColumn(); UpdateBrowseButton(); } }
public bool TypeColumnVisible { get { return fieldtype.Visible; } set { fieldtype.Visible = value; UpdateValueColumn(); UpdateBrowseButton(); } }
public bool ValueColumnVisible { get { return fieldvalue.Visible; } set { fieldvalue.Visible = value; UpdateValueColumn(); UpdateBrowseButton(); } }
public bool ShowFixedFields {get { return showfixedfields; } set { showfixedfields = value; UpdateFixedFieldsVisibility(); } } //mxd
#endregion
#region ================== Constructor
@ -96,7 +98,7 @@ namespace CodeImp.DoomBuilder.Controls
// Keep element name
this.elementname = elementname;
//mxd. get proper UIFields
//mxd. Get proper UIFields
uifields = General.Map.FormatInterface.UIFields[General.Map.FormatInterface.GetElementType(elementname)];
// Make types list
@ -640,9 +642,16 @@ namespace CodeImp.DoomBuilder.Controls
for(int i = fieldslist.Rows.Count - 1; i >= 0; i--)
{
if(fieldslist.Rows[i].ReadOnly)
try { fieldslist.Rows.RemoveAt(i); } catch(Exception) { }
{
try { fieldslist.Rows.RemoveAt(i); } catch { }
}
else
fieldslist.Rows[i].Visible = true;
{
//mxd. Preserve fixed fields visibility setting
FieldsEditorRow frow = (fieldslist.Rows[i] as FieldsEditorRow);
if(frow != null && frow.IsFixed) frow.Visible = showfixedfields;
else fieldslist.Rows[i].Visible = true;
}
}
// Update new row
@ -831,6 +840,16 @@ namespace CodeImp.DoomBuilder.Controls
HideBrowseButton();
}
}
//mxd
private void UpdateFixedFieldsVisibility()
{
foreach(var row in fieldslist.Rows)
{
FieldsEditorRow frow = (row as FieldsEditorRow);
if(frow != null && frow.IsFixed) frow.Visible = showfixedfields;
}
}
#endregion
}

View file

@ -126,7 +126,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
{
if(first)
{
foreach(int tag in newtags) tags.Add(tag);
tags.AddRange(newtags);
return;
}
@ -137,6 +137,13 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
else if(i >= tags.Count)
tags.Add(int.MinValue);
}
// If current tags list is shorter than out tags list, mark the rest of our list as mixed
if(newtags.Count < tags.Count)
{
for(int i = newtags.Count; i < tags.Count; i++)
tags[i] = int.MinValue;
}
}
#endregion
@ -161,13 +168,13 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
private IEnumerable<int> GetResultTags(int[] oldtags, int offset)
{
Dictionary<int, bool> newtags = new Dictionary<int, bool>();
HashSet<int> newtags = new HashSet<int>();
for(int i = 0; i < tags.Count; i++)
{
if(tags[i] == int.MinValue && oldtags.Length > i)
{
if(!newtags.ContainsKey(oldtags[i])) newtags.Add(oldtags[i], false);
if(oldtags[i] != 0 && !newtags.Contains(oldtags[i])) newtags.Add(oldtags[i]);
}
else if(tags[i] != 0 && tags[i] != int.MinValue)
{
@ -179,12 +186,12 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
else
tag = tags[i];
if(!newtags.ContainsKey(tag)) newtags.Add(tag, false);
if(!newtags.Contains(tag)) newtags.Add(tag);
}
}
if(newtags.Count == 0) newtags.Add(0, false);
return newtags.Keys;
if(newtags.Count == 0) newtags.Add(0);
return newtags;
}
#endregion

View file

@ -743,9 +743,9 @@ namespace CodeImp.DoomBuilder.Geometry
//mxd. This applies overrides to a sidedef
private static void ApplyOverridesToSidedef(Sidedef sd)
{
if(General.Map.Options.OverrideTopTexture) sd.SetTextureHigh(General.Map.Options.DefaultTopTexture);
if(sd.HighRequired() && General.Map.Options.OverrideTopTexture) sd.SetTextureHigh(General.Map.Options.DefaultTopTexture);
if(sd.MiddleRequired() && General.Map.Options.OverrideMiddleTexture) sd.SetTextureMid(General.Map.Options.DefaultWallTexture);
if(General.Map.Options.OverrideBottomTexture) sd.SetTextureLow(General.Map.Options.DefaultBottomTexture);
if(sd.LowRequired() && General.Map.Options.OverrideBottomTexture) sd.SetTextureLow(General.Map.Options.DefaultBottomTexture);
}
#endregion
@ -1467,9 +1467,9 @@ namespace CodeImp.DoomBuilder.Geometry
}
//mxd. Apply texture overrides
if(useOverrides && !General.Settings.AutoClearSidedefTextures)
if(useOverrides)
{
//if new sectors are created, apply overrides to the sides of these sectors, otherwise, apply overrides to all new lines
// If new sectors are created, apply overrides to the sides of these sectors, otherwise, apply overrides to all new lines
if(insidesides.Count > 0)
{
foreach(Sidedef side in insidesides) ApplyOverridesToSidedef(side);

View file

@ -679,7 +679,6 @@ namespace CodeImp.DoomBuilder.Windows
// Effects
if(!effect.Empty) s.Effect = effect.Value;
s.Brightness = General.Clamp(brightness.GetResult(s.Brightness), General.Map.FormatInterface.MinBrightness, General.Map.FormatInterface.MaxBrightness);
//mxd. Tag
tagsselector.ApplyTo(s, tagoffset++);

View file

@ -91,6 +91,7 @@
this.tabcomment = new System.Windows.Forms.TabPage();
this.commenteditor = new CodeImp.DoomBuilder.Controls.CommentEditor();
this.tabcustom = new System.Windows.Forms.TabPage();
this.hidefixedfields = new System.Windows.Forms.CheckBox();
this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl();
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
@ -881,6 +882,7 @@
//
// tabcustom
//
this.tabcustom.Controls.Add(this.hidefixedfields);
this.tabcustom.Controls.Add(this.fieldslist);
this.tabcustom.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabcustom.Location = new System.Drawing.Point(4, 22);
@ -891,6 +893,17 @@
this.tabcustom.UseVisualStyleBackColor = true;
this.tabcustom.MouseEnter += new System.EventHandler(this.tabcustom_MouseEnter);
//
// hidefixedfields
//
this.hidefixedfields.AutoSize = true;
this.hidefixedfields.Location = new System.Drawing.Point(10, 381);
this.hidefixedfields.Name = "hidefixedfields";
this.hidefixedfields.Size = new System.Drawing.Size(195, 17);
this.hidefixedfields.TabIndex = 2;
this.hidefixedfields.Text = "Show user-added custom fields only";
this.hidefixedfields.UseVisualStyleBackColor = true;
this.hidefixedfields.CheckedChanged += new System.EventHandler(this.hidefixedfields_CheckedChanged);
//
// fieldslist
//
this.fieldslist.AllowInsert = true;
@ -904,7 +917,8 @@
this.fieldslist.Name = "fieldslist";
this.fieldslist.PropertyColumnVisible = true;
this.fieldslist.PropertyColumnWidth = 150;
this.fieldslist.Size = new System.Drawing.Size(611, 389);
this.fieldslist.ShowFixedFields = true;
this.fieldslist.Size = new System.Drawing.Size(611, 368);
this.fieldslist.TabIndex = 1;
this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100;
@ -1006,6 +1020,7 @@
this.grouptag.ResumeLayout(false);
this.tabcomment.ResumeLayout(false);
this.tabcustom.ResumeLayout(false);
this.tabcustom.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.hint)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -1082,5 +1097,6 @@
private CodeImp.DoomBuilder.Controls.ArgumentsControl argscontrol;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floatbobphase;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox hidefixedfields;
}
}

View file

@ -131,6 +131,9 @@ namespace CodeImp.DoomBuilder.Windows
// Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.ThingFields);
//mxd. Show fixed fields?
hidefixedfields.Checked = !General.Settings.ReadSetting("customfieldsshowfixed", true);
// Thing height?
posZ.Visible = General.Map.FormatInterface.HasThingHeight;
zlabel.Visible = General.Map.FormatInterface.HasThingHeight;
@ -578,6 +581,7 @@ namespace CodeImp.DoomBuilder.Windows
{
location = this.Location;
activetab = tabs.SelectedIndex;
General.Settings.WriteSetting("customfieldsshowfixed", !hidefixedfields.Checked);
}
// Help
@ -867,6 +871,11 @@ namespace CodeImp.DoomBuilder.Windows
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void hidefixedfields_CheckedChanged(object sender, EventArgs e)
{
fieldslist.ShowFixedFields = !hidefixedfields.Checked;
}
#endregion
}