MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / HandleShortcuts

Method HandleShortcuts

Source/Editors/map_editor.cpp:1608–1835  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1606}
1607
1608void MapEditor::HandleShortcuts(const LineSegment& mouseray) {
1609 Online* online = Online::Instance();
1610
1611 const Keyboard& keyboard = Input::Instance()->getKeyboard();
1612 if (KeyCommand::CheckPressed(keyboard, KeyCommand::kEditScriptParams, KIMF_LEVEL_EDITOR_GENERAL)) {
1613 show_selected = !show_selected;
1614 }
1615
1616 if (KeyCommand::CheckPressed(keyboard, KeyCommand::kSearchScenegraph, KIMF_LEVEL_EDITOR_GENERAL)) {
1617 select_scenegraph_search = true;
1618 show_scenegraph = true;
1619 }
1620
1621 if (KeyCommand::CheckPressed(keyboard, KeyCommand::kScenegraph, KIMF_LEVEL_EDITOR_GENERAL)) {
1622 show_scenegraph = !show_scenegraph;
1623 }
1624
1625 if (KeyCommand::CheckPressed(keyboard, KeyCommand::kEditColor, KIMF_LEVEL_EDITOR_GENERAL)) {
1626 // Color picking.
1627 show_color_picker = !show_color_picker;
1628 }
1629
1630 if (KeyCommand::CheckPressed(keyboard, KeyCommand::kTogglePlayer, KIMF_LEVEL_EDITOR_GENERAL)) {
1631 ReturnSelected(&selected);
1632 bool one_character_selected = false;
1633 if (selected.size() == 1 && selected[0]->GetType() == _movement_object) {
1634 one_character_selected = true;
1635 }
1636 if (one_character_selected) {
1637 MovementObject* mo = (MovementObject*)(selected[0]);
1638 mo->is_player = !mo->is_player;
1639 QueueSaveHistoryState();
1640
1641 if (online->IsHosting()) {
1642 if (!mo->is_player) {
1643 online->RemoveFreeAvatarId(mo->GetID());
1644 } else {
1645 online->AddFreeAvatarId(mo->GetID());
1646 }
1647 }
1648 }
1649 }
1650 // Handle switching editor type
1651 if (KeyCommand::CheckPressed(keyboard, KeyCommand::kToggleObjectEditing, KIMF_LEVEL_EDITOR_GENERAL)) {
1652 SetTypeEnabled(_env_object, !IsTypeEnabled(_env_object));
1653 }
1654 if (KeyCommand::CheckPressed(keyboard, KeyCommand::kToggleDecalEditing, KIMF_LEVEL_EDITOR_GENERAL)) {
1655 SetTypeEnabled(_decal_object, !IsTypeEnabled(_decal_object));
1656 }
1657 if (KeyCommand::CheckPressed(keyboard, KeyCommand::kToggleHotspotEditing, KIMF_LEVEL_EDITOR_GENERAL)) {
1658 SetTypeEnabled(_hotspot_object, !IsTypeEnabled(_hotspot_object));
1659 }
1660 // Handle saves
1661 // This bool is needed because the new default keybind for "save level as"
1662 // is the old "save selected items", so to keep backward/forward compatibility
1663 // it needs to be able to have the same keybind, but override the old behaviour
1664 bool save_triggered = false;
1665 if (KeyCommand::CheckPressed(keyboard, KeyCommand::kSaveLevelAs, KIMF_LEVEL_EDITOR_GENERAL)) {

Callers

nothing calls this directly

Calls 15

ActorsEditor_AddEntityFunction · 0.85
GetConnectionTypeFunction · 0.85
lineCheckActiveSelectedFunction · 0.85
findFunction · 0.85
IsHostingMethod · 0.80
RemoveFreeAvatarIdMethod · 0.80
AddFreeAvatarIdMethod · 0.80
wasScancodePressedMethod · 0.80
isKeycodeDownMethod · 0.80
lineCheckCollidableMethod · 0.80
LineCheckAllMethod · 0.80
getCameraObjectMethod · 0.80

Tested by

no test coverage detected