HammeriteEditorCommands

Editor. Inherits RefCounted

Every command the editor has, what it is bound to, and where it appears.

Hammerite's own, not Godot's InputMap. An InputMap action is global to the project that installs the addon, so putting sixty editor commands there would take sixty names out of the host game's hands - the same collision the class_name prefix exists to avoid, in a second namespace. The cost is that rebinding, saving and conflict detection are ours to write rather than Godot's to provide; rebind() is the first of them.

Two kinds live here. Commands happen once, can be listed, drawn in a menu and greyed out. Held bindings are asked "is this down right now" inside a movement update - flying the camera, holding the clip plane - and never appear in a menu.

Methods

ReturnsMethod
HammeriteEditorCommandadd(command: HammeriteEditorCommand)
HammeriteEditorCommand[]all()
voidbind_held(id: StringName, keycode: int)
HammeriteEditorCommand[]commands_in(menu: StringName)
HammeriteEditorCommand[]commands_in_context(context: StringName)
Arraycontext_order() static
StringNamectx_brush() static
StringNamectx_entity() static
StringNamectx_face() static
StringNamectx_instance() static
StringNamectx_selection() static
StringNamectx_view() static
StringNameedit() static
StringNamefile() static
HammeriteEditorCommandfind_command_for(event: InputEvent)
HammeriteEditorCommandget_command(id: StringName)
intheld_binding(id: StringName)
StringName[]held_ids()
StringNamehelp() static
boolis_command_held() static
boolis_event_for(id: StringName, event: InputEvent)
boolis_held(id: StringName)
Arraymenu_order() static
StringName[]menus()
boolrebind(id: StringName, events: InputEvent[])
HammeriteEditorCommandregister(id: StringName, label: String, menu: StringName, run: Callable)
StringNameselection() static
StringNametools() static
voidunregister(id: StringName)
StringNameview() static
StringNameviewport_3d() static

Signals

changed

signal changed()

A command was added or removed, or rebind() changed what one is bound to. Not emitted for other changes to a command already in the table.

Method descriptions

add()

func add(command: HammeriteEditorCommand) -> HammeriteEditorCommand

Adds command and returns it. An id already registered is an error, and command is returned without being added, so whatever is chained on it changes nobody's command.

all()

func all() -> HammeriteEditorCommand[]

Every command, in the order added. A new array.

bind_held()

func bind_held(id: StringName, keycode: int) -> void

Held bindings, which are polled rather than dispatched.

commands_in()

func commands_in(menu: StringName) -> HammeriteEditorCommand[]

The commands under menu menu, in the order added. A new array.

commands_in_context()

func commands_in_context(context: StringName) -> HammeriteEditorCommand[]

The commands a right-click on context offers, in table order.

context_order()

static func context_order() -> Array

The order a right-click draws its sections in, most specific first: what you clicked, then what it is part of, then what any selection can do, then the view.

ctx_brush()

static func ctx_brush() -> StringName

A brush is selected. See ctx_entity().

ctx_entity()

static func ctx_entity() -> StringName

Right-click contexts. A command names the ones it belongs to (HammeriteEditorCommand.in_context()) and HammeriteContextMenu draws whichever of them the selection puts in play. Separate from HammeriteEditorCommand.menu because they answer different questions: a menu is where a command LIVES, a context is what it applies TO, and Mirror on X lives under Selection while applying to a brush, an entity and a prefab instance alike.

ctx_face()

static func ctx_face() -> StringName

A face is selected. See ctx_entity().

ctx_instance()

static func ctx_instance() -> StringName

A prefab instance is selected. While one is, ctx_entity(), ctx_brush() and ctx_face() are not offered: an instance is acted on as one thing.

ctx_selection()

static func ctx_selection() -> StringName

Anything at all is selected. For what does not care which of the above it is: delete, duplicate, group, focus, narrow.

ctx_view()

static func ctx_view() -> StringName

Always, including a click on empty space. For what is about the VIEW rather than about what was clicked. Nothing of the editor's own is in it yet - the one candidate, picking the working plane, reads the face under the CURSOR, and by the time you have moved the cursor onto a menu item it is not over that face any more.

edit()

static func edit() -> StringName

See file().

file()

static func file() -> StringName

Menu names, for register() and HammeriteEditorCommand.in_menu(). A menu is named by its title, so a command naming any other string makes a new menu with that title.

find_command_for()

func find_command_for(event: InputEvent) -> HammeriteEditorCommand

The command event is bound to, or null. Matching is exact, so Cmd+Shift+Z is not Cmd+Z.

Skips anything a tool owns: those are asked for by id, by the tool, while it is running.

get_command()

func get_command(id: StringName) -> HammeriteEditorCommand

The command id, or null.

held_binding()

func held_binding(id: StringName) -> int

The key held binding id is bound to, or KEY_NONE.

held_ids()

func held_ids() -> StringName[]

Every held binding's id.

help()

static func help() -> StringName

Always the last menu, after any an addon adds.

is_command_held()

static func is_command_held() -> bool

Whether Cmd is down on macOS, or Ctrl elsewhere: what a click adds to the selection with.

is_event_for()

func is_event_for(id: StringName, event: InputEvent) -> bool

Whether event runs id, by its keys, its clicks or the character it is typed as - the same rules find_command_for() keeps. For a tool asking about its own bindings.

is_held()

func is_held(id: StringName) -> bool

Whether the key bound to held binding id is down now. False for an id nothing bound.

menu_order()

static func menu_order() -> Array

The order the menus are drawn in. A menu an addon invents lands after these.

menus()

func menus() -> StringName[]

The menus that have anything in them, in menu_order() and then whatever an addon added.

rebind()

func rebind(id: StringName, events: InputEvent[]) -> bool

Bind id to events alone, replacing what it was bound to; an empty array unbinds it. The menus redraw. False for an id nothing registered.

register()

func register(id: StringName, label: String, menu: StringName, run: Callable) -> HammeriteEditorCommand

For addons: one call, and the command is in the menu with its key working. The seam that stops every plugin hand-rolling another toolbar button.

selection()

static func selection() -> StringName

See file().

tools()

static func tools() -> StringName

See file(). Where an addon's tool goes.

unregister()

func unregister(id: StringName) -> void

Removes the command id. Nothing happens when there is none.

view()

static func view() -> StringName

See file().

viewport_3d()

static func viewport_3d() -> StringName

The dropdown in the corner of the perspective viewport, for what is true of the 3D VIEW rather than of the editor: which visualization it draws, and what it draws over the world. Its own menu name rather than a flag, so ordering, radio groups and separators work as they do anywhere else - the menubar knows to leave this one out.

Hammerite 2.0 · built from 6d57ab2d, 2026-10-17