- Pressing Insert on a wall in Visual Mode now creates a middle texture

- Pressing Delete on a wall in Visual Mode now removes the texture (makes it a dash -)
This commit is contained in:
codeimp 2009-02-23 22:22:28 +00:00
parent 82b127f6fa
commit 0247329122
7 changed files with 65 additions and 6 deletions

View file

@ -127,6 +127,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
public virtual void OnResetTextureOffset() { }
public virtual void OnCopyTextureOffsets() { }
public virtual void OnPasteTextureOffsets() { }
public virtual void OnInsert() { }
public virtual void OnDelete() { }
protected virtual void SetTexture(string texturename) { }
// Processing

View file

@ -116,6 +116,43 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected virtual void SetTexture(string texturename) { }
public abstract bool Setup();
// Insert middle texture
public virtual void OnInsert()
{
// No middle texture yet?
if(!Sidedef.MiddleRequired() && (string.IsNullOrEmpty(Sidedef.MiddleTexture) || (Sidedef.MiddleTexture[0] == '-')))
{
// Make it now
General.Map.UndoRedo.CreateUndo("Create middle texture");
General.Settings.FindDefaultDrawSettings();
Sidedef.SetTextureMid(General.Settings.DefaultTexture);
// Update
Sector.Rebuild();
// Other side as well
if(string.IsNullOrEmpty(Sidedef.Other.MiddleTexture) || (Sidedef.Other.MiddleTexture[0] == '-'))
{
Sidedef.Other.SetTextureMid(General.Settings.DefaultTexture);
// Update
VisualSector othersector = mode.GetVisualSector(Sidedef.Other.Sector);
if(othersector is BaseVisualSector) (othersector as BaseVisualSector).Rebuild();
}
}
}
// Delete texture
public virtual void OnDelete()
{
// Remove texture
General.Map.UndoRedo.CreateUndo("Delete texture");
SetTexture("-");
// Update
Sector.Rebuild();
}
// Processing
public virtual void OnProcess(double deltatime)
{

View file

@ -583,6 +583,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
ShowTargetInfo();
}
[BeginAction("insertitem", BaseAction = true)]
public void Insert()
{
PickTargetUnlocked();
if(target.picked != null) (target.picked as IVisualEventReceiver).OnInsert();
ShowTargetInfo();
}
[BeginAction("deleteitem", BaseAction = true)]
public void Delete()
{
PickTargetUnlocked();
if(target.picked != null) (target.picked as IVisualEventReceiver).OnDelete();
ShowTargetInfo();
}
#endregion
}
}

View file

@ -351,6 +351,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
public virtual void OnResetTextureOffset() { }
public virtual void OnProcess(double deltatime) { }
public virtual void OnTextureFloodfill() { }
public virtual void OnInsert() { }
public virtual void OnDelete() { }
// Return texture name
public virtual string GetTextureName() { return ""; }

View file

@ -60,6 +60,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
void OnToggleUpperUnpegged();
void OnToggleLowerUnpegged();
void OnProcess(double deltatime);
void OnInsert();
void OnDelete();
// Other methods
string GetTextureName();

View file

@ -1384,7 +1384,7 @@ namespace CodeImp.DoomBuilder.Geometry
// Apply texturing
if(j.sidedef.LongHighTexture == originaltexture) j.sidedef.SetTextureHigh(filltexture.Name);
if(((j.sidedef.MiddleTexture[0] != '-') || j.sidedef.MiddleRequired()) &&
if((((j.sidedef.MiddleTexture.Length > 0) && (j.sidedef.MiddleTexture[0] != '-')) || j.sidedef.MiddleRequired()) &&
(j.sidedef.LongMiddleTexture == originaltexture)) j.sidedef.SetTextureMid(filltexture.Name);
if(j.sidedef.LongLowTexture == originaltexture) j.sidedef.SetTextureLow(filltexture.Name);
j.sidedef.Marked = true;
@ -1572,7 +1572,7 @@ namespace CodeImp.DoomBuilder.Geometry
{
return ((sd.LongHighTexture == texturelongname) && sd.HighRequired()) ||
((sd.LongLowTexture == texturelongname) && sd.LowRequired()) ||
((sd.LongMiddleTexture == texturelongname) && (sd.MiddleRequired() || (sd.MiddleTexture[0] != '-'))) ;
((sd.LongMiddleTexture == texturelongname) && (sd.MiddleRequired() || ((sd.MiddleTexture.Length > 0) && (sd.MiddleTexture[0] != '-')))) ;
}
#endregion

View file

@ -277,8 +277,8 @@ centerinscreen
insertitem
{
title = "Insert Item";
category = "classic";
description = "Creates a new vertex or thing at the current mouse position.";
category = "edit";
description = "Creates a new item depending on the editing mode you are in.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
@ -287,8 +287,8 @@ insertitem
deleteitem
{
title = "Delete Item";
category = "classic";
description = "Deletes the highlighted or selected items.";
category = "edit";
description = "Deletes the highlighted or selected items, depending on the editing mode you are in.";
allowkeys = true;
allowmouse = true;
allowscroll = true;