API ReferenceEditor.MapEditor

Hammerclass

object→Hammer
Namespace
Editor.MapEditor
Assembly
Sandbox.Tools
Declaration
public static abstract sealed class Editor.MapEditor.Hammer

Methods9

Showing 9 methods

public static void AssignAssetToSelection(Editor.Asset asset)PUBLICSTATIC

Assigns the asset to the current selection.

ParameterTypeDescription
assetAsset—
Returns:void—

public static bool BuildMap(Editor.MapEditor.MapBuildPreset preset = 0, bool loadInEngine = False)PUBLICSTATIC

Compile the active map, as if the user pressed Build in the Build Map dialog with this preset. The dialog shows the progress. Never prompts to save - save first, the build compiles what's on disk. Returns false if the build couldn't start; `Editor.MapEditor.Hammer.BuildStatus` says why.

ParameterTypeDescription
preset = 0MapBuildPresetWhat to build.
loadInEngine = FalseboolLoad the map in engine when it's built, if the dialog is set to.
Returns:bool—

public static void ReloadFromFile()PUBLICSTATIC

Reloads the active editor session from file with user prompt

Returns:void—

public static bool RunCommand(string name)PUBLICSTATIC

Run a Hammer command by name on the active map, exactly as if its key binding was pressed. Returns false if no command has that name. See `Editor.MapEditor.Hammer.Commands` for what exists.

ParameterTypeDescription
namestring—
Returns:bool—

public static bool Save()PUBLICSTATIC

Save the active map to its file. Never prompts - returns false if the map has never been saved, so has no file to save to, or the save failed.

Returns:bool—

public static void SelectFacesUsingMaterial(Editor.Asset asset)PUBLICSTATIC

Selects all faces using the asset, forces `Editor.MapEditor.Selection.SelectMode` to `Editor.MapEditor.SelectMode.Faces`

ParameterTypeDescription
assetAsset—
Returns:void—

public static void SelectObjectsUsingAsset(Editor.Asset asset)PUBLICSTATIC

Selects all map nodes using the asset, appending them to the current selection.

ParameterTypeDescription
assetAsset—
Returns:void—

public static void SetCurrentMaterial(Editor.Asset asset)PUBLICSTATIC

Sets the currently used material to the specified asset.

Note

I'd happily merge together this into a get setter, but it's a mix of a Material and an Asset

ParameterTypeDescription
assetAsset—
Returns:void—

public static void ShowEntityReportForAsset(Editor.Asset asset)PUBLICSTATIC

Opens a Entity Report dialog showing all entities using this asset.

ParameterTypeDescription
assetAsset—
Returns:void—

Properties13

Showing 13 properties

public static Editor.MapEditor.MapView Editor.MapEditor.Hammer.ActiveMapView { get; set; }PUBLICSTATICGETSET

The view of the active map the user interacted with most recently.

Returns:MapView—

public static string Editor.MapEditor.Hammer.BuildLog { get; set; }PUBLICSTATICGETSET

Everything the last map compile printed.

Returns:string—

public static string Editor.MapEditor.Hammer.BuildStatus { get; set; }PUBLICSTATICGETSET

The Build Map dialog's status line - "Done", "Failed - Exit Code 1" and so on. Empty if no build has run.

Returns:string—

public static System.Collections.Generic.IReadOnlyList`1<string> Editor.MapEditor.Hammer.Commands { get; set; }PUBLICSTATICGETSET

Names of every Hammer command `Editor.MapEditor.Hammer.RunCommand(System.String)` can run - the same commands key bindings and menus trigger, like "Undo", "GroupSelection" or "FrameAllViews".

Returns:IReadOnlyList<string>—

public static string Editor.MapEditor.Hammer.CompiledMapPath { get; set; }PUBLICSTATICGETSET

Where the active map compiles to - its .vpk next to the .vmap. Null for a map that has never been saved.

Returns:string—

public static Sandbox.Material Editor.MapEditor.Hammer.CurrentMaterial { get; set; }PUBLICSTATICGETSET

Current Material - you can set this programmatically with `Editor.MapEditor.Hammer.SetCurrentMaterial(Editor.Asset)`

Returns:Material—

public static bool Editor.MapEditor.Hammer.HasUnsavedChanges { get; set; }PUBLICSTATICGETSET

Whether the active map has changes that haven't been saved.

Returns:bool—

public static bool Editor.MapEditor.Hammer.IsBuildingMap { get; set; }PUBLICSTATICGETSET

Whether a map compile is running.

Returns:bool—

public static System.Collections.Generic.IEnumerable`1<Editor.MapEditor.MapView> Editor.MapEditor.Hammer.MapViews { get; set; }PUBLICSTATICGETSET

Every view of the active map, 2D and 3D.

Returns:IEnumerable<MapView>—

public static bool Editor.MapEditor.Hammer.Open { get; set; }PUBLICSTATICGETSET

If the Hammer app has been opened.

Returns:bool—

On this page

Methodspublic static System.Void AssignAssetToSelection(Editor.Asset asset)public static System.Boolean BuildMap(Editor.MapEditor.MapBuildPreset preset = 0, System.Boolean loadInEngine = False)public static System.Void ReloadFromFile()public static System.Boolean RunCommand(System.String name)public static System.Boolean Save()public static System.Void SelectFacesUsingMaterial(Editor.Asset asset)public static System.Void SelectObjectsUsingAsset(Editor.Asset asset)public static System.Void SetCurrentMaterial(Editor.Asset asset)public static System.Void ShowEntityReportForAsset(Editor.Asset asset)Propertiespublic static Editor.MapDoc.MapDocument Editor.MapEditor.Hammer.ActiveMap { get; set; }public static Editor.MapEditor.MapView Editor.MapEditor.Hammer.ActiveMapView { get; set; }public static System.String Editor.MapEditor.Hammer.BuildLog { get; set; }public static System.String Editor.MapEditor.Hammer.BuildStatus { get; set; }public static System.Collections.Generic.IReadOnlyList`1<System.String> Editor.MapEditor.Hammer.Commands { get; set; }public static System.String Editor.MapEditor.Hammer.CompiledMapPath { get; set; }public static Sandbox.Material Editor.MapEditor.Hammer.CurrentMaterial { get; set; }public static System.Boolean Editor.MapEditor.Hammer.HasUnsavedChanges { get; set; }public static System.Boolean Editor.MapEditor.Hammer.IsBuildingMap { get; set; }public static Editor.Asset Editor.MapEditor.Hammer.MapAsset { get; set; }public static System.Collections.Generic.IEnumerable`1<Editor.MapEditor.MapView> Editor.MapEditor.Hammer.MapViews { get; set; }public static System.Boolean Editor.MapEditor.Hammer.Open { get; set; }public static Editor.Window Editor.MapEditor.Hammer.Window { get; set; }Metadata