Info panels: thing and sector flags are now displayed.

Visual mode: changed "Move Texture Left/Right/Up/Down by 8" actions to "Move Texture Left/Right/Up/Down by cur. grid size"
Visual mode: holding Ctrl-Shift while dragging texture with the mouse will snap texture offsets to current grid size.
Classic modes: interiors of highlighted sectors are now highlighted when the action target of currently highlighted map element is sector.
Unhandeled exceptions infos are now written to the event log.
This commit is contained in:
MaxED 2013-12-05 09:24:55 +00:00
parent 44bf0b9588
commit ca03109006
22 changed files with 655 additions and 536 deletions

View file

@ -72,6 +72,8 @@ namespace CodeImp.DoomBuilder.Controls
this.floortex = new System.Windows.Forms.Panel();
this.labelFloorTextureSize = new System.Windows.Forms.Label();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.flagsPanel = new System.Windows.Forms.GroupBox();
this.flags = new System.Windows.Forms.ListView();
label13 = new System.Windows.Forms.Label();
label5 = new System.Windows.Forms.Label();
label4 = new System.Windows.Forms.Label();
@ -86,6 +88,7 @@ namespace CodeImp.DoomBuilder.Controls
this.floorInfo.SuspendLayout();
this.floortex.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.flagsPanel.SuspendLayout();
this.SuspendLayout();
//
// label13
@ -378,7 +381,7 @@ namespace CodeImp.DoomBuilder.Controls
this.ceilingInfo.Controls.Add(this.ceilingAngleLabel);
this.ceilingInfo.Controls.Add(this.ceilingScaleLabel);
this.ceilingInfo.Controls.Add(this.ceilingAngle);
this.ceilingInfo.Location = new System.Drawing.Point(82, 15);
this.ceilingInfo.Location = new System.Drawing.Point(80, 15);
this.ceilingInfo.Name = "ceilingInfo";
this.ceilingInfo.Size = new System.Drawing.Size(118, 80);
this.ceilingInfo.TabIndex = 2;
@ -439,7 +442,7 @@ namespace CodeImp.DoomBuilder.Controls
this.floorInfo.Controls.Add(this.floorAngleLabel);
this.floorInfo.Controls.Add(this.floorScaleLabel);
this.floorInfo.Controls.Add(this.floorAngle);
this.floorInfo.Location = new System.Drawing.Point(82, 15);
this.floorInfo.Location = new System.Drawing.Point(80, 15);
this.floorInfo.Name = "floorInfo";
this.floorInfo.Size = new System.Drawing.Size(118, 80);
this.floorInfo.TabIndex = 30;
@ -514,13 +517,40 @@ namespace CodeImp.DoomBuilder.Controls
this.flowLayoutPanel1.Controls.Add(this.sectorinfo);
this.flowLayoutPanel1.Controls.Add(this.floorpanel);
this.flowLayoutPanel1.Controls.Add(this.ceilingpanel);
this.flowLayoutPanel1.Controls.Add(this.flagsPanel);
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(642, 100);
this.flowLayoutPanel1.Size = new System.Drawing.Size(1090, 100);
this.flowLayoutPanel1.TabIndex = 5;
this.flowLayoutPanel1.WrapContents = false;
//
// flagsPanel
//
this.flagsPanel.Controls.Add(this.flags);
this.flagsPanel.Location = new System.Drawing.Point(629, 0);
this.flagsPanel.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.flagsPanel.Name = "flagsPanel";
this.flagsPanel.Size = new System.Drawing.Size(455, 100);
this.flagsPanel.TabIndex = 7;
this.flagsPanel.TabStop = false;
this.flagsPanel.Text = " Flags";
//
// flags
//
this.flags.BackColor = System.Drawing.SystemColors.Control;
this.flags.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.flags.CheckBoxes = true;
this.flags.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.flags.Location = new System.Drawing.Point(6, 18);
this.flags.Name = "flags";
this.flags.Scrollable = false;
this.flags.ShowGroups = false;
this.flags.Size = new System.Drawing.Size(443, 100);
this.flags.TabIndex = 0;
this.flags.UseCompatibleStateImageBehavior = false;
this.flags.View = System.Windows.Forms.View.List;
//
// SectorInfoPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -530,7 +560,7 @@ namespace CodeImp.DoomBuilder.Controls
this.MaximumSize = new System.Drawing.Size(10000, 100);
this.MinimumSize = new System.Drawing.Size(100, 100);
this.Name = "SectorInfoPanel";
this.Size = new System.Drawing.Size(642, 100);
this.Size = new System.Drawing.Size(1090, 100);
this.sectorinfo.ResumeLayout(false);
this.sectorinfo.PerformLayout();
this.ceilingpanel.ResumeLayout(false);
@ -542,6 +572,7 @@ namespace CodeImp.DoomBuilder.Controls
this.floortex.ResumeLayout(false);
this.floortex.PerformLayout();
this.flowLayoutPanel1.ResumeLayout(false);
this.flagsPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -586,5 +617,7 @@ namespace CodeImp.DoomBuilder.Controls
private System.Windows.Forms.Panel panelLightColor;
private System.Windows.Forms.Label labelFade;
private System.Windows.Forms.Label labelLight;
private System.Windows.Forms.GroupBox flagsPanel;
private System.Windows.Forms.ListView flags;
}
}

