@@ -27,7 +27,7 @@ namespace devtools {
2727 template <typename T>
2828 concept UnderlyingIntegral = std::is_integral_v<T> || std::is_integral_v<std::underlying_type_t <T>>;
2929
30- struct RegisterNodeEvent final : geode::Event<RegisterNodeEvent, bool (geode::Function<void (cocos2d::CCNode*)>)> {
30+ struct RegisterNodeEvent final : geode::Event<RegisterNodeEvent, bool (geode::Function<void (cocos2d::CCNode*)>& )> {
3131 using Event::Event;
3232 };
3333
@@ -49,6 +49,10 @@ namespace devtools {
4949 return geode::Loader::get ()->getLoadedMod (" geode.devtools" ) != nullptr ;
5050 }
5151
52+ // / @brief Checks if DevTools is currently open.
53+ // / @return True if DevTools is open, false otherwise.
54+ inline bool isOpen () GEODE_EVENT_EXPORT_NORES(&isOpen, ());
55+
5256 // / @brief Waits for DevTools to be loaded and then calls the provided callback.
5357 // / @param callback The function to call once DevTools is loaded.
5458 template <typename F>
@@ -72,11 +76,13 @@ namespace devtools {
7276 // / @see `devtools::property`, `devtools::label`, `devtools::enumerable`, `devtools::button`
7377 template <typename T, std::invocable<std::remove_pointer_t <T>*> F> requires IsCCNode<T>
7478 void registerNode (F&& callback) {
75- RegisterNodeEvent (). send ( [callback = std::forward<F>(callback)](cocos2d::CCNode* node) {
79+ geode::Function< void (cocos2d::CCNode*)> func = [callback = std::forward<F>(callback)](cocos2d::CCNode* node) {
7680 if (auto casted = geode::cast::typeinfo_cast<std::remove_pointer_t <T>*>(node)) {
7781 callback (casted);
7882 }
79- });
83+ };
84+
85+ RegisterNodeEvent ().send (func);
8086 }
8187
8288 // / @brief Renders a property editor for the given value in the DevTools UI.
0 commit comments