2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2012-11-27 21:12:20 +00:00
|
|
|
using System.Drawing;
|
2009-04-19 18:07:22 +00:00
|
|
|
using System.Windows.Forms;
|
|
|
|
using CodeImp.DoomBuilder.Data;
|
|
|
|
using CodeImp.DoomBuilder.IO;
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
|
|
using CodeImp.DoomBuilder.VisualModes;
|
2013-05-29 14:18:49 +00:00
|
|
|
using CodeImp.DoomBuilder.Types;
|
|
|
|
using CodeImp.DoomBuilder.GZBuilder.Tools;
|
2013-07-09 11:29:10 +00:00
|
|
|
using CodeImp.DoomBuilder.Windows;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
{
|
|
|
|
internal abstract class BaseVisualGeometrySector : VisualGeometry, IVisualEventReceiver
|
|
|
|
{
|
|
|
|
#region ================== Constants
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
private const float DRAG_ANGLE_TOLERANCE = 0.06f;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
|
|
protected BaseVisualMode mode;
|
|
|
|
protected long setuponloadedtexture;
|
2009-05-01 20:31:17 +00:00
|
|
|
|
|
|
|
// This is only used to see if this object has already received a change
|
|
|
|
// in a multiselection. The Changed property on the BaseVisualSector is
|
|
|
|
// used to indicate a rebuild is needed.
|
|
|
|
protected bool changed;
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
protected SectorLevel level;
|
|
|
|
protected Effect3DFloor extrafloor;
|
|
|
|
|
|
|
|
// Undo/redo
|
|
|
|
private int undoticket;
|
|
|
|
|
|
|
|
// UV dragging
|
|
|
|
private float dragstartanglexy;
|
|
|
|
private float dragstartanglez;
|
|
|
|
private Vector3D dragorigin;
|
|
|
|
private int startoffsetx;
|
|
|
|
private int startoffsety;
|
|
|
|
protected bool uvdragging;
|
|
|
|
private int prevoffsetx; // We have to provide delta offsets, but I don't
|
|
|
|
private int prevoffsety; // want to calculate with delta offsets to prevent
|
|
|
|
// inaccuracy in the dragging.
|
2013-07-10 08:59:17 +00:00
|
|
|
|
|
|
|
private static List<BaseVisualSector> updateList; //mxd
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
new public BaseVisualSector Sector { get { return (BaseVisualSector)base.Sector; } }
|
2009-05-05 11:26:50 +00:00
|
|
|
public bool Changed { get { return changed; } set { changed = value; } }
|
2012-11-27 21:12:20 +00:00
|
|
|
public SectorLevel Level { get { return level; } }
|
|
|
|
public Effect3DFloor ExtraFloor { get { return extrafloor; } }
|
2009-05-01 20:31:17 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Destructor
|
|
|
|
|
|
|
|
// Constructor
|
2012-11-27 21:12:20 +00:00
|
|
|
protected BaseVisualGeometrySector(BaseVisualMode mode, VisualSector vs) : base(vs)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
this.mode = mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
// This changes the height
|
|
|
|
protected abstract void ChangeHeight(int amount);
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
protected abstract void ChangeTextureScale(float incrementX, float incrementY); //mxd
|
2013-04-01 11:06:01 +00:00
|
|
|
public virtual void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) { } //mxd
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
// This swaps triangles so that the plane faces the other way
|
|
|
|
protected void SwapTriangleVertices(WorldVertex[] verts)
|
|
|
|
{
|
|
|
|
// Swap some vertices to flip all triangles
|
|
|
|
for(int i = 0; i < verts.Length; i += 3)
|
|
|
|
{
|
|
|
|
// Swap
|
|
|
|
WorldVertex v = verts[i];
|
|
|
|
verts[i] = verts[i + 1];
|
|
|
|
verts[i + 1] = v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is called to update UV dragging
|
|
|
|
protected virtual void UpdateDragUV()
|
|
|
|
{
|
|
|
|
float u_ray = 1.0f;
|
|
|
|
|
|
|
|
// Calculate intersection position
|
|
|
|
this.Level.plane.GetIntersection(General.Map.VisualCamera.Position, General.Map.VisualCamera.Target, ref u_ray);
|
|
|
|
Vector3D intersect = General.Map.VisualCamera.Position + (General.Map.VisualCamera.Target - General.Map.VisualCamera.Position) * u_ray;
|
|
|
|
|
|
|
|
// Calculate offsets
|
|
|
|
Vector3D dragdelta = intersect - dragorigin;
|
|
|
|
float offsetx = dragdelta.x;
|
|
|
|
float offsety = dragdelta.y;
|
|
|
|
|
2013-07-01 09:34:17 +00:00
|
|
|
bool lockX = General.Interface.CtrlState && !General.Interface.ShiftState;
|
|
|
|
bool lockY = !General.Interface.CtrlState && General.Interface.ShiftState;
|
|
|
|
|
|
|
|
if(lockX || lockY) {
|
|
|
|
float camAngle = Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY);
|
|
|
|
|
|
|
|
if(camAngle > 315 || camAngle < 46) {
|
|
|
|
if(lockX) offsetx = 0;
|
|
|
|
if(lockY) offsety = 0;
|
|
|
|
} else if(camAngle > 225) {
|
|
|
|
if(lockX) offsety = 0;
|
|
|
|
if(lockY) offsetx = 0;
|
|
|
|
} else if(camAngle > 135) {
|
|
|
|
if(lockX) offsetx = 0;
|
|
|
|
if(lockY) offsety = 0;
|
|
|
|
} else {
|
|
|
|
if(lockX) offsety = 0;
|
|
|
|
if(lockY) offsetx = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
//mxd. Modify offsets based on surface and camera angles
|
|
|
|
if (General.Map.UDMF) {
|
2013-04-26 12:32:51 +00:00
|
|
|
float angle = 0;
|
|
|
|
|
|
|
|
if(GeometryType == VisualGeometryType.CEILING)
|
|
|
|
angle = Angle2D.DegToRad(level.sector.Fields.GetValue("rotationceiling", 0f));
|
|
|
|
else
|
|
|
|
angle = Angle2D.DegToRad(level.sector.Fields.GetValue("rotationfloor", 0f));
|
|
|
|
|
|
|
|
Vector2D v = new Vector2D(offsetx, offsety).GetRotated(angle);
|
|
|
|
|
|
|
|
offsetx = (int)Math.Round(v.x);
|
|
|
|
offsety = (int)Math.Round(v.y);
|
2012-11-27 21:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Apply offsets
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
public override Sector GetControlSector() {
|
|
|
|
return level.sector;
|
|
|
|
}
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
//mxd
|
|
|
|
protected void onTextureChanged() {
|
|
|
|
if(level.sector == this.Sector.Sector) {
|
|
|
|
this.Setup();
|
|
|
|
|
|
|
|
//check for 3d floors
|
|
|
|
foreach(Sidedef s in level.sector.Sidedefs) {
|
|
|
|
if(s.Line.Action == 160 && s.Line.Front != null) {
|
|
|
|
int sectortag = s.Line.Args[0] + (s.Line.Args[4] << 8);
|
|
|
|
foreach(Sector sector in General.Map.Map.Sectors) {
|
|
|
|
if(sector.Tag == sectortag) {
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(sector);
|
|
|
|
vs.UpdateSectorGeometry(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if(mode.VisualSectorExists(level.sector)) {
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
|
|
|
vs.UpdateSectorGeometry(false);
|
|
|
|
}
|
|
|
|
}
|
2013-04-01 11:06:01 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
public virtual bool IsSelected() {
|
|
|
|
return selected;
|
|
|
|
}
|
2013-05-29 14:18:49 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
protected void alignTextureToClosestLine(bool alignx, bool aligny) {
|
2013-05-30 09:34:44 +00:00
|
|
|
if(!(mode.HighlightedObject is BaseVisualSector)) return;
|
|
|
|
|
|
|
|
//do we need to align this? (and also grab texture scale while we are at it)
|
|
|
|
float scaleX = 1.0f;
|
|
|
|
float scaleY = 1.0f;
|
|
|
|
bool isFloor = (geoType == VisualGeometryType.FLOOR);
|
|
|
|
|
|
|
|
if(mode.HighlightedTarget is VisualFloor) {
|
|
|
|
VisualFloor target = mode.HighlightedTarget as VisualFloor;
|
|
|
|
|
|
|
|
//check texture
|
|
|
|
if(target.Sector.Sector.FloorTexture != (isFloor ? Sector.Sector.FloorTexture : Sector.Sector.CeilTexture)) return;
|
|
|
|
|
|
|
|
scaleX = target.Sector.Sector.Fields.GetValue("xscalefloor", 1.0f);
|
|
|
|
scaleY = target.Sector.Sector.Fields.GetValue("yscalefloor", 1.0f);
|
|
|
|
} else {
|
|
|
|
VisualCeiling target = mode.HighlightedTarget as VisualCeiling;
|
|
|
|
|
|
|
|
//check texture
|
|
|
|
if(target.Sector.Sector.CeilTexture != (isFloor ? Sector.Sector.FloorTexture : Sector.Sector.CeilTexture)) return;
|
|
|
|
|
|
|
|
scaleX = target.Sector.Sector.Fields.GetValue("xscaleceiling", 1.0f);
|
|
|
|
scaleY = target.Sector.Sector.Fields.GetValue("yscaleceiling", 1.0f);
|
|
|
|
}
|
|
|
|
|
2013-05-29 14:18:49 +00:00
|
|
|
//find a linedef to align to
|
|
|
|
Vector2D hitpos = mode.GetHitPosition();
|
2013-05-30 09:34:44 +00:00
|
|
|
if(!hitpos.IsFinite()) return;
|
2013-05-29 14:18:49 +00:00
|
|
|
bool isFront = false;
|
|
|
|
|
|
|
|
//align to line of highlighted sector, which is closest to hitpos
|
|
|
|
Sector highlightedSector = ((BaseVisualSector)mode.HighlightedObject).Sector;
|
|
|
|
List<Linedef> lines = new List<Linedef>();
|
|
|
|
foreach(Sidedef side in highlightedSector.Sidedefs) lines.Add(side.Line);
|
|
|
|
|
|
|
|
Linedef targetLine = MapSet.NearestLinedef(lines, hitpos);
|
|
|
|
if(targetLine == null) return;
|
|
|
|
|
2013-07-09 13:13:00 +00:00
|
|
|
isFront = targetLine.SideOfLine(hitpos) > 0;
|
2013-05-29 14:18:49 +00:00
|
|
|
Sector.Sector.Fields.BeforeFieldsChange();
|
|
|
|
|
|
|
|
//find an angle to rotate texture
|
|
|
|
float sourceAngle = (float)Math.Round(General.ClampAngle(isFront ? -Angle2D.RadToDeg(targetLine.Angle) + 90 : -Angle2D.RadToDeg(targetLine.Angle) - 90), 1);
|
|
|
|
if(!isFront) sourceAngle = General.ClampAngle(sourceAngle + 180);
|
|
|
|
|
|
|
|
//update angle
|
2013-08-10 11:28:51 +00:00
|
|
|
UDMFTools.SetFloat(Sector.Sector.Fields, (isFloor ? "rotationfloor" : "rotationceiling"), sourceAngle, 0f);
|
2013-05-29 14:18:49 +00:00
|
|
|
|
|
|
|
//set scale
|
2013-08-10 11:28:51 +00:00
|
|
|
UDMFTools.SetFloat(Sector.Sector.Fields, (isFloor ? "xscalefloor" : "xscaleceiling"), scaleX, 1.0f);
|
|
|
|
UDMFTools.SetFloat(Sector.Sector.Fields, (isFloor ? "yscalefloor" : "yscaleceiling"), scaleY, 1.0f);
|
2013-05-29 14:18:49 +00:00
|
|
|
|
|
|
|
//update offset
|
|
|
|
float distToStart = Vector2D.Distance(hitpos, targetLine.Start.Position);
|
|
|
|
float distToEnd = Vector2D.Distance(hitpos, targetLine.End.Position);
|
|
|
|
Vector2D offset = (distToStart < distToEnd ? targetLine.Start.Position : targetLine.End.Position).GetRotated(Angle2D.DegToRad(sourceAngle));
|
|
|
|
|
|
|
|
if(alignx) {
|
|
|
|
if(Texture != null) offset.x %= Texture.Width / scaleX;
|
2013-08-10 11:28:51 +00:00
|
|
|
UDMFTools.SetFloat(Sector.Sector.Fields, (isFloor ? "xpanningfloor" : "xpanningceiling"), (float)Math.Round(-offset.x), 0f);
|
2013-05-29 14:18:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(aligny) {
|
|
|
|
if(Texture != null) offset.y %= Texture.Height / scaleY;
|
2013-08-10 11:28:51 +00:00
|
|
|
UDMFTools.SetFloat(Sector.Sector.Fields, (isFloor ? "ypanningfloor" : "ypanningceiling"), (float)Math.Round(offset.y), 0f);
|
2013-05-29 14:18:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//update geometry
|
|
|
|
Sector.UpdateSectorGeometry(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
protected void alignTextureToSlopeLine(Linedef slopeSource, float slopeAngle, bool isFront, bool alignx, bool aligny) {
|
|
|
|
Vector2D hitpos = mode.GetHitPosition();
|
|
|
|
bool isFloor = (geoType == VisualGeometryType.FLOOR);
|
|
|
|
|
|
|
|
Sector.Sector.Fields.BeforeFieldsChange();
|
|
|
|
|
|
|
|
float sourceAngle = (float)Math.Round(General.ClampAngle(isFront ? -Angle2D.RadToDeg(slopeSource.Angle) + 90 : -Angle2D.RadToDeg(slopeSource.Angle) - 90), 1);
|
|
|
|
|
|
|
|
if(isFloor) {
|
|
|
|
if((isFront && slopeSource.Front.Sector.FloorHeight > slopeSource.Back.Sector.FloorHeight) ||
|
|
|
|
(!isFront && slopeSource.Front.Sector.FloorHeight < slopeSource.Back.Sector.FloorHeight)) {
|
|
|
|
sourceAngle = General.ClampAngle(sourceAngle + 180);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if((isFront && slopeSource.Front.Sector.CeilHeight < slopeSource.Back.Sector.CeilHeight) ||
|
|
|
|
(!isFront && slopeSource.Front.Sector.CeilHeight > slopeSource.Back.Sector.CeilHeight)) {
|
|
|
|
sourceAngle = General.ClampAngle(sourceAngle + 180);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//update angle
|
2013-08-10 11:28:51 +00:00
|
|
|
UDMFTools.SetFloat(Sector.Sector.Fields, (isFloor ? "rotationfloor" : "rotationceiling"), sourceAngle, 0f);
|
2013-05-29 14:18:49 +00:00
|
|
|
|
|
|
|
//update scaleY
|
|
|
|
string xScaleKey = (isFloor ? "xscalefloor" : "xscaleceiling");
|
|
|
|
string yScaleKey = (isFloor ? "yscalefloor" : "yscaleceiling");
|
|
|
|
|
|
|
|
float scaleX = Sector.Sector.Fields.GetValue(xScaleKey, 1.0f);
|
2013-05-30 12:52:27 +00:00
|
|
|
float scaleY;
|
2013-05-29 14:18:49 +00:00
|
|
|
|
|
|
|
//set scale
|
|
|
|
if(aligny) {
|
|
|
|
scaleY = (float)Math.Round(scaleX * (1 / (float)Math.Cos(slopeAngle)), 2);
|
2013-08-10 11:28:51 +00:00
|
|
|
UDMFTools.SetFloat(Sector.Sector.Fields, yScaleKey, scaleY, 1.0f);
|
2013-05-29 14:18:49 +00:00
|
|
|
} else {
|
|
|
|
scaleY = Sector.Sector.Fields.GetValue(yScaleKey, 1.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
//update texture offsets
|
|
|
|
Vector2D offset;
|
|
|
|
|
|
|
|
if(isFloor) {
|
|
|
|
if((isFront && slopeSource.Front.Sector.FloorHeight < slopeSource.Back.Sector.FloorHeight) ||
|
|
|
|
(!isFront && slopeSource.Front.Sector.FloorHeight > slopeSource.Back.Sector.FloorHeight)) {
|
|
|
|
offset = slopeSource.End.Position;
|
|
|
|
} else {
|
|
|
|
offset = slopeSource.Start.Position;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if((isFront && slopeSource.Front.Sector.CeilHeight > slopeSource.Back.Sector.CeilHeight) ||
|
|
|
|
(!isFront && slopeSource.Front.Sector.CeilHeight < slopeSource.Back.Sector.CeilHeight)) {
|
|
|
|
offset = slopeSource.End.Position;
|
|
|
|
} else {
|
|
|
|
offset = slopeSource.Start.Position;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
offset = offset.GetRotated(Angle2D.DegToRad(sourceAngle));
|
|
|
|
|
|
|
|
if(alignx) {
|
|
|
|
if(Texture != null) offset.x %= Texture.Width / scaleX;
|
2013-08-10 11:28:51 +00:00
|
|
|
UDMFTools.SetFloat(Sector.Sector.Fields, (isFloor ? "xpanningfloor" : "xpanningceiling"), (float)Math.Round(-offset.x), 0f);
|
2013-05-29 14:18:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(aligny) {
|
|
|
|
if(Texture != null) offset.y %= Texture.Height / scaleY;
|
2013-08-10 11:28:51 +00:00
|
|
|
UDMFTools.SetFloat(Sector.Sector.Fields, (isFloor ? "ypanningfloor" : "ypanningceiling"), (float)Math.Round(offset.y), 0f);
|
2013-05-29 14:18:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//update geometry
|
|
|
|
Sector.UpdateSectorGeometry(false);
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Events
|
|
|
|
|
|
|
|
// Unused
|
|
|
|
public virtual void OnEditBegin() { }
|
2013-05-02 07:47:22 +00:00
|
|
|
public virtual void OnTextureFit(bool fitWidth, bool fitHeight) { } //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
public virtual void OnToggleUpperUnpegged() { }
|
|
|
|
public virtual void OnToggleLowerUnpegged() { }
|
|
|
|
public virtual void OnResetTextureOffset() { }
|
|
|
|
public virtual void OnCopyTextureOffsets() { }
|
|
|
|
public virtual void OnPasteTextureOffsets() { }
|
|
|
|
public virtual void OnInsert() { }
|
|
|
|
protected virtual void SetTexture(string texturename) { }
|
2009-05-03 19:22:32 +00:00
|
|
|
public virtual void ApplyUpperUnpegged(bool set) { }
|
|
|
|
public virtual void ApplyLowerUnpegged(bool set) { }
|
2012-11-27 21:12:20 +00:00
|
|
|
protected abstract void MoveTextureOffset(Point xy);
|
|
|
|
protected abstract Point GetTextureOffset();
|
|
|
|
|
|
|
|
// Setup this plane
|
|
|
|
public bool Setup() { return this.Setup(this.level, this.extrafloor); }
|
|
|
|
public virtual bool Setup(SectorLevel level, Effect3DFloor extrafloor)
|
|
|
|
{
|
|
|
|
this.level = level;
|
|
|
|
this.extrafloor = extrafloor;
|
|
|
|
return false;
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
// Begin select
|
|
|
|
public virtual void OnSelectBegin()
|
|
|
|
{
|
|
|
|
mode.LockTarget();
|
|
|
|
dragstartanglexy = General.Map.VisualCamera.AngleXY;
|
|
|
|
dragstartanglez = General.Map.VisualCamera.AngleZ;
|
|
|
|
dragorigin = pickintersect;
|
|
|
|
startoffsetx = GetTextureOffset().X;
|
|
|
|
startoffsety = GetTextureOffset().Y;
|
|
|
|
prevoffsetx = GetTextureOffset().X;
|
|
|
|
prevoffsety = GetTextureOffset().Y;
|
|
|
|
}
|
|
|
|
|
2009-05-01 20:31:17 +00:00
|
|
|
// Select or deselect
|
|
|
|
public virtual void OnSelectEnd()
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
mode.UnlockTarget();
|
|
|
|
|
|
|
|
// Was dragging?
|
|
|
|
if(uvdragging)
|
|
|
|
{
|
|
|
|
// Dragging stops now
|
|
|
|
uvdragging = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(this.selected)
|
|
|
|
{
|
|
|
|
this.selected = false;
|
|
|
|
mode.RemoveSelectedObject(this);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.selected = true;
|
|
|
|
mode.AddSelectedObject(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Moving the mouse
|
|
|
|
public virtual void OnMouseMove(MouseEventArgs e)
|
|
|
|
{
|
|
|
|
// Dragging UV?
|
|
|
|
if(uvdragging)
|
2009-07-07 11:29:56 +00:00
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
UpdateDragUV();
|
2009-07-07 11:29:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
// Select button pressed?
|
|
|
|
if(General.Actions.CheckActionActive(General.ThisAssembly, "visualselect"))
|
|
|
|
{
|
|
|
|
// Check if tolerance is exceeded to start UV dragging
|
|
|
|
float deltaxy = General.Map.VisualCamera.AngleXY - dragstartanglexy;
|
|
|
|
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");
|
|
|
|
|
|
|
|
// Start drag now
|
|
|
|
uvdragging = true;
|
|
|
|
mode.Renderer.ShowSelection = false;
|
|
|
|
mode.Renderer.ShowHighlight = false;
|
|
|
|
UpdateDragUV();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-07 11:29:56 +00:00
|
|
|
}
|
2009-05-01 20:31:17 +00:00
|
|
|
}
|
2013-07-31 12:38:47 +00:00
|
|
|
|
|
|
|
// Delete texture
|
|
|
|
public virtual void OnDelete() {
|
|
|
|
// Remove texture
|
|
|
|
mode.CreateUndo("Delete texture");
|
|
|
|
mode.SetActionResult("Deleted a texture.");
|
|
|
|
SetTexture("-");
|
|
|
|
|
|
|
|
// Update
|
|
|
|
Sector.Changed = true;
|
|
|
|
}
|
2009-05-01 20:31:17 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Processing
|
2012-07-12 22:34:12 +00:00
|
|
|
public virtual void OnProcess(float deltatime)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
// If the texture was not loaded, but is loaded now, then re-setup geometry
|
|
|
|
if(setuponloadedtexture != 0)
|
|
|
|
{
|
|
|
|
ImageData t = General.Map.Data.GetFlatImage(setuponloadedtexture);
|
|
|
|
if(t != null)
|
|
|
|
{
|
|
|
|
if(t.IsImageLoaded)
|
|
|
|
{
|
|
|
|
setuponloadedtexture = 0;
|
|
|
|
Setup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Flood-fill textures
|
|
|
|
public virtual void OnTextureFloodfill()
|
|
|
|
{
|
|
|
|
if(BuilderPlug.Me.CopiedFlat != null)
|
|
|
|
{
|
|
|
|
string oldtexture = GetTextureName();
|
|
|
|
long oldtexturelong = Lump.MakeLongName(oldtexture);
|
|
|
|
string newtexture = BuilderPlug.Me.CopiedFlat;
|
|
|
|
if(newtexture != oldtexture)
|
|
|
|
{
|
|
|
|
// Get the texture
|
|
|
|
ImageData newtextureimage = General.Map.Data.GetFlatImage(newtexture);
|
|
|
|
if(newtextureimage != null)
|
|
|
|
{
|
|
|
|
bool fillceilings = (this is VisualCeiling);
|
|
|
|
|
|
|
|
if(fillceilings)
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
mode.CreateUndo("Flood-fill ceilings with " + newtexture);
|
2009-05-02 14:59:05 +00:00
|
|
|
mode.SetActionResult("Flood-filled ceilings with " + newtexture + ".");
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
mode.CreateUndo("Flood-fill floors with " + newtexture);
|
2009-05-02 14:59:05 +00:00
|
|
|
mode.SetActionResult("Flood-filled floors with " + newtexture + ".");
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mode.Renderer.SetCrosshairBusy(true);
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
|
2009-06-12 09:44:38 +00:00
|
|
|
if(mode.IsSingleSelection)
|
|
|
|
{
|
|
|
|
// Clear all marks, this will align everything it can
|
|
|
|
General.Map.Map.ClearMarkedSectors(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Limit the alignment to selection only
|
|
|
|
General.Map.Map.ClearMarkedSectors(true);
|
|
|
|
List<Sector> sectors = mode.GetSelectedSectors();
|
|
|
|
foreach(Sector s in sectors) s.Marked = false;
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Do the fill
|
2009-06-12 09:44:38 +00:00
|
|
|
Tools.FloodfillFlats(this.Sector.Sector, fillceilings, oldtexturelong, newtextureimage, false);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Get the changed sectors
|
|
|
|
List<Sector> changes = General.Map.Map.GetMarkedSectors(true);
|
|
|
|
foreach(Sector s in changes)
|
|
|
|
{
|
|
|
|
// Update the visual sector
|
|
|
|
if(mode.VisualSectorExists(s))
|
|
|
|
{
|
|
|
|
BaseVisualSector vs = (mode.GetVisualSector(s) as BaseVisualSector);
|
|
|
|
if(fillceilings)
|
|
|
|
vs.Ceiling.Setup();
|
|
|
|
else
|
|
|
|
vs.Floor.Setup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
mode.Renderer.SetCrosshairBusy(false);
|
|
|
|
mode.ShowTargetInfo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-04-26 12:32:51 +00:00
|
|
|
|
|
|
|
//mxd. Auto-align texture offsets
|
|
|
|
public virtual void OnTextureAlign(bool alignx, bool aligny) {
|
|
|
|
if(!General.Map.UDMF) return;
|
|
|
|
|
|
|
|
//create undo
|
|
|
|
string rest = string.Empty;
|
|
|
|
if(alignx && aligny) rest = "(X and Y)";
|
|
|
|
else if(alignx) rest = "(X)";
|
|
|
|
else rest = "(Y)";
|
|
|
|
|
|
|
|
mode.CreateUndo("Auto-align textures " + rest);
|
|
|
|
mode.SetActionResult("Auto-aligned textures " + rest + ".");
|
|
|
|
|
|
|
|
//get selection
|
|
|
|
List<VisualGeometry> selection = mode.GetSelectedSurfaces();
|
|
|
|
|
|
|
|
//align textures on slopes
|
|
|
|
foreach(VisualGeometry vg in selection) {
|
|
|
|
if(vg.GeometryType == VisualGeometryType.FLOOR || vg.GeometryType == VisualGeometryType.CEILING) {
|
|
|
|
if(vg.GeometryType == VisualGeometryType.FLOOR)
|
|
|
|
((VisualFloor)vg).AlignTexture(alignx, aligny);
|
|
|
|
else
|
|
|
|
((VisualCeiling)vg).AlignTexture(alignx, aligny);
|
|
|
|
|
|
|
|
vg.Sector.Sector.UpdateNeeded = true;
|
|
|
|
vg.Sector.Sector.UpdateCache();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Map is changed
|
|
|
|
General.Map.Map.Update();
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
General.Interface.RefreshInfo();
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Copy properties
|
|
|
|
public virtual void OnCopyProperties()
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
BuilderPlug.Me.CopiedSectorProps = new SectorProperties(level.sector);
|
2009-05-02 14:59:05 +00:00
|
|
|
mode.SetActionResult("Copied sector properties.");
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Paste properties
|
|
|
|
public virtual void OnPasteProperties()
|
|
|
|
{
|
|
|
|
if(BuilderPlug.Me.CopiedSectorProps != null)
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
mode.CreateUndo("Paste sector properties");
|
2009-05-02 14:59:05 +00:00
|
|
|
mode.SetActionResult("Pasted sector properties.");
|
2012-11-27 21:12:20 +00:00
|
|
|
BuilderPlug.Me.CopiedSectorProps.Apply(level.sector);
|
|
|
|
if(mode.VisualSectorExists(level.sector))
|
|
|
|
{
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
|
|
|
vs.UpdateSectorGeometry(true);
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
mode.ShowTargetInfo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Select texture
|
|
|
|
public virtual void OnSelectTexture()
|
|
|
|
{
|
|
|
|
if(General.Interface.IsActiveWindow)
|
|
|
|
{
|
|
|
|
string oldtexture = GetTextureName();
|
|
|
|
string newtexture = General.Interface.BrowseFlat(General.Interface, oldtexture);
|
|
|
|
if(newtexture != oldtexture)
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
mode.ApplySelectTexture(newtexture, true);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-05-03 19:22:32 +00:00
|
|
|
|
|
|
|
// Apply Texture
|
|
|
|
public virtual void ApplyTexture(string texture)
|
|
|
|
{
|
|
|
|
mode.CreateUndo("Change flat " + texture);
|
|
|
|
SetTexture(texture);
|
2013-03-18 13:52:27 +00:00
|
|
|
onTextureChanged(); //mxd
|
2009-05-03 19:22:32 +00:00
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Copy texture
|
|
|
|
public virtual void OnCopyTexture()
|
|
|
|
{
|
|
|
|
BuilderPlug.Me.CopiedFlat = GetTextureName();
|
|
|
|
if(General.Map.Config.MixTexturesFlats) BuilderPlug.Me.CopiedTexture = GetTextureName();
|
2009-05-02 14:59:05 +00:00
|
|
|
mode.SetActionResult("Copied flat " + GetTextureName() + ".");
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public virtual void OnPasteTexture() { }
|
|
|
|
|
|
|
|
// Return texture name
|
|
|
|
public virtual string GetTextureName() { return ""; }
|
|
|
|
|
|
|
|
// Edit button released
|
|
|
|
public virtual void OnEditEnd()
|
|
|
|
{
|
2010-08-14 18:07:38 +00:00
|
|
|
if(General.Interface.IsActiveWindow)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
2013-07-09 11:29:10 +00:00
|
|
|
//mxd
|
2010-08-14 18:07:38 +00:00
|
|
|
List<Sector> sectors = mode.GetSelectedSectors();
|
2013-07-10 08:59:17 +00:00
|
|
|
updateList = new List<BaseVisualSector>();
|
|
|
|
|
|
|
|
foreach(Sector s in sectors) {
|
|
|
|
if(mode.VisualSectorExists(s)) {
|
|
|
|
updateList.Add((BaseVisualSector)mode.GetVisualSector(s));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-19 15:30:58 +00:00
|
|
|
General.Interface.OnEditFormValuesChanged += new System.EventHandler(Interface_OnEditFormValuesChanged); //mxd
|
|
|
|
mode.StartRealtimeInterfaceUpdate(SelectionType.Sectors); //mxd
|
2013-07-09 11:29:10 +00:00
|
|
|
General.Interface.ShowEditSectors(sectors);
|
2013-07-19 15:30:58 +00:00
|
|
|
mode.StopRealtimeInterfaceUpdate(SelectionType.Sectors); //mxd
|
|
|
|
General.Interface.OnEditFormValuesChanged -= Interface_OnEditFormValuesChanged; //mxd
|
2013-07-10 08:59:17 +00:00
|
|
|
|
2013-07-19 15:30:58 +00:00
|
|
|
updateList.Clear(); //mxd
|
|
|
|
updateList = null; //mxd
|
2013-07-09 11:29:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
private void Interface_OnEditFormValuesChanged(object sender, System.EventArgs e) {
|
2013-07-10 08:59:17 +00:00
|
|
|
foreach(BaseVisualSector vs in updateList)
|
|
|
|
vs.UpdateSectorGeometry(true);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Sector height change
|
|
|
|
public virtual void OnChangeTargetHeight(int amount)
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
changed = true;
|
2012-11-27 21:12:20 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
ChangeHeight(amount);
|
|
|
|
|
|
|
|
// Rebuild sector
|
2012-11-27 21:12:20 +00:00
|
|
|
BaseVisualSector vs;
|
|
|
|
if(mode.VisualSectorExists(level.sector)) {
|
|
|
|
vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
|
|
|
} else {//mxd. Need this to apply changes to 3d-floor even if control sector doesn't exist as BaseVisualSector
|
|
|
|
vs = mode.CreateBaseVisualSector(level.sector);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(vs != null) vs.UpdateSectorGeometry(true);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Sector brightness change
|
|
|
|
public virtual void OnChangeTargetBrightness(bool up)
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
mode.CreateUndo("Change sector brightness", UndoGroup.SectorBrightnessChange, Sector.Sector.FixedIndex);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
if(up)
|
|
|
|
Sector.Sector.Brightness = General.Map.Config.BrightnessLevels.GetNextHigher(Sector.Sector.Brightness);
|
|
|
|
else
|
|
|
|
Sector.Sector.Brightness = General.Map.Config.BrightnessLevels.GetNextLower(Sector.Sector.Brightness);
|
|
|
|
|
2009-05-02 14:59:05 +00:00
|
|
|
mode.SetActionResult("Changed sector brightness to " + Sector.Sector.Brightness + ".");
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
Sector.Sector.UpdateCache();
|
|
|
|
|
|
|
|
// Rebuild sector
|
2009-05-09 13:41:26 +00:00
|
|
|
Sector.UpdateSectorGeometry(false);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
// Texture offset change
|
2013-04-26 12:32:51 +00:00
|
|
|
public virtual void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection)
|
2012-11-27 21:12:20 +00:00
|
|
|
{
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
if(horizontal == 0 && vertical == 0) return; //mxd
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
//mxd
|
2013-04-26 12:32:51 +00:00
|
|
|
if (!General.Map.UDMF) {
|
|
|
|
General.ShowErrorMessage("Floor/ceiling texture offsets cannot be changed in this map format!", MessageBoxButtons.OK);
|
|
|
|
return;
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
2013-04-26 12:32:51 +00:00
|
|
|
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
|
|
|
|
undoticket = mode.CreateUndo("Change texture offsets");
|
2012-11-27 21:12:20 +00:00
|
|
|
|
2013-04-26 12:32:51 +00:00
|
|
|
//mxd
|
|
|
|
if(doSurfaceAngleCorrection) {
|
|
|
|
Point p = new Point(horizontal, vertical);
|
|
|
|
float angle = Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY);
|
|
|
|
if(GeometryType == VisualGeometryType.CEILING) {
|
|
|
|
angle += level.sector.Fields.GetValue("rotationceiling", 0f);
|
|
|
|
} else
|
|
|
|
angle += level.sector.Fields.GetValue("rotationfloor", 0f);
|
|
|
|
|
|
|
|
angle = General.ClampAngle(angle);
|
|
|
|
|
|
|
|
if(angle > 315 || angle < 46) {
|
|
|
|
|
|
|
|
} else if(angle > 225) {
|
|
|
|
vertical = p.X;
|
|
|
|
horizontal = -p.Y;
|
|
|
|
} else if(angle > 135) {
|
|
|
|
horizontal = -p.X;
|
|
|
|
vertical = -p.Y;
|
|
|
|
} else {
|
|
|
|
vertical = -p.X;
|
|
|
|
horizontal = p.Y;
|
|
|
|
}
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
2013-04-26 12:32:51 +00:00
|
|
|
// Apply offsets
|
|
|
|
MoveTextureOffset(new Point(-horizontal, -vertical));
|
|
|
|
|
|
|
|
// Update sector geometry
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
Sector s = GetControlSector();
|
|
|
|
if(s.Index != Sector.Sector.Index) {
|
|
|
|
s.UpdateNeeded = true;
|
|
|
|
s.UpdateCache();
|
|
|
|
mode.GetSectorData(s).Update();
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s);
|
|
|
|
vs.UpdateSectorGeometry(false);
|
|
|
|
vs.Rebuild();
|
|
|
|
}
|
|
|
|
|
|
|
|
Sector.Sector.UpdateNeeded = true;
|
|
|
|
Sector.Sector.UpdateCache();
|
2013-04-26 12:32:51 +00:00
|
|
|
Sector.UpdateSectorGeometry(false);
|
|
|
|
Sector.Rebuild();
|
2012-11-27 21:12:20 +00:00
|
|
|
}
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
|
|
|
|
public virtual void OnChangeTextureRotation(float angle) {
|
|
|
|
if(!General.Map.UDMF) return;
|
|
|
|
|
|
|
|
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
|
|
|
|
undoticket = mode.CreateUndo("Change texture rotation");
|
|
|
|
|
|
|
|
string key = (GeometryType == VisualGeometryType.FLOOR ? "rotationfloor" : "rotationceiling");
|
|
|
|
mode.SetActionResult( (GeometryType == VisualGeometryType.FLOOR ? "Floor" : "Ceiling") + " rotation changed to " + angle);
|
|
|
|
|
|
|
|
//set value
|
|
|
|
Sector s = GetControlSector();
|
2013-08-10 11:28:51 +00:00
|
|
|
s.Fields.BeforeFieldsChange();
|
|
|
|
UDMFTools.SetFloat(s.Fields, key, angle, 0.0f);
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
|
|
|
|
if(s.Index != Sector.Sector.Index) {
|
|
|
|
s.UpdateNeeded = true;
|
|
|
|
s.UpdateCache();
|
|
|
|
mode.GetSectorData(s).Update();
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s);
|
|
|
|
vs.UpdateSectorGeometry(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
Sector.Sector.UpdateNeeded = true;
|
|
|
|
Sector.Sector.UpdateCache();
|
|
|
|
Sector.UpdateSectorGeometry(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
public virtual void OnChangeTextureScale(float incrementX, float incrementY) {
|
|
|
|
if(!General.Map.UDMF) return;
|
|
|
|
|
|
|
|
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
|
|
|
|
undoticket = mode.CreateUndo("Change texture scale");
|
|
|
|
|
|
|
|
ChangeTextureScale(incrementX, incrementY);
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|