View file

@ -21,6 +21,7 @@ using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Rendering;
using System.Collections.Generic;
#endregion
@ -86,7 +87,8 @@ namespace CodeImp.DoomBuilder.Controls
//mxd
bool showExtededFloorInfo = false;
bool showExtededCeilingInfo = false;
if(General.Map.UDMF && s.Fields != null) {
if(General.Map.UDMF) {
if(s.Fields != null) {
//sector colors
labelLight.Visible = true;
labelFade.Visible = true;
@ -228,11 +230,33 @@ namespace CodeImp.DoomBuilder.Controls
floorAngle.Enabled = false;
floorAngleLabel.Enabled = false;
}
}
//Flags
flags.Items.Clear();
foreach(KeyValuePair<string, bool> group in s.Flags) {
if(group.Value) {
ListViewItem item = new ListViewItem(General.Map.Config.SectorFlags[group.Key]);
item.Checked = true;
flags.Items.Add(item);
}
}
//mxd. Flags panel visibility and size
flagsPanel.Visible = (flags.Items.Count > 0);
if(flags.Items.Count > 0) {
int itemWidth = flags.Items[0].GetBounds(ItemBoundsPortion.Entire).Width;
if(itemWidth == 0) itemWidth = 96;
flags.Width = itemWidth * (int)Math.Ceiling(flags.Items.Count / 5.0f);
flagsPanel.Width = flags.Width + flags.Left * 2;
}
} else {
panelFadeColor.Visible = false;
panelLightColor.Visible = false;
labelFade.Visible = false;
labelLight.Visible = false;
flagsPanel.Visible = false;
}
//panels size

View file

@ -52,6 +52,8 @@ namespace CodeImp.DoomBuilder.Controls
this.spritepanel = new System.Windows.Forms.GroupBox();
this.spritename = new System.Windows.Forms.Label();
this.spritetex = new System.Windows.Forms.Panel();
this.flagsPanel = new System.Windows.Forms.GroupBox();
this.flags = new System.Windows.Forms.ListView();
label5 = new System.Windows.Forms.Label();
label4 = new System.Windows.Forms.Label();
label3 = new System.Windows.Forms.Label();
@ -59,6 +61,7 @@ namespace CodeImp.DoomBuilder.Controls
label1 = new System.Windows.Forms.Label();
this.infopanel.SuspendLayout();
this.spritepanel.SuspendLayout();
this.flagsPanel.SuspendLayout();
this.SuspendLayout();
//
// label5
@ -75,7 +78,7 @@ namespace CodeImp.DoomBuilder.Controls
label4.AutoSize = true;
label4.Location = new System.Drawing.Point(30, 77);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(28, 14);
label4.Size = new System.Drawing.Size(27, 14);
label4.TabIndex = 4;
label4.Text = "Tag:";
//
@ -102,7 +105,7 @@ namespace CodeImp.DoomBuilder.Controls
label1.AutoSize = true;
label1.Location = new System.Drawing.Point(24, 19);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(34, 14);
label1.Size = new System.Drawing.Size(33, 14);
label1.TabIndex = 0;
label1.Text = "Type:";
//
@ -310,20 +313,47 @@ namespace CodeImp.DoomBuilder.Controls
this.spritetex.Size = new System.Drawing.Size(68, 60);
this.spritetex.TabIndex = 0;
//
// flagsPanel
//
this.flagsPanel.Controls.Add(this.flags);
this.flagsPanel.Location = new System.Drawing.Point(592, 0);
this.flagsPanel.Name = "flagsPanel";
this.flagsPanel.Size = new System.Drawing.Size(568, 100);
this.flagsPanel.TabIndex = 6;
this.flagsPanel.TabStop = false;
this.flagsPanel.Text = " Flags";
//
// flags
//
this.flags.BackColor = System.Drawing.SystemColors.Control;
this.flags.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.flags.CheckBoxes = true;
this.flags.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.flags.Location = new System.Drawing.Point(6, 18);
this.flags.Name = "flags";
this.flags.Scrollable = false;
this.flags.ShowGroups = false;
this.flags.Size = new System.Drawing.Size(556, 100);
this.flags.TabIndex = 0;
this.flags.UseCompatibleStateImageBehavior = false;
this.flags.View = System.Windows.Forms.View.List;
//
// ThingInfoPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.flagsPanel);
this.Controls.Add(this.spritepanel);
this.Controls.Add(this.infopanel);
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.MaximumSize = new System.Drawing.Size(10000, 100);
this.MinimumSize = new System.Drawing.Size(100, 100);
this.Name = "ThingInfoPanel";
this.Size = new System.Drawing.Size(650, 100);
this.Size = new System.Drawing.Size(1190, 100);
this.infopanel.ResumeLayout(false);
this.infopanel.PerformLayout();
this.spritepanel.ResumeLayout(false);
this.flagsPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -349,6 +379,8 @@ namespace CodeImp.DoomBuilder.Controls
private System.Windows.Forms.Label arg2;
private System.Windows.Forms.Label arg1;
private System.Windows.Forms.GroupBox infopanel;
private System.Windows.Forms.GroupBox flagsPanel;
private System.Windows.Forms.ListView flags;
}
}

