Skip to content

Add the missing standard editor shortcuts #839

Description

@Gopmyc

Problem this feature should fix

A few standard shortcuts are simply missing: Ctrl+X, Ctrl+D (duplicate is only in the Hierarchy right click menu) and F2 to rename.

The ones that do exist are scattered and don't behave the same way. Editor::HandleGlobalShortcuts handles Del, Ctrl+C and Ctrl+V and accepts both Ctrl keys, while MenuBar::HandleShortcuts handles Ctrl+N and Ctrl+S but only tests KEY_LEFT_CONTROL, so saving with the right Ctrl does nothing. SceneView and CameraController have their own on top of that.

None of them check whether ImGui is using the keyboard. InputManager reads GLFW callbacks directly and nothing in the code looks at WantTextInput, so renaming an actor from the Hierarchy and pressing Del destroys the actor instead of erasing a character, and Ctrl+S fires from any text field.

Also, MenuItem already takes a shortcut label but only the File menu fills it in, so the other bindings are invisible in the UI.

Expected solution

Handle shortcuts in one place, so the modifier and focus rules are written once instead of being redone at each call site. Left and right modifiers should be equivalent, and shortcuts should be ignored while ImGui has the keyboard. View specific bindings (W/E/R, camera controls) can stay in their panel since they're contextual by nature. Menus and context menus should fill in the p_shortcut label so bindings show up.

Then add Ctrl+D (just needs to call the existing DuplicateActor), F2 and Ctrl+X.

Ctrl+X needs a fix first. Context::ActorCopyBuffer only stores a GUID and PasteActor resolves it with FindActorByGUID, so the buffer points at a live actor instead of holding a copy. Cutting would empty it immediately. The problem is already visible today: copy an actor, delete it, paste does nothing. DuplicateActor serialises the actor to XML anyway, so CopyActor could keep that document and PasteActor read from it.

Not included here:

  • Ctrl+Z / Ctrl+Y, tracked in a separate issue. Everything else here binds to an action that already exists, while undo first requires the editor to record what changed, which is a much bigger change.
  • Ctrl+A, since selection is single actor for now.
  • Custom keybindings.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions