mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 12:50:52 +00:00
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:
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.
Binary file not shown.
|
@ -46,16 +46,6 @@ namespace CodeImp.DoomBuilder.ColorPicker
|
||||||
public override void OnMapOpenEnd() {
|
public override void OnMapOpenEnd() {
|
||||||
if (toolsform == null)
|
if (toolsform == null)
|
||||||
toolsform = new ToolsForm();
|
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() {
|
public override void OnMapNewEnd() {
|
||||||
|
|
|
@ -42,7 +42,10 @@ namespace CodeImp.DoomBuilder.ColorPicker.Controls {
|
||||||
|
|
||||||
public void Initialize(Color startColor){
|
public void Initialize(Color startColor){
|
||||||
this.startColor = startColor;
|
this.startColor = startColor;
|
||||||
|
|
||||||
|
isInUpdate = true;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
isInUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void nudValueChanged(object sender, System.EventArgs e) {
|
private void nudValueChanged(object sender, System.EventArgs e) {
|
||||||
|
|
|
@ -54,15 +54,20 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
||||||
|
|
||||||
//set colors
|
//set colors
|
||||||
curSectorColor = selection[0].Fields.GetValue<int>("lightcolor", -1);
|
curSectorColor = selection[0].Fields.GetValue<int>("lightcolor", -1);
|
||||||
if (curSectorColor == -1) { //add lightcolor field
|
if (curSectorColor == -1)
|
||||||
curSectorColor = defaultSectorColor;
|
curSectorColor = defaultSectorColor;
|
||||||
selection[0].Fields.Add("lightcolor", new UniValue(UniversalType.Color, curSectorColor));
|
|
||||||
}
|
|
||||||
|
|
||||||
curFadeColor = selection[0].Fields.GetValue<int>("fadecolor", -1);
|
curFadeColor = selection[0].Fields.GetValue<int>("fadecolor", -1);
|
||||||
if (curFadeColor == -1) { //add fadecolor field
|
if (curFadeColor == -1)
|
||||||
curFadeColor = defaultFadeColor;
|
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;
|
initialSectorColor = curSectorColor;
|
||||||
|
@ -70,10 +75,10 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
colorPickerControl1.Initialize(Color.FromArgb(currentColorTag == "lightcolor" ? curSectorColor : curFadeColor));
|
||||||
colorPickerControl1.ColorChanged += new EventHandler<ColorChangedEventArgs>(colorPickerControl1_ColorChanged);
|
colorPickerControl1.ColorChanged += new EventHandler<ColorChangedEventArgs>(colorPickerControl1_ColorChanged);
|
||||||
colorPickerControl1.OnOkPressed += new EventHandler(colorPickerControl1_OnOkPressed);
|
colorPickerControl1.OnOkPressed += new EventHandler(colorPickerControl1_OnOkPressed);
|
||||||
colorPickerControl1.OnCancelPressed += new EventHandler(colorPickerControl1_OnCancelPressed);
|
colorPickerControl1.OnCancelPressed += new EventHandler(colorPickerControl1_OnCancelPressed);
|
||||||
colorPickerControl1.Initialize(Color.FromArgb(currentColorTag == "lightcolor" ? curSectorColor : curFadeColor));
|
|
||||||
|
|
||||||
if (currentColorTag == "lightcolor")
|
if (currentColorTag == "lightcolor")
|
||||||
rbSectorColor.Checked = true;
|
rbSectorColor.Checked = true;
|
||||||
|
|
Loading…
Reference in a new issue