From d621550480f369cb9141982f4e03431ff179afb2 Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Tue, 3 Dec 2024 00:03:01 +0200 Subject: [PATCH] update changelog & indicators in viewtab --- changelog.md | 4 ++++ mod.json | 2 +- src/features/ViewTab/ViewTab.cpp | 19 ++++++++++++++----- src/utils/Editor.cpp | 15 +++++++++++++++ src/utils/Editor.hpp | 3 +++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 0d2439d..7041212 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # BetterEdit 6 +## v6.10.0-alpha.2 + * Trigger Indicators are now the same color as the targeting triggers & now show Center Groups + * Some minor visual fixes (thank you to Alphalaneous!) + ## v6.10.0-alpha.1 * Add Trigger Indicators (toggleable in View Tab) * Make Alpha's mods only Suggested instead of Recommended (so they aren't auto-installed) diff --git a/mod.json b/mod.json index c5b548a..bff5249 100644 --- a/mod.json +++ b/mod.json @@ -1,6 +1,6 @@ { "geode": "4.0.1", - "version": "6.10.0-alpha.1", + "version": "6.10.0-alpha.2", "gd": { "win": "2.2074", "mac": "2.2074", diff --git a/src/features/ViewTab/ViewTab.cpp b/src/features/ViewTab/ViewTab.cpp index aee7536..533c6ad 100644 --- a/src/features/ViewTab/ViewTab.cpp +++ b/src/features/ViewTab/ViewTab.cpp @@ -248,12 +248,21 @@ struct $modify(ViewTabUI, EditorUI) { btns->addObject(this->createViewToggleGV("v_dur_line.png"_spr, "0058")); btns->addObject(this->createViewToggleGV("v_eff_line.png"_spr, "0043")); - if (be::isProEnabled()) { - btns->addObject(this->createViewToggleMSV("v_indicators.png"_spr, "show-trigger-indicators", true)); - // todo: disable this if show-trigger-indicators is disabled - btns->addObject(this->createViewToggleMSV("v_indicators_all.png"_spr, "show-all-trigger-indicators")); + auto indAllToggle = this->createViewToggleMSV("v_indicators_all.png"_spr, "show-all-trigger-indicators"); + auto indToggle = this->createViewToggleMSV( + "v_indicators.png"_spr, "show-trigger-indicators", be::isProEnabled(), + [indAllToggle](bool enabled) { + be::enableToggle(indAllToggle, enabled); + } + ); + btns->addObject(indToggle); + btns->addObject(indAllToggle); + + // todo: add popup explaining why they're not available + if (!be::isProEnabled()) { + be::enableToggle(indToggle, false); + be::enableToggle(indAllToggle, false); } - // todo: show trigger indicators as disabled for non-pro users btns->addObject(this->createViewToggleGV("v_ground.png"_spr, "0037", [this](bool enable) { m_editorLayer->m_groundLayer->setVisible(enable); diff --git a/src/utils/Editor.cpp b/src/utils/Editor.cpp index 64f945e..ea384ad 100644 --- a/src/utils/Editor.cpp +++ b/src/utils/Editor.cpp @@ -266,3 +266,18 @@ void be::tintObject(GameObject* obj, std::optional const& color) { lel->m_fields->tinted.erase(obj); } } + +void be::enableButton(CCMenuItemSpriteExtra* btn, bool enabled) { + btn->setEnabled(enabled); + if (auto spr = typeinfo_cast(btn->getNormalImage())) { + spr->setCascadeColorEnabled(true); + spr->setCascadeOpacityEnabled(true); + spr->setColor(enabled ? ccWHITE : ccGRAY); + spr->setOpacity(enabled ? 255 : 200); + } +} +void be::enableToggle(CCMenuItemToggler* toggle, bool enabled) { + toggle->setEnabled(enabled); + be::enableButton(toggle->m_onButton, enabled); + be::enableButton(toggle->m_offButton, enabled); +} diff --git a/src/utils/Editor.hpp b/src/utils/Editor.hpp index 1c3f8a7..cb916a4 100644 --- a/src/utils/Editor.hpp +++ b/src/utils/Editor.hpp @@ -30,6 +30,9 @@ namespace be { * Color an object like selecting (without changing its actual color) */ void tintObject(GameObject* obj, std::optional const& color); + + void enableButton(CCMenuItemSpriteExtra* btn, bool enabled); + void enableToggle(CCMenuItemToggler* toggle, bool enabled); } //// More EditCommand options