Enabling Snap To Grid in Mission Editor
by Keith Johnston · in Artist Corner · 03/14/2003 (7:30 pm) · 3 replies
Turns out there is a snap to grid function in the mission editor - it is just not exposed through the GUI.
Here is how you can add a menu to turn it on:
EditorGui.cs:
In function function EditorGui::init(%this):
Add after the line " EditorMenuBar.addMenuItem("World", "Drop to Ground", 6, "", 1);"
Add after the line " EditorMenuBar.onWorldMenuItemSelect(0, "Drop at Screen Center");"
In function EditorMenuBar::onWorldMenuItemSelect(%this, %itemId, %item)
Add after the line "EditorMenuBar.onWorldMenuItemSelect(0, "Drop at Screen Center");"
Also note - if you use the gizmos to move things, hold shift down to use the snapping function.
Here is how you can add a menu to turn it on:
EditorGui.cs:
In function function EditorGui::init(%this):
Add after the line " EditorMenuBar.addMenuItem("World", "Drop to Ground", 6, "", 1);"
EditorMenuBar.addMenuItem("World", "-", 0);
EditorMenuBar.addMenuItem("World", "Snap On", 0, "", 2);
EditorMenuBar.addMenuItem("World", "Snap Off", 1, "", 2);Add after the line " EditorMenuBar.onWorldMenuItemSelect(0, "Drop at Screen Center");"
if ($EWorldEditor.snapToGrid) EditorMenuBar.onWorldMenuItemSelect(0, "Snap On"); else EditorMenuBar.onWorldMenuItemSelect(0, "Snap Off");
In function EditorMenuBar::onWorldMenuItemSelect(%this, %itemId, %item)
Add after the line "EditorMenuBar.onWorldMenuItemSelect(0, "Drop at Screen Center");"
case "Snap On":
EWorldEditor.snapToGrid = true;
%this.setMenuItemChecked("World", %item, true);
case "Snap Off":
EWorldEditor.snapToGrid = false;
%this.setMenuItemChecked("World", %item, true);Also note - if you use the gizmos to move things, hold shift down to use the snapping function.
#2
What might I be missing?
10/13/2004 (1:40 pm)
I just attempted to use this and I can't seem to get it to work. For one, I'm not finding the line "EditorMenuBar.onWorldMenuItemSelect(0, "Drop at Screen Center");" in onWorldMenuItemSelect so I added it just above the default clause of the switch statement. I've confirmed through the console that EWorldEditor.snapToGrid is set to true, but I'm not seeing the behavior I anticipate.What might I be missing?
#3
10/13/2004 (2:49 pm)
Have you tried this resource? It was the one I was originally looking for in the other "snap to grid" topic today, but I was searching forums rather than resources.
Ian Wheat