View file

@ -23,6 +23,7 @@ using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.GZBuilder; //mxd
using System.Collections.Generic;
#endregion
@ -86,6 +87,7 @@ namespace CodeImp.DoomBuilder.Controls
// Move panel
spritepanel.Left = infopanel.Left + infopanel.Width + infopanel.Margin.Right + spritepanel.Margin.Left;
flagsPanel.Left = spritepanel.Left + spritepanel.Width + spritepanel.Margin.Right + flagsPanel.Margin.Left; //mxd
// Lookup thing info
ti = General.Map.Data.GetThingInfo(t.Type);
@ -200,6 +202,25 @@ namespace CodeImp.DoomBuilder.Controls
th.SetValue(t.Args[4]);
arg5.Text = th.GetStringValue();
//mxd. Flags
flags.Items.Clear();
foreach(KeyValuePair<string, bool> group in t.Flags){
if(group.Value) {
ListViewItem item = new ListViewItem(General.Map.Config.ThingFlags[group.Key]);
item.Checked = true;
flags.Items.Add(item);
}
}
//mxd. Flags panel visibility and size
flagsPanel.Visible = (flags.Items.Count > 0);
if(flags.Items.Count > 0) {
int itemWidth = flags.Items[0].GetBounds(ItemBoundsPortion.Entire).Width;
if(itemWidth == 0) itemWidth = 96;
flags.Width = itemWidth * (int)Math.Ceiling(flags.Items.Count / 5.0f);
flagsPanel.Width = flags.Width + flags.Left * 2;
}
// Show the whole thing
this.Show();
this.Update();

View file

