mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-06-01 17:32:15 +00:00
Import Wavefront .obj as Terrain mode now works in all map formats.
Import Wavefront .obj as Terrain mode: floor height of each created sector is now set to the average height of an .obj polygon it was created from. Import Wavefront .obj as Terrain Settings window: added "Use slopes" checkbox. When enabled, the mode will create slopes using vertex height offsets (UDMF) or Floor Vertex Height things (1504). Fixed, Visual Mode: things were rendered at wrong height after using "Lower/Raise Height" actions in sectors with sloped floor (or ceiling for ceiling-aligned things) Fixed: info panel was not updated after switching to another Edit Mode.
This commit is contained in:
parent
979244a163
commit
33a35e2148
11 changed files with 145 additions and 41 deletions
|
@ -150,6 +150,9 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
|
|
||||||
//mxd. Show hints for this mode
|
//mxd. Show hints for this mode
|
||||||
General.Hints.ShowHints(this.GetType(), HintsManager.GENERAL);
|
General.Hints.ShowHints(this.GetType(), HintsManager.GENERAL);
|
||||||
|
|
||||||
|
//mxd. Display new mode name
|
||||||
|
General.Interface.HideInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mode disengages
|
// Mode disengages
|
||||||
|
|
|
@ -541,8 +541,6 @@ namespace CodeImp.DoomBuilder
|
||||||
[STAThread]
|
[STAThread]
|
||||||
internal static void Main(string[] args)
|
internal static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Uri localpath;
|
|
||||||
|
|
||||||
// Determine states
|
// Determine states
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
debugbuild = true;
|
debugbuild = true;
|
||||||
|
@ -571,7 +569,7 @@ namespace CodeImp.DoomBuilder
|
||||||
thisasm = Assembly.GetExecutingAssembly();
|
thisasm = Assembly.GetExecutingAssembly();
|
||||||
|
|
||||||
// Find application path
|
// Find application path
|
||||||
localpath = new Uri(Path.GetDirectoryName(thisasm.GetName().CodeBase));
|
Uri localpath = new Uri(Path.GetDirectoryName(thisasm.GetName().CodeBase));
|
||||||
apppath = Uri.UnescapeDataString(localpath.AbsolutePath);
|
apppath = Uri.UnescapeDataString(localpath.AbsolutePath);
|
||||||
|
|
||||||
// Setup directories
|
// Setup directories
|
||||||
|
|
|
@ -2999,7 +2999,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
|
|
||||||
//create path
|
//create path
|
||||||
string date = DateTime.Now.ToString("yyyy.MM.dd HH-mm-ss.fff");
|
string date = DateTime.Now.ToString("yyyy.MM.dd HH-mm-ss.fff");
|
||||||
string revision = "R" + General.ThisAssembly.GetName().Version.MinorRevision;
|
string revision = (General.DebugBuild ? "DEVBUILD" : "R" + General.ThisAssembly.GetName().Version.MinorRevision);
|
||||||
string path = Path.Combine(folder, name + date + " [" + revision + "].jpg");
|
string path = Path.Combine(folder, name + date + " [" + revision + "].jpg");
|
||||||
|
|
||||||
//save image
|
//save image
|
||||||
|
|
|
@ -141,6 +141,9 @@
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\Folder.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
this.cancel = new System.Windows.Forms.Button();
|
this.cancel = new System.Windows.Forms.Button();
|
||||||
this.import = new System.Windows.Forms.Button();
|
this.import = new System.Windows.Forms.Button();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.browse = new System.Windows.Forms.Button();
|
|
||||||
this.tbImportPath = new System.Windows.Forms.TextBox();
|
this.tbImportPath = new System.Windows.Forms.TextBox();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.axisx = new System.Windows.Forms.RadioButton();
|
this.axisx = new System.Windows.Forms.RadioButton();
|
||||||
|
@ -38,6 +37,8 @@
|
||||||
this.axisz = new System.Windows.Forms.RadioButton();
|
this.axisz = new System.Windows.Forms.RadioButton();
|
||||||
this.panel1 = new System.Windows.Forms.Panel();
|
this.panel1 = new System.Windows.Forms.Panel();
|
||||||
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||||
|
this.cbusevertexheight = new System.Windows.Forms.CheckBox();
|
||||||
|
this.browse = new System.Windows.Forms.Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudScale)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudScale)).BeginInit();
|
||||||
this.panel1.SuspendLayout();
|
this.panel1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
@ -78,7 +79,7 @@
|
||||||
//
|
//
|
||||||
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
this.cancel.Location = new System.Drawing.Point(279, 82);
|
this.cancel.Location = new System.Drawing.Point(226, 82);
|
||||||
this.cancel.Name = "cancel";
|
this.cancel.Name = "cancel";
|
||||||
this.cancel.Size = new System.Drawing.Size(75, 23);
|
this.cancel.Size = new System.Drawing.Size(75, 23);
|
||||||
this.cancel.TabIndex = 14;
|
this.cancel.TabIndex = 14;
|
||||||
|
@ -89,7 +90,7 @@
|
||||||
// import
|
// import
|
||||||
//
|
//
|
||||||
this.import.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.import.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.import.Location = new System.Drawing.Point(360, 82);
|
this.import.Location = new System.Drawing.Point(307, 82);
|
||||||
this.import.Name = "import";
|
this.import.Name = "import";
|
||||||
this.import.Size = new System.Drawing.Size(75, 23);
|
this.import.Size = new System.Drawing.Size(75, 23);
|
||||||
this.import.TabIndex = 13;
|
this.import.TabIndex = 13;
|
||||||
|
@ -106,16 +107,6 @@
|
||||||
this.label1.TabIndex = 12;
|
this.label1.TabIndex = 12;
|
||||||
this.label1.Text = "Path:";
|
this.label1.Text = "Path:";
|
||||||
//
|
//
|
||||||
// browse
|
|
||||||
//
|
|
||||||
this.browse.Location = new System.Drawing.Point(360, 10);
|
|
||||||
this.browse.Name = "browse";
|
|
||||||
this.browse.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.browse.TabIndex = 11;
|
|
||||||
this.browse.Text = "Browse...";
|
|
||||||
this.browse.UseVisualStyleBackColor = true;
|
|
||||||
this.browse.Click += new System.EventHandler(this.browse_Click);
|
|
||||||
//
|
|
||||||
// tbImportPath
|
// tbImportPath
|
||||||
//
|
//
|
||||||
this.tbImportPath.Location = new System.Drawing.Point(55, 12);
|
this.tbImportPath.Location = new System.Drawing.Point(55, 12);
|
||||||
|
@ -182,13 +173,34 @@
|
||||||
this.openFileDialog.Filter = "Wavefront obj files|*.obj";
|
this.openFileDialog.Filter = "Wavefront obj files|*.obj";
|
||||||
this.openFileDialog.Title = "Choose .obj file to import:";
|
this.openFileDialog.Title = "Choose .obj file to import:";
|
||||||
//
|
//
|
||||||
|
// cbusevertexheight
|
||||||
|
//
|
||||||
|
this.cbusevertexheight.AutoSize = true;
|
||||||
|
this.cbusevertexheight.Location = new System.Drawing.Point(55, 64);
|
||||||
|
this.cbusevertexheight.Name = "cbusevertexheight";
|
||||||
|
this.cbusevertexheight.Size = new System.Drawing.Size(95, 17);
|
||||||
|
this.cbusevertexheight.TabIndex = 22;
|
||||||
|
this.cbusevertexheight.Text = "Sloped Terrian";
|
||||||
|
this.cbusevertexheight.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// browse
|
||||||
|
//
|
||||||
|
this.browse.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Folder;
|
||||||
|
this.browse.Location = new System.Drawing.Point(360, 10);
|
||||||
|
this.browse.Name = "browse";
|
||||||
|
this.browse.Size = new System.Drawing.Size(28, 23);
|
||||||
|
this.browse.TabIndex = 11;
|
||||||
|
this.browse.UseVisualStyleBackColor = true;
|
||||||
|
this.browse.Click += new System.EventHandler(this.browse_Click);
|
||||||
|
//
|
||||||
// ObjImportSettingsForm
|
// ObjImportSettingsForm
|
||||||
//
|
//
|
||||||
this.AcceptButton = this.import;
|
this.AcceptButton = this.import;
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||||
this.CancelButton = this.cancel;
|
this.CancelButton = this.cancel;
|
||||||
this.ClientSize = new System.Drawing.Size(447, 109);
|
this.ClientSize = new System.Drawing.Size(394, 109);
|
||||||
|
this.Controls.Add(this.cbusevertexheight);
|
||||||
this.Controls.Add(this.panel1);
|
this.Controls.Add(this.panel1);
|
||||||
this.Controls.Add(this.label3);
|
this.Controls.Add(this.label3);
|
||||||
this.Controls.Add(this.label2);
|
this.Controls.Add(this.label2);
|
||||||
|
@ -202,6 +214,7 @@
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "ObjImportSettingsForm";
|
this.Name = "ObjImportSettingsForm";
|
||||||
|
this.Opacity = 1;
|
||||||
this.ShowIcon = false;
|
this.ShowIcon = false;
|
||||||
this.ShowInTaskbar = false;
|
this.ShowInTaskbar = false;
|
||||||
this.Text = "Import Wavefront .obj";
|
this.Text = "Import Wavefront .obj";
|
||||||
|
@ -228,5 +241,6 @@
|
||||||
private System.Windows.Forms.RadioButton axisz;
|
private System.Windows.Forms.RadioButton axisz;
|
||||||
private System.Windows.Forms.Panel panel1;
|
private System.Windows.Forms.Panel panel1;
|
||||||
private System.Windows.Forms.OpenFileDialog openFileDialog;
|
private System.Windows.Forms.OpenFileDialog openFileDialog;
|
||||||
|
private System.Windows.Forms.CheckBox cbusevertexheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,6 +14,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
#region ================== Variables
|
#region ================== Variables
|
||||||
|
|
||||||
private ImportObjAsTerrainMode.UpAxis axis;
|
private ImportObjAsTerrainMode.UpAxis axis;
|
||||||
|
private bool slopessupported;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
internal string FilePath { get { return tbImportPath.Text.Trim(); } }
|
internal string FilePath { get { return tbImportPath.Text.Trim(); } }
|
||||||
internal ImportObjAsTerrainMode.UpAxis UpAxis { get { return axis; } }
|
internal ImportObjAsTerrainMode.UpAxis UpAxis { get { return axis; } }
|
||||||
internal float ObjScale { get { return (float)nudScale.Value; } }
|
internal float ObjScale { get { return (float)nudScale.Value; } }
|
||||||
|
internal bool UseVertexHeights { get { return slopessupported && cbusevertexheight.Checked; } }
|
||||||
|
|
||||||
//todo: floor/ceiling textures? height offsets? ceiling extra height?
|
//todo: floor/ceiling textures? height offsets? ceiling extra height?
|
||||||
|
|
||||||
|
@ -34,6 +36,11 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
//restore settings
|
//restore settings
|
||||||
axis = (ImportObjAsTerrainMode.UpAxis)General.Settings.ReadPluginSetting("objexportupaxis", 0);
|
axis = (ImportObjAsTerrainMode.UpAxis)General.Settings.ReadPluginSetting("objexportupaxis", 0);
|
||||||
nudScale.Value = (decimal)General.Settings.ReadPluginSetting("objexportscale", 1.0f);
|
nudScale.Value = (decimal)General.Settings.ReadPluginSetting("objexportscale", 1.0f);
|
||||||
|
slopessupported = (General.Map.UDMF || General.Map.Data.GetThingInfoEx(ImportObjAsTerrainMode.VERTEX_HEIGHT_THING_TYPE) != null);
|
||||||
|
if(slopessupported)
|
||||||
|
cbusevertexheight.Checked = General.Settings.ReadPluginSetting("objusevertexheights", true);
|
||||||
|
else
|
||||||
|
cbusevertexheight.Enabled = false;
|
||||||
|
|
||||||
switch(axis)
|
switch(axis)
|
||||||
{
|
{
|
||||||
|
@ -69,6 +76,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
//save settings
|
//save settings
|
||||||
General.Settings.WritePluginSetting("objexportupaxis", (int)axis);
|
General.Settings.WritePluginSetting("objexportupaxis", (int)axis);
|
||||||
General.Settings.WritePluginSetting("objexportscale", (float)nudScale.Value);
|
General.Settings.WritePluginSetting("objexportscale", (float)nudScale.Value);
|
||||||
|
if(slopessupported) General.Settings.WritePluginSetting("objusevertexheights", cbusevertexheight.Checked);
|
||||||
|
|
||||||
this.DialogResult = DialogResult.OK;
|
this.DialogResult = DialogResult.OK;
|
||||||
this.Close();
|
this.Close();
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
|
|
||||||
private readonly static char[] space = { ' ' };
|
private readonly static char[] space = { ' ' };
|
||||||
private const string slash = "/";
|
private const string slash = "/";
|
||||||
|
internal const int VERTEX_HEIGHT_THING_TYPE = 1504;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -72,12 +73,6 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
|
|
||||||
public override void OnEngage()
|
public override void OnEngage()
|
||||||
{
|
{
|
||||||
if(!General.Map.UDMF)
|
|
||||||
{
|
|
||||||
General.Interface.DisplayStatus(StatusType.Warning, "Terrain importer works only in UDMF map format!");
|
|
||||||
OnCancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
base.OnEngage();
|
base.OnEngage();
|
||||||
General.Map.Map.ClearAllSelected();
|
General.Map.Map.ClearAllSelected();
|
||||||
|
|
||||||
|
@ -104,7 +99,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
int maxZ = int.MinValue;
|
int maxZ = int.MinValue;
|
||||||
|
|
||||||
// Read .obj, create and select sectors
|
// Read .obj, create and select sectors
|
||||||
if(!ReadGeometry(form.FilePath, form.ObjScale, form.UpAxis, verts, faces, ref minZ, ref maxZ) || !CreateGeometry(verts, faces, minZ, maxZ + (maxZ - minZ)/2))
|
if(!ReadGeometry(form.FilePath, form.ObjScale, form.UpAxis, verts, faces, ref minZ, ref maxZ) || !CreateGeometry(verts, faces, maxZ + (maxZ - minZ)/2))
|
||||||
{
|
{
|
||||||
// Fial!
|
// Fial!
|
||||||
Cursor.Current = Cursors.Default;
|
Cursor.Current = Cursors.Default;
|
||||||
|
@ -114,9 +109,14 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update caches
|
// Update caches
|
||||||
|
General.Map.Map.SnapAllToAccuracy();
|
||||||
|
General.Map.Map.UpdateConfiguration();
|
||||||
General.Map.Map.Update();
|
General.Map.Map.Update();
|
||||||
General.Map.IsChanged = true;
|
General.Map.IsChanged = true;
|
||||||
|
|
||||||
|
// Update things filter so that it includes added things
|
||||||
|
if(form.UseVertexHeights && !General.Map.UDMF) General.Map.ThingsFilter.Update();
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
Cursor.Current = Cursors.Default;
|
Cursor.Current = Cursors.Default;
|
||||||
|
|
||||||
|
@ -137,29 +137,80 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
|
|
||||||
#region ================== Geometry creation
|
#region ================== Geometry creation
|
||||||
|
|
||||||
private static bool CreateGeometry(List<Vector3D> verts, List<Face> faces, int minZ, int maxZ)
|
private bool CreateGeometry(List<Vector3D> verts, List<Face> faces, int maxZ)
|
||||||
{
|
{
|
||||||
|
MapSet map = General.Map.Map;
|
||||||
|
|
||||||
|
// Capacity checks
|
||||||
|
int totalverts = map.Vertices.Count + verts.Count;
|
||||||
|
int totalsides = map.Sidedefs.Count + faces.Count * 6;
|
||||||
|
int totallines = map.Linedefs.Count + faces.Count * 3;
|
||||||
|
int totalsectors = map.Sectors.Count + faces.Count;
|
||||||
|
int totalthings = 0;
|
||||||
|
if(form.UseVertexHeights && !General.Map.UDMF)
|
||||||
|
{
|
||||||
|
// We'll use vertex height things in non-udmf maps, if such things are defined in Game Configuration
|
||||||
|
totalthings = map.Things.Count + verts.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(totalverts > General.Map.FormatInterface.MaxVertices)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Cannot import the model: resulting vertex count (" + totalverts
|
||||||
|
+ ") is larger than map format's maximum (" + General.Map.FormatInterface.MaxVertices + ")!",
|
||||||
|
"Terrain Importer", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(totalsides > General.Map.FormatInterface.MaxSidedefs)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Cannot import the model: resulting sidedefs count (" + totalsides
|
||||||
|
+ ") is larger than map format's maximum (" + General.Map.FormatInterface.MaxSidedefs + ")!",
|
||||||
|
"Terrain Importer", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(totallines > General.Map.FormatInterface.MaxLinedefs)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Cannot import the model: resulting sidedefs count (" + totallines
|
||||||
|
+ ") is larger than map format's maximum (" + General.Map.FormatInterface.MaxLinedefs + ")!",
|
||||||
|
"Terrain Importer", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(totalsectors > General.Map.FormatInterface.MaxSectors)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Cannot import the model: resulting sidedefs count (" + totalsectors
|
||||||
|
+ ") is larger than map format's maximum (" + General.Map.FormatInterface.MaxSectors + ")!",
|
||||||
|
"Terrain Importer", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(totalthings > General.Map.FormatInterface.MaxThings)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Cannot import the model: resulting things count (" + totalthings
|
||||||
|
+ ") is larger than map format's maximum (" + General.Map.FormatInterface.MaxThings + ")!",
|
||||||
|
"Terrain Importer", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//make undo
|
//make undo
|
||||||
General.Map.UndoRedo.CreateUndo("Import Terrain");
|
General.Map.UndoRedo.CreateUndo("Import Terrain");
|
||||||
|
|
||||||
//prepare mapset
|
//prepare mapset
|
||||||
List<Linedef> newlines = new List<Linedef>();
|
List<Linedef> newlines = new List<Linedef>();
|
||||||
MapSet map = General.Map.Map;
|
|
||||||
map.BeginAddRemove();
|
map.BeginAddRemove();
|
||||||
map.SetCapacity(map.Vertices.Count + verts.Count, map.Linedefs.Count + faces.Count * 3, map.Sidedefs.Count + faces.Count * 3, map.Sectors.Count + faces.Count, 0);
|
map.SetCapacity(totalverts, totallines, totalsides, totalsectors, totalthings);
|
||||||
|
|
||||||
//terrain has many faces... let's create them
|
//terrain has many faces... let's create them
|
||||||
Dictionary<Vector3D, Vertex> newverts = new Dictionary<Vector3D, Vertex>();
|
Dictionary<Vector3D, Vertex> newverts = new Dictionary<Vector3D, Vertex>();
|
||||||
foreach(Face face in faces)
|
foreach(Face face in faces)
|
||||||
{
|
{
|
||||||
|
// Create sector
|
||||||
Sector s = map.CreateSector();
|
Sector s = map.CreateSector();
|
||||||
s.Selected = true;
|
s.Selected = true;
|
||||||
s.FloorHeight = minZ;
|
s.FloorHeight = (int)Math.Round((face.V1.z + face.V2.z + face.V3.z) / 3);
|
||||||
s.CeilHeight = maxZ;
|
s.CeilHeight = maxZ;
|
||||||
s.Brightness = General.Settings.DefaultBrightness; //todo: allow user to change this
|
s.Brightness = General.Settings.DefaultBrightness; //todo: allow user to change this
|
||||||
s.SetCeilTexture(General.Map.Config.SkyFlatName);
|
s.SetCeilTexture(General.Map.Config.SkyFlatName);
|
||||||
s.SetFloorTexture(General.Map.Options.DefaultFloorTexture); //todo: allow user to change this
|
s.SetFloorTexture(General.Map.Options.DefaultFloorTexture); //todo: allow user to change this
|
||||||
|
|
||||||
|
// And linedefs
|
||||||
Linedef newline = GetLine(newverts, s, face.V1, face.V2);
|
Linedef newline = GetLine(newverts, s, face.V1, face.V2);
|
||||||
if(newline != null) newlines.Add(newline);
|
if(newline != null) newlines.Add(newline);
|
||||||
|
|
||||||
|
@ -172,6 +223,19 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
s.UpdateCache();
|
s.UpdateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add slope things
|
||||||
|
if(form.UseVertexHeights && !General.Map.UDMF)
|
||||||
|
{
|
||||||
|
foreach (Vector3D pos in newverts.Keys)
|
||||||
|
{
|
||||||
|
Thing t = map.CreateThing();
|
||||||
|
General.Settings.ApplyDefaultThingSettings(t);
|
||||||
|
t.Type = VERTEX_HEIGHT_THING_TYPE;
|
||||||
|
t.Move(pos);
|
||||||
|
t.Selected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//update new lines
|
//update new lines
|
||||||
foreach(Linedef l in newlines) l.ApplySidedFlags();
|
foreach(Linedef l in newlines) l.ApplySidedFlags();
|
||||||
|
|
||||||
|
@ -179,7 +243,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Linedef GetLine(Dictionary<Vector3D, Vertex> verts, Sector sector, Vector3D v1, Vector3D v2)
|
private Linedef GetLine(Dictionary<Vector3D, Vertex> verts, Sector sector, Vector3D v1, Vector3D v2)
|
||||||
{
|
{
|
||||||
Linedef line = null;
|
Linedef line = null;
|
||||||
|
|
||||||
|
@ -198,31 +262,33 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
||||||
}
|
}
|
||||||
|
|
||||||
//create a new line?
|
//create a new line?
|
||||||
|
Sidedef side;
|
||||||
if(line == null)
|
if(line == null)
|
||||||
{
|
{
|
||||||
line = General.Map.Map.CreateLinedef(start, end);
|
line = General.Map.Map.CreateLinedef(start, end);
|
||||||
|
|
||||||
//create front sidedef and attach sector to it
|
//create front sidedef and attach sector to it
|
||||||
General.Map.Map.CreateSidedef(line, true, sector);
|
side = General.Map.Map.CreateSidedef(line, true, sector);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//create back sidedef and attach sector to it
|
//create back sidedef and attach sector to it
|
||||||
General.Map.Map.CreateSidedef(line, false, sector);
|
side = General.Map.Map.CreateSidedef(line, false, sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!form.UseVertexHeights) side.SetTextureLow(General.Map.Options.DefaultWallTexture);
|
||||||
line.Selected = true;
|
line.Selected = true;
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vertex GetVertex(Dictionary<Vector3D, Vertex> verts, Vector3D pos)
|
private Vertex GetVertex(Dictionary<Vector3D, Vertex> verts, Vector3D pos)
|
||||||
{
|
{
|
||||||
//already there?
|
//already there?
|
||||||
if(verts.ContainsKey(pos)) return verts[pos];
|
if(verts.ContainsKey(pos)) return verts[pos];
|
||||||
|
|
||||||
//make a new one
|
//make a new one
|
||||||
Vertex v = General.Map.Map.CreateVertex(pos);
|
Vertex v = General.Map.Map.CreateVertex(pos);
|
||||||
v.ZFloor = pos.z;
|
if(form.UseVertexHeights) v.ZFloor = pos.z;
|
||||||
verts.Add(pos, v);
|
verts.Add(pos, v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:2.0.50727.4927
|
// Runtime Version:2.0.50727.5466
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
@ -60,6 +60,13 @@ namespace CodeImp.DoomBuilder.BuilderEffects.Properties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static System.Drawing.Bitmap Folder {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Folder", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static System.Drawing.Bitmap Jitter {
|
internal static System.Drawing.Bitmap Jitter {
|
||||||
get {
|
get {
|
||||||
object obj = ResourceManager.GetObject("Jitter", resourceCulture);
|
object obj = ResourceManager.GetObject("Jitter", resourceCulture);
|
||||||
|
|
|
@ -118,13 +118,16 @@
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="Terrain" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Terrain.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="Jitter" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Jitter" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Jitter.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Jitter.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Update" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Update" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Update.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Update.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Terrain" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Terrain.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Folder.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
BIN
Source/Plugins/BuilderEffects/Resources/Folder.png
Normal file
BIN
Source/Plugins/BuilderEffects/Resources/Folder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 394 B |
|
@ -230,10 +230,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(Thing.Sector != null)
|
if(Thing.Sector != null)
|
||||||
{
|
{
|
||||||
SectorData sd = mode.GetSectorData(Thing.Sector);
|
SectorData sd = mode.GetSectorData(Thing.Sector);
|
||||||
if(Thing.Position.z > 0)
|
pos.z = sd.Ceiling.plane.GetZ(Thing.Position) - info.Height;
|
||||||
|
/*if(Thing.Position.z > 0)
|
||||||
pos.z = sd.Ceiling.plane.GetZ(Thing.Position) - info.Height;
|
pos.z = sd.Ceiling.plane.GetZ(Thing.Position) - info.Height;
|
||||||
else
|
else
|
||||||
pos.z = Thing.Sector.CeilHeight - info.Height; //mxd. was [pos.z = Thing.Sector.CeilHeight;]
|
pos.z = Thing.Sector.CeilHeight - info.Height;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
pos.z -= Thing.Position.z;
|
pos.z -= Thing.Position.z;
|
||||||
|
@ -252,10 +253,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(Thing.Sector != null)
|
if(Thing.Sector != null)
|
||||||
{
|
{
|
||||||
SectorData sd = mode.GetSectorData(Thing.Sector);
|
SectorData sd = mode.GetSectorData(Thing.Sector);
|
||||||
if(Thing.Position.z == 0)
|
pos.z = sd.Floor.plane.GetZ(Thing.Position);
|
||||||
|
/*if(Thing.Position.z == 0)
|
||||||
pos.z = sd.Floor.plane.GetZ(Thing.Position);
|
pos.z = sd.Floor.plane.GetZ(Thing.Position);
|
||||||
else
|
else
|
||||||
pos.z = Thing.Sector.FloorHeight;
|
pos.z = Thing.Sector.FloorHeight;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
pos.z += Thing.Position.z;
|
pos.z += Thing.Position.z;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue