GZDoomBuilder 1.05с:

Fixed a crash in Color Picker plugin when user tried to set Sector or Fade color to multiple sectors.
This commit is contained in:
MaxED 2012-05-15 15:23:03 +00:00
parent 5d58612d05
commit 62ba723ac1
9 changed files with 14 additions and 16 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -46,16 +46,6 @@ namespace CodeImp.DoomBuilder.ColorPicker
public override void OnMapOpenEnd() {
if (toolsform == null)
toolsform = new ToolsForm();
//dbg
/*CodeImp.DoomBuilder.Rendering.PixelColor c = new CodeImp.DoomBuilder.Rendering.PixelColor(255, 255, 64, 3);
int ic = c.ToColorRef();
CodeImp.DoomBuilder.Rendering.PixelColor c2 = CodeImp.DoomBuilder.Rendering.PixelColor.FromInt(ic);
GZBuilder.GZGeneral.Trace("c: "+c.r+","+c.g+","+c.b);
GZBuilder.GZGeneral.Trace("ic: " + ic);
GZBuilder.GZGeneral.Trace("c2: " + c2.r + "," + c2.g + "," + c2.b);*/
}
public override void OnMapNewEnd() {

View file

@ -42,7 +42,10 @@ namespace CodeImp.DoomBuilder.ColorPicker.Controls {
public void Initialize(Color startColor){
this.startColor = startColor;
isInUpdate = true;
InitializeComponent();
isInUpdate = false;
}
private void nudValueChanged(object sender, System.EventArgs e) {

View file

@ -54,15 +54,20 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
//set colors
curSectorColor = selection[0].Fields.GetValue<int>("lightcolor", -1);
if (curSectorColor == -1) { //add lightcolor field
if (curSectorColor == -1)
curSectorColor = defaultSectorColor;
selection[0].Fields.Add("lightcolor", new UniValue(UniversalType.Color, curSectorColor));
}
curFadeColor = selection[0].Fields.GetValue<int>("fadecolor", -1);
if (curFadeColor == -1) { //add fadecolor field
if (curFadeColor == -1)
curFadeColor = defaultFadeColor;
selection[0].Fields.Add("fadecolor", new UniValue(UniversalType.Color, curFadeColor));
//check that all sectors in selection have "lightcolor" and "fadecolor" fields
for (int i = 0; i < selection.Count; i++) {
if (!selection[i].Fields.ContainsKey("lightcolor"))
selection[i].Fields.Add("lightcolor", new UniValue(UniversalType.Color, curSectorColor));
if (!selection[i].Fields.ContainsKey("fadecolor"))
selection[i].Fields.Add("fadecolor", new UniValue(UniversalType.Color, curFadeColor));
}
initialSectorColor = curSectorColor;
@ -70,10 +75,10 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
InitializeComponent();
colorPickerControl1.Initialize(Color.FromArgb(currentColorTag == "lightcolor" ? curSectorColor : curFadeColor));
colorPickerControl1.ColorChanged += new EventHandler<ColorChangedEventArgs>(colorPickerControl1_ColorChanged);
colorPickerControl1.OnOkPressed += new EventHandler(colorPickerControl1_OnOkPressed);
colorPickerControl1.OnCancelPressed += new EventHandler(colorPickerControl1_OnCancelPressed);
colorPickerControl1.Initialize(Color.FromArgb(currentColorTag == "lightcolor" ? curSectorColor : curFadeColor));
if (currentColorTag == "lightcolor")
rbSectorColor.Checked = true;