@ -204,7 +204,4 @@
<metadata name="spritetex.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -99,6 +99,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
}
private string getExceptionDescription(Exception ex) {
//add to error logger
General.ErrorLogger.Add(ErrorType.Error, "**** " + ex.Source + ": " + ex.Message + " ****");
string message = "********EXCEPTION DETAILS********"
+ Environment.NewLine + ex.Source + ": " + ex.Message + Environment.NewLine + ex.StackTrace;

View file

@ -584,7 +584,7 @@ namespace CodeImp.DoomBuilder
// Remove the previous log file and start logging
if(File.Exists(logfile)) File.Delete(logfile);
//mxd
General.WriteLogLine("GZDoom Builder " + GZBuilder.GZGeneral.Version + GZBuilder.GZGeneral.Revision + " startup");
General.WriteLogLine("GZDoom Builder " + GZBuilder.GZGeneral.Version + GZBuilder.GZGeneral.Revision + "startup");
//General.WriteLogLine("Doom Builder " + thisversion.Major + "." + thisversion.Minor + " startup");
General.WriteLogLine("Application path: " + apppath);
General.WriteLogLine("Temporary path: " + temppath);

View file

@ -2216,7 +2216,7 @@ namespace CodeImp.DoomBuilder.Windows
this.thinginfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.thinginfo.MinimumSize = new System.Drawing.Size(100, 100);
this.thinginfo.Name = "thinginfo";
this.thinginfo.Size = new System.Drawing.Size(639, 100);
this.thinginfo.Size = new System.Drawing.Size(1190, 100);
this.thinginfo.TabIndex = 3;
this.thinginfo.Visible = false;
//
@ -2227,7 +2227,7 @@ namespace CodeImp.DoomBuilder.Windows
this.sectorinfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.sectorinfo.MinimumSize = new System.Drawing.Size(100, 100);
this.sectorinfo.Name = "sectorinfo";
this.sectorinfo.Size = new System.Drawing.Size(642, 100);
this.sectorinfo.Size = new System.Drawing.Size(1090, 100);
this.sectorinfo.TabIndex = 2;
this.sectorinfo.Visible = false;
//

View file

@ -643,7 +643,7 @@ namespace CodeImp.DoomBuilder.Windows
} else { //update values
// Apply position
foreach(Thing t in things) {
float z = (float)posZ.GetResult((int)t.Position.z);
float z = posZ.GetResult((int)t.Position.z);
if(useAbsoluteHeight && t.Sector != null)
z -= t.Sector.FloorHeight;
t.Move(new Vector3D(t.Position.x, t.Position.y, z));

View file

@ -17,7 +17,6 @@
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
@ -324,39 +323,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
//mxd. This updates OffsetX of unstable lines
private void updateTextureOffsetX() {
int c = 0;
foreach(Linedef l in unstablelines) {
if(l.Length > 0 && l.Length != unstableLinesInitialLengths[c]/* && l.Angle == unstableLinesInitialAngles[c]*/) {
if (l.Front != null && ((l.Front.MiddleRequired() || l.Front.MiddleTexture.Length > 1) || l.Front.HighRequired() || l.Front.LowRequired()) && selectedverts.Contains(l.Start)) {
l.Front.OffsetX += (int)Math.Round(unstableLinesInitialLengths[c] - l.Length);
clampTextureOffsetX(l.Front);
} else if (l.Back != null && ((l.Back.MiddleRequired() || l.Back.MiddleTexture.Length > 1) || l.Back.HighRequired() || l.Back.LowRequired()) && selectedverts.Contains(l.End)) {
l.Back.OffsetX += (int)Math.Round(unstableLinesInitialLengths[c] - l.Length);
clampTextureOffsetX(l.Back);
}
}
c++;
}
}
//mxd
private void clampTextureOffsetX(Sidedef target) {
ImageData texture = null;
if (target.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(target.MiddleTexture)) {
texture = General.Map.Data.GetFlatImage(target.MiddleTexture);
} else if (target.HighRequired() && target.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(target.HighTexture)) {
texture = General.Map.Data.GetFlatImage(target.HighTexture);
} else if (target.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(target.LowTexture)) {
texture = General.Map.Data.GetFlatImage(target.LowTexture);
}
if (texture != null && texture.IsImageLoaded)
target.OffsetX %= texture.Width;
}
// Cancelled
public override void OnCancel()
{
@ -489,10 +455,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update cached values
General.Map.Map.Update();
//mxd
if(BuilderPlug.Me.AutoAlignTextureOffsetsOnDrag)
updateTextureOffsetX();
// Done
Cursor.Current = Cursors.Default;
General.Map.IsChanged = true;
@ -533,7 +495,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Redraw
UpdateRedraw();
renderer.Present();
//General.Interface.RedrawDisplay();
}
}

View file

@ -458,7 +458,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.Present();
}
}
else if(!selecting) //mxd. We don't want to draw while multiselecting
else if(!selecting && BuilderPlug.Me.AutoDrawOnEdit) //mxd. We don't want to draw while multiselecting
{
// Start drawing mode
DrawGeometryMode drawmode = new DrawGeometryMode();

View file

@ -155,16 +155,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(renderer.StartOverlay(true))
{
//mxd. Render highlighted sector
if (BuilderPlug.Me.UseHighlight) {
if (highlighted != null) {
if(BuilderPlug.Me.UseHighlight && highlighted != null) {
int highlightedColor = General.Colors.Highlight.WithAlpha(64).ToInt();
FlatVertex[] verts = new FlatVertex[highlighted.FlatVertices.Length];
highlighted.FlatVertices.CopyTo(verts, 0);
for (int i = 0; i < verts.Length; i++)
for(int i = 0; i < verts.Length; i++)
verts[i].c = highlightedColor;
renderer.RenderGeometry(verts, null, true);
}
}
// Go for all selected sectors
ICollection<Sector> orderedselection = General.Map.Map.GetSelectedSectors(true);
@ -719,7 +717,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.Present();
}
}
else if(!selecting) //mxd. We don't want to draw while multiselecting
else if(!selecting && BuilderPlug.Me.AutoDrawOnEdit) //mxd. We don't want to draw while multiselecting
{
// Start drawing mode
DrawGeometryMode drawmode = new DrawGeometryMode();

View file

@ -365,10 +365,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.Present();
}
}
else
{
// Mouse in window?
if(mouseinside && !selecting) //mxd. We don't want to insert a thing when multiselecting
else if(mouseinside && !selecting && BuilderPlug.Me.AutoDrawOnEdit) //mxd. We don't want to insert a thing when multiselecting
{
// Edit pressed in this mode
editpressed = true;
@ -378,19 +375,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.UndoRedo.CreateUndo("Insert thing");
Thing t = InsertThing(mousemappos);
if (t == null)
{
if(t == null) {
General.Map.UndoRedo.WithdrawUndo();
}
else
{
} else {
General.Map.Map.ClearSelectedThings();
t.Selected = true;
Highlight(t);
General.Interface.RedrawDisplay();
}
}
}
base.OnEditBegin();
}

View file

