mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
fixed problem with editing UDMF fields on multiple selected elements
This commit is contained in:
parent
4bbf14dde9
commit
1db48fd9e8
2 changed files with 20 additions and 23 deletions
|
@ -141,10 +141,11 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
if(!frow.TypeHandler.GetValue().Equals(f.Value.Value))
|
||||
{
|
||||
// Clear the value in the row
|
||||
frow.Define(f.Value.Value);
|
||||
frow.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Done
|
||||
foundrow = true;
|
||||
break;
|
||||
|
@ -158,7 +159,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Make new row
|
||||
FieldsEditorRow frow = new FieldsEditorRow(fieldslist, f.Key, f.Value.Type, f.Value.Value);
|
||||
fieldslist.Rows.Insert(fieldslist.Rows.Count - 1, frow);
|
||||
|
||||
|
||||
// When not the first, clear the field
|
||||
// because the others did not define this one
|
||||
if(!first) frow.Clear();
|
||||
|
@ -230,24 +231,20 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
if(row is FieldsEditorRow)
|
||||
{
|
||||
FieldsEditorRow frow = row as FieldsEditorRow;
|
||||
|
||||
// Field is defined?
|
||||
if(frow.IsDefined)
|
||||
|
||||
// Field is defined and not empty?
|
||||
if(frow.IsDefined && !frow.IsEmpty)
|
||||
{
|
||||
// Only apply when not empty
|
||||
if(!frow.IsEmpty)
|
||||
{
|
||||
// Apply field
|
||||
object oldvalue = null;
|
||||
if(tofields.ContainsKey(frow.Name)) oldvalue = tofields[frow.Name].Value;
|
||||
tofields[frow.Name] = new UniValue(frow.TypeHandler.Index, frow.GetResult(oldvalue));
|
||||
// Apply field
|
||||
object oldvalue = null;
|
||||
if(tofields.ContainsKey(frow.Name)) oldvalue = tofields[frow.Name].Value;
|
||||
tofields[frow.Name] = new UniValue(frow.TypeHandler.Index, frow.GetResult(oldvalue));
|
||||
|
||||
// Custom row?
|
||||
if(!frow.IsFixed)
|
||||
{
|
||||
// Write type to map configuration
|
||||
General.Map.Options.SetUniversalFieldType(elementname, frow.Name, frow.TypeHandler.Index);
|
||||
}
|
||||
// Custom row?
|
||||
if(!frow.IsFixed)
|
||||
{
|
||||
// Write type to map configuration
|
||||
General.Map.Options.SetUniversalFieldType(elementname, frow.Name, frow.TypeHandler.Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// This is true when the field is defined. Cannot be false when this field
|
||||
// is not fixed, because non-fixed fields are deleted from the list when undefined.
|
||||
private bool isdefined;
|
||||
|
||||
|
||||
// Type
|
||||
private TypeHandler fieldtype;
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
public bool IsFixed { get { return isfixed; } }
|
||||
public bool IsDefined { get { return isdefined; } }
|
||||
public bool IsEmpty { get { return (this.Cells[2].Value.ToString().Length == 0); } }
|
||||
public bool IsEmpty { get { return (this.Cells[2].Value == null) || (this.Cells[2].Value.ToString().Length == 0); } }
|
||||
public string Name { get { return this.Cells[0].Value.ToString(); } }
|
||||
public TypeHandler TypeHandler { get { return fieldtype; } }
|
||||
public UniversalFieldInfo Info { get { return fieldinfo; } }
|
||||
|
@ -193,7 +193,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
// Anything in the box?
|
||||
if(this.Cells[2].Value.ToString().Length > 0)
|
||||
if((this.Cells[2].Value != null) && (this.Cells[2].Value.ToString().Length > 0))
|
||||
{
|
||||
// Validate value
|
||||
fieldtype.SetValue(this.Cells[2].Value);
|
||||
|
@ -252,7 +252,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.Cells[1].Value = fieldtype.GetDisplayType();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This clears the field
|
||||
public void Clear()
|
||||
{
|
||||
|
@ -263,7 +263,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public object GetResult(object value)
|
||||
{
|
||||
// Anything in the box?
|
||||
if(this.Cells[2].Value.ToString().Length > 0)
|
||||
if((this.Cells[2].Value != null) && (this.Cells[2].Value.ToString().Length > 0))
|
||||
{
|
||||
// Return validated value
|
||||
fieldtype.SetValue(this.Cells[2].Value);
|
||||
|
|
Loading…
Reference in a new issue