diff --git a/changelog.md b/changelog.md index 7e592a9..6657189 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## v6.6.0 + * Add keybinds for Save Level, Build Helper, Align X, Align Y, Edit Object, Edit Group, Edit Special, Copy Values, Paste State, Paste Color, and Toggle Link Controls + ## v6.5.0 * Add support for 2.206 * Add Quick Save feature that significantly improves level saving speeds diff --git a/mod.json b/mod.json index 6e823c1..104e93e 100644 --- a/mod.json +++ b/mod.json @@ -1,6 +1,6 @@ { - "geode": "3.1.1", - "version": "6.5.0", + "geode": "3.2.0", + "version": "6.6.0", "gd": { "win": "2.206", "mac": "2.206", diff --git a/src/features/Keybinds.cpp b/src/features/Keybinds.cpp index cd45308..d1e5d2b 100644 --- a/src/features/Keybinds.cpp +++ b/src/features/Keybinds.cpp @@ -32,12 +32,53 @@ struct $modify(EditorUI) { this->activateScaleControl(scaleBtn); } }); + this->defineKeybind("toggle-link-controls"_spr, [this]() { + GameManager::get()->toggleGameVariable("0097"); + m_editorLayer->updateOptions(); + }); this->defineKeybind("show-ui"_spr, [this]() { this->showUI(true); }); this->defineKeybind("hide-ui"_spr, [this]() { this->showUI(false); }); + + this->defineKeybind("open-edit-object"_spr, [this]() { + this->editObject(nullptr); + }); + this->defineKeybind("open-edit-group"_spr, [this]() { + this->editGroup(nullptr); + }); + this->defineKeybind("open-edit-special"_spr, [this]() { + this->editObject2(nullptr); + }); + this->defineKeybind("copy-values"_spr, [this]() { + this->onCopyState(nullptr); + }); + this->defineKeybind("paste-state"_spr, [this]() { + this->onPasteState(nullptr); + }); + this->defineKeybind("paste-color"_spr, [this]() { + this->onPasteColor(nullptr); + }); + + this->defineKeybind("save-level"_spr, [this]() { + if (m_editorLayer->m_playbackMode != PlaybackMode::Not) { + this->onStopPlaytest(nullptr); + } + fakeEditorPauseLayer(m_editorLayer)->saveLevel(); + Notification::create("Level saved", NotificationIcon::Success)->show(); + }); + + this->defineKeybind("build-helper"_spr, [this]() { + fakeEditorPauseLayer(m_editorLayer)->onBuildHelper(nullptr); + }); + this->defineKeybind("align-x"_spr, [this]() { + fakeEditorPauseLayer(m_editorLayer)->onAlignX(nullptr); + }); + this->defineKeybind("align-y"_spr, [this]() { + fakeEditorPauseLayer(m_editorLayer)->onAlignY(nullptr); + }); this->defineKeybind("select-all"_spr, [this]() { fakeEditorPauseLayer(m_editorLayer)->onSelectAll(nullptr); }); @@ -47,6 +88,7 @@ struct $modify(EditorUI) { this->defineKeybind("select-all-right"_spr, [this]() { fakeEditorPauseLayer(m_editorLayer)->onSelectAllRight(nullptr); }); + this->defineKeybind("move-obj-half-left"_spr, [this] { this->moveObjectCall(EditCommand::HalfLeft); }); @@ -131,6 +173,95 @@ struct $modify(EditorUI) { {}, Category::EDITOR_MODIFY )); + BindManager::get()->registerBindable(BindableAction( + "show-scale"_spr, + "Show Scale Control", + "Show the object scaling controls", + {}, + Category::EDITOR_UI + )); + + BindManager::get()->registerBindable(BindableAction( + "save-level"_spr, + "Save Level", + "", + {}, + Category::EDITOR_MODIFY + )); + BindManager::get()->registerBindable(BindableAction( + "build-helper"_spr, + "Build Helper", + "Executes the Build Helper feature, aka remaps Groud and Color " + "IDs of the selected objects to unused ones", + {}, + Category::EDITOR_MODIFY + )); + BindManager::get()->registerBindable(BindableAction( + "align-x"_spr, + "Align X", + "Executes the Align X feature, aka aligns all of the selected " + "objects along the X axis", + {}, + Category::EDITOR_MODIFY + )); + BindManager::get()->registerBindable(BindableAction( + "align-y"_spr, + "Align Y", + "Executes the Align Y feature, aka aligns all of the selected " + "objects along the Y axis", + {}, + Category::EDITOR_MODIFY + )); + BindManager::get()->registerBindable(BindableAction( + "toggle-link-controls"_spr, + "Toggle Link Controls", + "", + {}, + Category::EDITOR_UI + )); + + BindManager::get()->registerBindable(BindableAction( + "open-edit-object"_spr, + "Edit Object", + "Open the Edit Object popup for the selected objects", + {}, + Category::EDITOR_MODIFY + )); + BindManager::get()->registerBindable(BindableAction( + "open-edit-group"_spr, + "Edit Group", + "Open the Edit Group popup for the selected objects", + {}, + Category::EDITOR_MODIFY + )); + BindManager::get()->registerBindable(BindableAction( + "open-edit-special"_spr, + "Edit Special", + "Open the Edit Special popup for the selected objects", + {}, + Category::EDITOR_MODIFY + )); + BindManager::get()->registerBindable(BindableAction( + "copy-values"_spr, + "Copy Values", + "", + {}, + Category::EDITOR_MODIFY + )); + BindManager::get()->registerBindable(BindableAction( + "paste-state"_spr, + "Paste State", + "", + {}, + Category::EDITOR_MODIFY + )); + BindManager::get()->registerBindable(BindableAction( + "paste-color"_spr, + "Paste Color", + "", + {}, + Category::EDITOR_MODIFY + )); BindManager::get()->registerBindable(BindableAction( "select-all"_spr, @@ -154,13 +285,6 @@ struct $modify(EditorUI) { Category::EDITOR_MODIFY )); - BindManager::get()->registerBindable(BindableAction( - "show-scale"_spr, - "Show Scale Control", - "Show the object scaling controls", - {}, - Category::EDITOR_UI - )); // todo: toggle UI BindManager::get()->registerBindable(BindableAction( "show-ui"_spr, diff --git a/src/features/about/ShowChangelogOnStartup.cpp b/src/features/about/ShowChangelogOnStartup.cpp index 6baeb40..446a7e8 100644 --- a/src/features/about/ShowChangelogOnStartup.cpp +++ b/src/features/about/ShowChangelogOnStartup.cpp @@ -11,26 +11,9 @@ class $modify(LevelEditorLayer) { if (!LevelEditorLayer::init(level, idk)) return false; - if (auto available = Mod::get()->hasAvailableUpdate()) { - auto popup = createQuickPopup( - "Update Available!", - fmt::format( - "BetterEdit has a new update {} available!\n\n" - "Visit the Geode mods list to install it", - available.value() - ), - "OK", "Update", - [](auto, bool btn2) { - if (btn2) { - openInfoPopup(Mod::get()); - } - }, - false - ); - popup->m_scene = this; - popup->show(); - } - + // We don't really need to check for updates on startup anymore, since + // Geode is now really good at it by itself + // Check if new updates have been installed auto lastShown = Mod::get()->template getSavedValue("last-shown-changelog"); if (lastShown < Mod::get()->getVersion()) {