@ -376,7 +376,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Redraw display
General.Interface.RedrawDisplay();
}
else
else if(BuilderPlug.Me.AutoDrawOnEdit)
{
// Start drawing mode
DrawGeometryMode drawmode = new DrawGeometryMode();

View file

@ -114,8 +114,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
private bool usehighlight;
private bool autodragonpaste;
private bool autoAlignTextureOffsetsOnCreate;//mxd
private bool autoAlignTextureOffsetsOnDrag;//mxd
private bool dontMoveGeometryOutsideMapBoundary;//mxd
private bool autoDrawOnEdit; //mxd
private bool marqueSelectTouching; //mxd. Select elements partially/fully inside of marque selection?
private bool syncSelection; //mxd. Sync selection between Visual and Classic modes.
private bool objExportTextures; //mxd
@ -176,8 +176,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
public bool AutoDragOnPaste { get { return autodragonpaste; } set { autodragonpaste = value; } }
public bool AutoDrawOnEdit { get { return autoDrawOnEdit; } set { autoDrawOnEdit = value; } } //mxd
public bool AutoAlignTextureOffsetsOnCreate { get { return autoAlignTextureOffsetsOnCreate; } set { autoAlignTextureOffsetsOnCreate = value; } } //mxd
public bool AutoAlignTextureOffsetsOnDrag { get { return autoAlignTextureOffsetsOnDrag; } set { autoAlignTextureOffsetsOnDrag = value; } } //mxd
public bool DontMoveGeometryOutsideMapBoundary { get { return dontMoveGeometryOutsideMapBoundary; } set { DontMoveGeometryOutsideMapBoundary = value; } } //mxd
public bool MarqueSelectTouching { get { return marqueSelectTouching; } set { marqueSelectTouching = value; } } //mxd
public bool SyncSelection { get { return syncSelection; } set { syncSelection = value; } } //mxd
@ -333,8 +333,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
highlightthingsrange = General.Settings.ReadPluginSetting("highlightthingsrange", 10);
splitlinedefsrange = General.Settings.ReadPluginSetting("splitlinedefsrange", 10);
autodragonpaste = General.Settings.ReadPluginSetting("autodragonpaste", false);
autoDrawOnEdit = General.Settings.ReadPluginSetting("autodrawonedit", true); //mxd
autoAlignTextureOffsetsOnCreate = General.Settings.ReadPluginSetting("autoaligntextureoffsetsoncreate", false); //mxd
autoAlignTextureOffsetsOnDrag = General.Settings.ReadPluginSetting("autoaligntextureoffsetsondrag", true); //mxd
dontMoveGeometryOutsideMapBoundary = General.Settings.ReadPluginSetting("dontmovegeometryoutsidemapboundary", false); //mxd
syncSelection = General.Settings.ReadPluginSetting("syncselection", false); //mxd
objExportTextures = General.Settings.ReadPluginSetting("objexporttextures", false); //mxd
@ -343,7 +343,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
lockSectorTextureOffsetsWhileDragging = General.Settings.ReadPluginSetting("locktextureoffsets", false); //mxd
}
//mxd
//mxd. Save settings, which can be changed via UI
private void saveSettings() {
General.Settings.WritePluginSetting("locktextureoffsets", lockSectorTextureOffsetsWhileDragging);
General.Settings.WritePluginSetting("viewselectionnumbers", viewselectionnumbers);
@ -772,6 +772,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.RenderArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
}
}
else if(asso.type == UniversalType.SectorTag) //mxd. Render sector highlight
{
foreach(Sector s in General.Map.Map.Sectors) {
if(s.Tag == asso.tag) {
int highlightedColor = General.Colors.Highlight.WithAlpha(128).ToInt();
FlatVertex[] verts = new FlatVertex[s.FlatVertices.Length];
s.FlatVertices.CopyTo(verts, 0);
for(int i = 0; i < verts.Length; i++)
verts[i].c = highlightedColor;
renderer.RenderGeometry(verts, null, true);
}
}
}
}

View file

