added selection groups!

This commit is contained in:
codeimp 2008-10-16 09:33:35 +00:00
parent 67747188ca
commit 7e664d1ba9
4 changed files with 318 additions and 1 deletions

View file

@ -63,6 +63,26 @@ shortcuts
builder_cutselection = 131160;
buildermodes_gradientbrightness = 71;
builder_categories = 0;
builder_selectgroup6 = 54;
builder_selectgroup1 = 49;
builder_selectgroup10 = 48;
builder_selectgroup7 = 55;
builder_selectgroup2 = 50;
builder_selectgroup5 = 53;
builder_selectgroup8 = 56;
builder_selectgroup9 = 57;
builder_selectgroup3 = 51;
builder_selectgroup4 = 52;
builder_assigngroup1 = 131121;
builder_assigngroup6 = 131126;
builder_assigngroup9 = 131129;
builder_assigngroup2 = 131122;
builder_assigngroup4 = 131124;
builder_assigngroup10 = 131120;
builder_assigngroup8 = 131128;
builder_assigngroup7 = 131127;
builder_assigngroup3 = 131123;
builder_assigngroup5 = 131125;
}

View file

@ -934,8 +934,64 @@ namespace CodeImp.DoomBuilder
#endregion
#region ================== Methods
#region ================== Selection Groups
// This adds selection to a group
private void AddSelectionToGroup(int groupindex)
{
General.Interface.SetCursor(Cursors.WaitCursor);
// Make undo
undoredo.CreateUndo("Assign to group " + groupindex, UndoGroup.None, 0);
// Make selection
map.AddSelectionToGroup(0x01 << groupindex);
General.Interface.SetCursor(Cursors.Default);
}
// This selects a group
private void SelectGroup(int groupindex)
{
// Select
int groupmask = 0x01 << groupindex;
map.SelectVerticesByGroup(groupmask);
map.SelectLinedefsByGroup(groupmask);
map.SelectSectorsByGroup(groupmask);
map.SelectThingsByGroup(groupmask);
// Redraw to show selection
General.Interface.RedrawDisplay();
}
// Select actions
[BeginAction("selectgroup1")] internal void SelectGroup1() { SelectGroup(0); }
[BeginAction("selectgroup2")] internal void SelectGroup2() { SelectGroup(1); }
[BeginAction("selectgroup3")] internal void SelectGroup3() { SelectGroup(2); }
[BeginAction("selectgroup4")] internal void SelectGroup4() { SelectGroup(3); }
[BeginAction("selectgroup5")] internal void SelectGroup5() { SelectGroup(4); }
[BeginAction("selectgroup6")] internal void SelectGroup6() { SelectGroup(5); }
[BeginAction("selectgroup7")] internal void SelectGroup7() { SelectGroup(6); }
[BeginAction("selectgroup8")] internal void SelectGroup8() { SelectGroup(7); }
[BeginAction("selectgroup9")] internal void SelectGroup9() { SelectGroup(8); }
[BeginAction("selectgroup10")] internal void SelectGroup10() { SelectGroup(9); }
// Assign actions
[BeginAction("assigngroup1")] internal void AssignGroup1() { AddSelectionToGroup(0); }
[BeginAction("assigngroup2")] internal void AssignGroup2() { AddSelectionToGroup(1); }
[BeginAction("assigngroup3")] internal void AssignGroup3() { AddSelectionToGroup(2); }
[BeginAction("assigngroup4")] internal void AssignGroup4() { AddSelectionToGroup(3); }
[BeginAction("assigngroup5")] internal void AssignGroup5() { AddSelectionToGroup(4); }
[BeginAction("assigngroup6")] internal void AssignGroup6() { AddSelectionToGroup(5); }
[BeginAction("assigngroup7")] internal void AssignGroup7() { AddSelectionToGroup(6); }
[BeginAction("assigngroup8")] internal void AssignGroup8() { AddSelectionToGroup(7); }
[BeginAction("assigngroup9")] internal void AssignGroup9() { AddSelectionToGroup(8); }
[BeginAction("assigngroup10")] internal void AssignGroup10() { AddSelectionToGroup(9); }
#endregion
#region ================== Methods
// This changes thing filter
internal void ChangeThingFilter(ThingsFilter newfilter)
{

View file

@ -595,7 +595,47 @@ namespace CodeImp.DoomBuilder.Map
{
foreach(Thing t in things) if(t.Marked == mark) t.Selected = select;
}
// This selects geometry by group
public void SelectVerticesByGroup(int groupmask)
{
foreach(SelectableElement e in vertices) e.SelectByGroup(groupmask);
}
// This selects geometry by group
public void SelectLinedefsByGroup(int groupmask)
{
foreach(SelectableElement e in linedefs) e.SelectByGroup(groupmask);
}
// This selects geometry by group
public void SelectSectorsByGroup(int groupmask)
{
foreach(SelectableElement e in sectors) e.SelectByGroup(groupmask);
}
// This selects geometry by group
public void SelectThingsByGroup(int groupmask)
{
foreach(SelectableElement e in things) e.SelectByGroup(groupmask);
}
// This adds the current selection to a group
public void AddSelectionToGroup(int groupmask)
{
foreach(SelectableElement e in vertices)
if(e.Selected) e.AddToGroup(groupmask);
foreach(SelectableElement e in linedefs)
if(e.Selected) e.AddToGroup(groupmask);
foreach(SelectableElement e in sectors)
if(e.Selected) e.AddToGroup(groupmask);
foreach(SelectableElement e in things)
if(e.Selected) e.AddToGroup(groupmask);
}
#endregion
#region ================== Marking

View file

@ -11,6 +11,7 @@ categories
tools = "Tools";
classic = "Classic Modes";
visual = "Visual Modes";
selecting = "Selecting";
}
// This just defines which actions there are, what description they have and
@ -449,3 +450,203 @@ pasteselection
allowmouse = true;
allowscroll = false;
}
selectgroup1
{
title = "Select Group 1";
category = "selecting";
description = "Selects all geometry that was assigned to group 1";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
selectgroup2
{
title = "Select Group 2";
category = "selecting";
description = "Selects all geometry that was assigned to group 2";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
selectgroup3
{
title = "Select Group 3";
category = "selecting";
description = "Selects all geometry that was assigned to group 3";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
selectgroup4
{
title = "Select Group 4";
category = "selecting";
description = "Selects all geometry that was assigned to group 4";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
selectgroup5
{
title = "Select Group 5";
category = "selecting";
description = "Selects all geometry that was assigned to group 5";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
selectgroup6
{
title = "Select Group 6";
category = "selecting";
description = "Selects all geometry that was assigned to group 6";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
selectgroup7
{
title = "Select Group 7";
category = "selecting";
description = "Selects all geometry that was assigned to group 7";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
selectgroup8
{
title = "Select Group 8";
category = "selecting";
description = "Selects all geometry that was assigned to group 8";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
selectgroup9
{
title = "Select Group 9";
category = "selecting";
description = "Selects all geometry that was assigned to group 9";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
selectgroup10
{
title = "Select Group 10";
category = "selecting";
description = "Selects all geometry that was assigned to group 10";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
assigngroup1
{
title = "Assign Group 1";
category = "selecting";
description = "Assigns the selected geometry to group 1";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
assigngroup2
{
title = "Assign Group 2";
category = "selecting";
description = "Assigns the selected geometry to group 2";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
assigngroup3
{
title = "Assign Group 3";
category = "selecting";
description = "Assigns the selected geometry to group 3";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
assigngroup4
{
title = "Assign Group 4";
category = "selecting";
description = "Assigns the selected geometry to group 4";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
assigngroup5
{
title = "Assign Group 5";
category = "selecting";
description = "Assigns the selected geometry to group 5";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
assigngroup6
{
title = "Assign Group 6";
category = "selecting";
description = "Assigns the selected geometry to group 6";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
assigngroup7
{
title = "Assign Group 7";
category = "selecting";
description = "Assigns the selected geometry to group 7";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
assigngroup8
{
title = "Assign Group 8";
category = "selecting";
description = "Assigns the selected geometry to group 8";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
assigngroup9
{
title = "Assign Group 9";
category = "selecting";
description = "Assigns the selected geometry to group 9";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}
assigngroup10
{
title = "Assign Group 10";
category = "selecting";
description = "Assigns the selected geometry to group 10";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}