OBJ Exporter: fixed problem where parts of the dialog would be erroneously enabled or disabled

This commit is contained in:
biwa 2021-03-22 18:14:05 +01:00
parent a771de1848
commit ccfafec7d8
2 changed files with 36 additions and 33 deletions

View file

@ -39,6 +39,8 @@
this.nudScale = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.gbGZDoom = new System.Windows.Forms.GroupBox();
this.cbGenerateCode = new System.Windows.Forms.CheckBox();
this.cbGenerateModeldef = new System.Windows.Forms.CheckBox();
this.actorNameError = new System.Windows.Forms.PictureBox();
this.gbActorFormat = new System.Windows.Forms.GroupBox();
this.rbZScript = new System.Windows.Forms.RadioButton();
@ -73,8 +75,6 @@
this.cbIgnoreControlSectors = new System.Windows.Forms.CheckBox();
this.browse = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.cbGenerateModeldef = new System.Windows.Forms.CheckBox();
this.cbGenerateCode = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.nudScale)).BeginInit();
this.gbGZDoom.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.actorNameError)).BeginInit();
@ -209,6 +209,27 @@
this.gbGZDoom.TabIndex = 6;
this.gbGZDoom.TabStop = false;
//
// cbGenerateCode
//
this.cbGenerateCode.AutoSize = true;
this.cbGenerateCode.Location = new System.Drawing.Point(8, 161);
this.cbGenerateCode.Name = "cbGenerateCode";
this.cbGenerateCode.Size = new System.Drawing.Size(171, 17);
this.cbGenerateCode.TabIndex = 25;
this.cbGenerateCode.Text = "Generate ZScript/DECORATE";
this.cbGenerateCode.UseVisualStyleBackColor = true;
this.cbGenerateCode.CheckedChanged += new System.EventHandler(this.cbGenerateCode_CheckedChanged);
//
// cbGenerateModeldef
//
this.cbGenerateModeldef.AutoSize = true;
this.cbGenerateModeldef.Location = new System.Drawing.Point(8, 184);
this.cbGenerateModeldef.Name = "cbGenerateModeldef";
this.cbGenerateModeldef.Size = new System.Drawing.Size(132, 17);
this.cbGenerateModeldef.TabIndex = 25;
this.cbGenerateModeldef.Text = "Generate MODELDEF";
this.cbGenerateModeldef.UseVisualStyleBackColor = true;
//
// actorNameError
//
this.actorNameError.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Warning;
@ -532,27 +553,6 @@
this.browse.UseVisualStyleBackColor = true;
this.browse.Click += new System.EventHandler(this.browse_Click);
//
// cbGenerateModeldef
//
this.cbGenerateModeldef.AutoSize = true;
this.cbGenerateModeldef.Location = new System.Drawing.Point(8, 184);
this.cbGenerateModeldef.Name = "cbGenerateModeldef";
this.cbGenerateModeldef.Size = new System.Drawing.Size(132, 17);
this.cbGenerateModeldef.TabIndex = 25;
this.cbGenerateModeldef.Text = "Generate MODELDEF";
this.cbGenerateModeldef.UseVisualStyleBackColor = true;
//
// cbGenerateCode
//
this.cbGenerateCode.AutoSize = true;
this.cbGenerateCode.Location = new System.Drawing.Point(8, 161);
this.cbGenerateCode.Name = "cbGenerateCode";
this.cbGenerateCode.Size = new System.Drawing.Size(171, 17);
this.cbGenerateCode.TabIndex = 25;
this.cbGenerateCode.Text = "Generate ZScript/DECORATE";
this.cbGenerateCode.UseVisualStyleBackColor = true;
this.cbGenerateCode.CheckedChanged += new System.EventHandler(this.cbGenerateCode_CheckedChanged);
//
// WavefrontSettingsForm
//
this.AcceptButton = this.export;

View file

@ -86,21 +86,22 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
lbSkipTextures.Items.Add(de.Value);
}
// Toggle enable/disable manually because cbFixScale is a child of the group box, so disabling
// the group box would also disable cbFixScale
foreach (Control c in gbGZDoom.Controls)
{
if (c != cbExportForGZDoom)
c.Enabled = cbExportForGZDoom.Checked;
}
cbGenerateCode.Checked = General.Settings.ReadPluginSetting("objgeneratecode", true);
cbGenerateModeldef.Checked = General.Settings.ReadPluginSetting("objgeneratemodeldef", true);
if(cbExportForGZDoom.Checked)
if (cbExportForGZDoom.Checked)
{
gbActorFormat.Enabled = gbActorSettings.Enabled = cbGenerateCode.Checked;
}
// Toggle enable/disable manually because cbFixScale is a child of the group box, so disabling
// the group box would also disable cbFixScale
//foreach (Control c in gbGZDoom.Controls)
foreach (Control c in cbExportForGZDoom.Parent.Controls)
{
if (c != cbExportForGZDoom)
c.Enabled = cbExportForGZDoom.Checked;
}
}
#region ================== Methods
@ -223,10 +224,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
// the group box would also disable cbFixScale
foreach(Control c in cbExportForGZDoom.Parent.Controls)
{
if (c != cbExportForGZDoom)
if (c != cbExportForGZDoom && c != gbActorSettings && c != gbActorFormat)
c.Enabled = !c.Enabled;
}
gbActorSettings.Enabled = gbActorFormat.Enabled = cbGenerateCode.Checked && cbExportForGZDoom.Checked;
tbExportPath.Enabled = browse.Enabled = cbExportTextures.Enabled = nudScale.Enabled = !cbExportForGZDoom.Checked;
}