@ -40,9 +40,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.defaultbrightness = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label11 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.autodrawonedit = new System.Windows.Forms.CheckBox();
this.syncSelection = new System.Windows.Forms.CheckBox();
this.dontMoveGeometryOutsideBounds = new System.Windows.Forms.CheckBox();
this.autoalignDraggedSidedefsOffsetX = new System.Windows.Forms.CheckBox();
this.autoaligntexturesoncreate = new System.Windows.Forms.CheckBox();
this.autodragonpaste = new System.Windows.Forms.CheckBox();
this.visualmodeclearselection = new System.Windows.Forms.CheckBox();
@ -207,9 +207,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
//
// groupBox3
//
this.groupBox3.Controls.Add(this.autodrawonedit);
this.groupBox3.Controls.Add(this.syncSelection);
this.groupBox3.Controls.Add(this.dontMoveGeometryOutsideBounds);
this.groupBox3.Controls.Add(this.autoalignDraggedSidedefsOffsetX);
this.groupBox3.Controls.Add(this.autoaligntexturesoncreate);
this.groupBox3.Controls.Add(this.autodragonpaste);
this.groupBox3.Controls.Add(this.visualmodeclearselection);
@ -224,10 +224,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.groupBox3.TabStop = false;
this.groupBox3.Text = " Options ";
//
// autodrawonedit
//
this.autodrawonedit.AutoSize = true;
this.autodrawonedit.Location = new System.Drawing.Point(13, 24);
this.autodrawonedit.Name = "autodrawonedit";
this.autodrawonedit.Size = new System.Drawing.Size(360, 18);
this.autodrawonedit.TabIndex = 11;
this.autodrawonedit.Text = "Start drawing when Edit pressed over empty space in Classic modes";
this.autodrawonedit.UseVisualStyleBackColor = true;
//
// syncSelection
//
this.syncSelection.AutoSize = true;
this.syncSelection.Location = new System.Drawing.Point(13, 250);
this.syncSelection.Location = new System.Drawing.Point(13, 249);
this.syncSelection.Name = "syncSelection";
this.syncSelection.Size = new System.Drawing.Size(306, 18);
this.syncSelection.TabIndex = 10;
@ -237,27 +247,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
// dontMoveGeometryOutsideBounds
//
this.dontMoveGeometryOutsideBounds.AutoSize = true;
this.dontMoveGeometryOutsideBounds.Location = new System.Drawing.Point(13, 225);
this.dontMoveGeometryOutsideBounds.Location = new System.Drawing.Point(13, 224);
this.dontMoveGeometryOutsideBounds.Name = "dontMoveGeometryOutsideBounds";
this.dontMoveGeometryOutsideBounds.Size = new System.Drawing.Size(332, 18);
this.dontMoveGeometryOutsideBounds.TabIndex = 9;
this.dontMoveGeometryOutsideBounds.Text = "Don\'t move selection if any part of it is outside of map boundary";
this.dontMoveGeometryOutsideBounds.UseVisualStyleBackColor = true;
//
// autoalignDraggedSidedefsOffsetX
//
this.autoalignDraggedSidedefsOffsetX.AutoSize = true;
this.autoalignDraggedSidedefsOffsetX.Location = new System.Drawing.Point(13, 200);
this.autoalignDraggedSidedefsOffsetX.Name = "autoalignDraggedSidedefsOffsetX";
this.autoalignDraggedSidedefsOffsetX.Size = new System.Drawing.Size(286, 18);
this.autoalignDraggedSidedefsOffsetX.TabIndex = 8;
this.autoalignDraggedSidedefsOffsetX.Text = "Try to align horizontal tex. offset of dragged geometry";
this.autoalignDraggedSidedefsOffsetX.UseVisualStyleBackColor = true;
//
// autoaligntexturesoncreate
//
this.autoaligntexturesoncreate.AutoSize = true;
this.autoaligntexturesoncreate.Location = new System.Drawing.Point(13, 175);
this.autoaligntexturesoncreate.Location = new System.Drawing.Point(13, 199);
this.autoaligntexturesoncreate.Name = "autoaligntexturesoncreate";
this.autoaligntexturesoncreate.Size = new System.Drawing.Size(245, 18);
this.autoaligntexturesoncreate.TabIndex = 7;
@ -267,7 +267,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// autodragonpaste
//
this.autodragonpaste.AutoSize = true;
this.autodragonpaste.Location = new System.Drawing.Point(13, 150);
this.autodragonpaste.Location = new System.Drawing.Point(13, 174);
this.autodragonpaste.Name = "autodragonpaste";
this.autodragonpaste.Size = new System.Drawing.Size(205, 18);
this.autodragonpaste.TabIndex = 6;
@ -277,7 +277,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// visualmodeclearselection
//
this.visualmodeclearselection.AutoSize = true;
this.visualmodeclearselection.Location = new System.Drawing.Point(13, 125);
this.visualmodeclearselection.Location = new System.Drawing.Point(13, 149);
this.visualmodeclearselection.Name = "visualmodeclearselection";
this.visualmodeclearselection.Size = new System.Drawing.Size(220, 18);
this.visualmodeclearselection.TabIndex = 5;
@ -287,7 +287,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// autoclearselection
//
this.autoclearselection.AutoSize = true;
this.autoclearselection.Location = new System.Drawing.Point(13, 100);
this.autoclearselection.Location = new System.Drawing.Point(13, 124);
this.autoclearselection.Name = "autoclearselection";
this.autoclearselection.Size = new System.Drawing.Size(231, 18);
this.autoclearselection.TabIndex = 4;
@ -297,7 +297,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// editnewthing
//
this.editnewthing.AutoSize = true;
this.editnewthing.Location = new System.Drawing.Point(13, 25);
this.editnewthing.Location = new System.Drawing.Point(13, 49);
this.editnewthing.Name = "editnewthing";
this.editnewthing.Size = new System.Drawing.Size(256, 18);
this.editnewthing.TabIndex = 1;
@ -307,7 +307,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// editnewsector
//
this.editnewsector.AutoSize = true;
this.editnewsector.Location = new System.Drawing.Point(13, 50);
this.editnewsector.Location = new System.Drawing.Point(13, 74);
this.editnewsector.Name = "editnewsector";
this.editnewsector.Size = new System.Drawing.Size(271, 18);
this.editnewsector.TabIndex = 2;
@ -317,7 +317,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// additiveselect
//
this.additiveselect.AutoSize = true;
this.additiveselect.Location = new System.Drawing.Point(13, 75);
this.additiveselect.Location = new System.Drawing.Point(13, 99);
this.additiveselect.Name = "additiveselect";
this.additiveselect.Size = new System.Drawing.Size(211, 18);
this.additiveselect.TabIndex = 3;
@ -589,7 +589,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ComboBox splitbehavior;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.CheckBox autoaligntexturesoncreate;
private System.Windows.Forms.CheckBox autoalignDraggedSidedefsOffsetX;
private System.Windows.Forms.CheckBox dontMoveGeometryOutsideBounds;
private System.Windows.Forms.CheckBox syncSelection;
private System.Windows.Forms.GroupBox groupBox4;
@ -601,5 +600,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.CheckBox autodrawonedit;
}
}

View file

@ -54,9 +54,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
visualmodeclearselection.Checked = BuilderPlug.Me.VisualModeClearSelection;
autodragonpaste.Checked = BuilderPlug.Me.AutoDragOnPaste;
autoaligntexturesoncreate.Checked = BuilderPlug.Me.AutoAlignTextureOffsetsOnCreate; //mxd
autoalignDraggedSidedefsOffsetX.Checked = BuilderPlug.Me.AutoAlignTextureOffsetsOnDrag; //mxd
dontMoveGeometryOutsideBounds.Checked = BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary; //mxd
syncSelection.Checked = BuilderPlug.Me.SyncSelection; //mxd
autodrawonedit.Checked = BuilderPlug.Me.AutoDrawOnEdit;
defaultbrightness.Text = General.Settings.DefaultBrightness.ToString(); //mxd
defaultceilheight.Text = General.Settings.DefaultCeilingHeight.ToString();//mxd
defaultfloorheight.Text = General.Settings.DefaultFloorHeight.ToString(); //mxd
@ -82,8 +82,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Settings.WritePluginSetting("autoclearselection", autoclearselection.Checked);
General.Settings.WritePluginSetting("visualmodeclearselection", visualmodeclearselection.Checked);
General.Settings.WritePluginSetting("autodragonpaste", autodragonpaste.Checked);
General.Settings.WritePluginSetting("autodrawonedit", autodrawonedit.Checked); //mxd
General.Settings.WritePluginSetting("autoaligntextureoffsetsoncreate", autoaligntexturesoncreate.Checked);//mxd
General.Settings.WritePluginSetting("autoaligntextureoffsetsondrag", autoalignDraggedSidedefsOffsetX.Checked);//mxd
General.Settings.WritePluginSetting("dontmovegeometryoutsidemapboundary", dontMoveGeometryOutsideBounds.Checked);//mxd
General.Settings.WritePluginSetting("syncselection", syncSelection.Checked);//mxd

View file

@ -642,9 +642,9 @@ movetexturedown
movetextureleft8
{
title = "Move Texture Left by 8";
title = "Move Texture Left by cur. grid size";
category = "visual";
description = "Moves the offset of the targeted or selected textures to the left by 8 pixels.";
description = "Moves the offset of the targeted or selected textures to the left by current grid size.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
@ -654,9 +654,9 @@ movetextureleft8
movetextureright8
{
title = "Move Texture Right by 8";
title = "Move Texture Right by cur. grid size";
category = "visual";
description = "Moves the offset of the targeted or selected textures to the right by 8 pixels.";
description = "Moves the offset of the targeted or selected textures to the right by current grid size.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
@ -666,9 +666,9 @@ movetextureright8
movetextureup8
{
title = "Move Texture Up by 8";
title = "Move Texture Up by cur. grid size";
category = "visual";
description = "Moves the offset of the targeted or selected textures up by 8 pixels.";
description = "Moves the offset of the targeted or selected textures up by current grid size.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
@ -678,9 +678,9 @@ movetextureup8
movetexturedown8
{
title = "Move Texture Down by 8";
title = "Move Texture Down by cur. grid size";
category = "visual";
description = "Moves the offset of the targeted or selected textures down by 8 pixels.";
description = "Moves the offset of the targeted or selected textures down by current grid size.";
allowkeys = true;
allowmouse = true;
allowscroll = true;

View file

@ -148,7 +148,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd. Modify offsets based on surface and camera angles
if (General.Map.UDMF) {
float angle = 0;
if(GeometryType == VisualGeometryType.CEILING)
@ -160,14 +159,36 @@ namespace CodeImp.DoomBuilder.BuilderModes
offsetx = (int)Math.Round(v.x);
offsety = (int)Math.Round(v.y);
}
// Apply offsets
if(General.Interface.CtrlState && General.Interface.ShiftState) { //mxd. Clamp to grid size?
int newoffsetx = startoffsetx - (int)Math.Round(offsetx);
int newoffsety = startoffsety + (int)Math.Round(offsety);
int dx = prevoffsetx - newoffsetx;
int dy = prevoffsety - newoffsety;
if(Math.Abs(dx) >= General.Map.Grid.GridSize) {
dx = General.Map.Grid.GridSize * Math.Sign(dx);
prevoffsetx = newoffsetx;
} else {
dx = 0;
}
if(Math.Abs(dy) >= General.Map.Grid.GridSize) {
dy = General.Map.Grid.GridSize * Math.Sign(dy);
prevoffsety = newoffsety;
} else {
dy = 0;
}
if(dx != 0 || dy != 0) mode.ApplyFlatOffsetChange(dx, dy);
} else {
int newoffsetx = startoffsetx - (int)Math.Round(offsetx);
int newoffsety = startoffsety + (int)Math.Round(offsety);
mode.ApplyFlatOffsetChange(prevoffsetx - newoffsetx, prevoffsety - newoffsety);
prevoffsetx = newoffsetx;
prevoffsety = newoffsety;
}
mode.ShowTargetInfo();
}
@ -423,6 +444,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Moving the mouse
public virtual void OnMouseMove(MouseEventArgs e)
{
if(!General.Map.UDMF) return; //mxd. Cannot change texture offsets in other map formats...
// Dragging UV?
if(uvdragging)
{
@ -438,7 +461,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
float deltaz = General.Map.VisualCamera.AngleZ - dragstartanglez;
if((Math.Abs(deltaxy) + Math.Abs(deltaz)) > DRAG_ANGLE_TOLERANCE)
{
if(General.Map.UDMF) { //mxd
mode.PreAction(UndoGroup.TextureOffsetChange);
mode.CreateUndo("Change texture offsets");
@ -451,7 +473,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
}
}
// Delete texture
public virtual void OnDelete() {

View file

@ -1096,11 +1096,34 @@ namespace CodeImp.DoomBuilder.BuilderModes
if((Math.Sign(dragdeltaz.x) < 0) || (Math.Sign(dragdeltaz.y) < 0) || (Math.Sign(dragdeltaz.z) < 0)) offsety = -offsety;
// Apply offsets
int newoffsetx = (General.Interface.CtrlState && !General.Interface.ShiftState ? startoffsetx : startoffsetx - (int)Math.Round(offsetx)); //mxd
int newoffsety = (!General.Interface.CtrlState && General.Interface.ShiftState ? startoffsety : startoffsety + (int)Math.Round(offsety)); //mxd
if(General.Interface.CtrlState && General.Interface.ShiftState) { //mxd. Clamp to grid size?
int newoffsetx = startoffsetx - (int)Math.Round(offsetx);
int newoffsety = startoffsety + (int)Math.Round(offsety);
int dx = prevoffsetx - newoffsetx;
int dy = prevoffsety - newoffsety;
if(Math.Abs(dx) >= General.Map.Grid.GridSize) {
dx = General.Map.Grid.GridSize * Math.Sign(dx);
prevoffsetx = newoffsetx;
} else {
dx = 0;
}
if(Math.Abs(dy) >= General.Map.Grid.GridSize) {
dy = General.Map.Grid.GridSize * Math.Sign(dy);
prevoffsety = newoffsety;
} else {
dy = 0;
}
if(dx != 0 || dy != 0) mode.ApplyTextureOffsetChange(dx, dy);
} else { //mxd. Constraint to axis?
int newoffsetx = (General.Interface.CtrlState ? startoffsetx : startoffsetx - (int)Math.Round(offsetx)); //mxd
int newoffsety = (General.Interface.ShiftState ? startoffsety : startoffsety + (int)Math.Round(offsety)); //mxd
mode.ApplyTextureOffsetChange(prevoffsetx - newoffsetx, prevoffsety - newoffsety);
prevoffsetx = newoffsetx;
prevoffsety = newoffsety;
}
mode.ShowTargetInfo();
}

View file

@ -2175,7 +2175,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
PreAction(UndoGroup.TextureOffsetChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(-8, 0, true);
foreach(IVisualEventReceiver i in objs) i.OnChangeTextureOffset(-General.Map.Grid.GridSize, 0, true);
PostAction();
}
@ -2184,7 +2184,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
PreAction(UndoGroup.TextureOffsetChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(8, 0, true);
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(General.Map.Grid.GridSize, 0, true);
PostAction();
}
@ -2193,7 +2193,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
PreAction(UndoGroup.TextureOffsetChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, -8, true);
foreach(IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, -General.Map.Grid.GridSize, true);
PostAction();
}
@ -2202,7 +2202,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
PreAction(UndoGroup.TextureOffsetChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, 8, true);
foreach(IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, General.Map.Grid.GridSize, true);
PostAction();
}