base_button.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. /**************************************************************************/
  2. /* base_button.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "base_button.h"
  31. #include "core/config/project_settings.h"
  32. #include "scene/gui/label.h"
  33. #include "scene/main/window.h"
  34. void BaseButton::_unpress_group() {
  35. if (button_group.is_null()) {
  36. return;
  37. }
  38. if (toggle_mode && !button_group->is_allow_unpress()) {
  39. status.pressed = true;
  40. }
  41. for (BaseButton *E : button_group->buttons) {
  42. if (E == this) {
  43. continue;
  44. }
  45. E->set_pressed(false);
  46. }
  47. }
  48. void BaseButton::gui_input(const Ref<InputEvent> &p_event) {
  49. ERR_FAIL_COND(p_event.is_null());
  50. if (status.disabled) { // no interaction with disabled button
  51. return;
  52. }
  53. Ref<InputEventMouseButton> mouse_button = p_event;
  54. bool ui_accept = p_event->is_action("ui_accept", true) && !p_event->is_echo();
  55. bool button_masked = mouse_button.is_valid() && button_mask.has_flag(mouse_button_to_mask(mouse_button->get_button_index()));
  56. if (button_masked || ui_accept) {
  57. was_mouse_pressed = button_masked;
  58. on_action_event(p_event);
  59. was_mouse_pressed = false;
  60. return;
  61. }
  62. Ref<InputEventMouseMotion> mouse_motion = p_event;
  63. if (mouse_motion.is_valid()) {
  64. if (status.press_attempt) {
  65. bool last_press_inside = status.pressing_inside;
  66. status.pressing_inside = has_point(mouse_motion->get_position());
  67. if (last_press_inside != status.pressing_inside) {
  68. queue_redraw();
  69. }
  70. }
  71. }
  72. }
  73. void BaseButton::_notification(int p_what) {
  74. switch (p_what) {
  75. case NOTIFICATION_MOUSE_ENTER: {
  76. status.hovering = true;
  77. queue_redraw();
  78. } break;
  79. case NOTIFICATION_MOUSE_EXIT: {
  80. status.hovering = false;
  81. queue_redraw();
  82. } break;
  83. case NOTIFICATION_DRAG_BEGIN:
  84. case NOTIFICATION_SCROLL_BEGIN: {
  85. if (status.press_attempt) {
  86. status.press_attempt = false;
  87. queue_redraw();
  88. }
  89. } break;
  90. case NOTIFICATION_FOCUS_ENTER: {
  91. queue_redraw();
  92. } break;
  93. case NOTIFICATION_FOCUS_EXIT: {
  94. if (status.press_attempt) {
  95. status.press_attempt = false;
  96. queue_redraw();
  97. } else if (status.hovering) {
  98. queue_redraw();
  99. }
  100. if (status.pressed_down_with_focus) {
  101. status.pressed_down_with_focus = false;
  102. emit_signal(SNAME("button_up"));
  103. }
  104. } break;
  105. case NOTIFICATION_VISIBILITY_CHANGED:
  106. case NOTIFICATION_EXIT_TREE: {
  107. if (p_what == NOTIFICATION_VISIBILITY_CHANGED && is_visible_in_tree()) {
  108. break;
  109. }
  110. if (!toggle_mode) {
  111. status.pressed = false;
  112. }
  113. status.hovering = false;
  114. status.press_attempt = false;
  115. status.pressing_inside = false;
  116. } break;
  117. }
  118. }
  119. void BaseButton::_pressed() {
  120. GDVIRTUAL_CALL(_pressed);
  121. pressed();
  122. emit_signal(SceneStringName(pressed));
  123. }
  124. void BaseButton::_toggled(bool p_pressed) {
  125. GDVIRTUAL_CALL(_toggled, p_pressed);
  126. toggled(p_pressed);
  127. emit_signal(SceneStringName(toggled), p_pressed);
  128. }
  129. void BaseButton::on_action_event(Ref<InputEvent> p_event) {
  130. Ref<InputEventMouseButton> mouse_button = p_event;
  131. if (p_event->is_pressed() && (mouse_button.is_null() || status.hovering)) {
  132. status.press_attempt = true;
  133. status.pressing_inside = true;
  134. if (!status.pressed_down_with_focus) {
  135. status.pressed_down_with_focus = true;
  136. emit_signal(SNAME("button_down"));
  137. }
  138. }
  139. if (status.press_attempt && status.pressing_inside) {
  140. if (toggle_mode) {
  141. bool is_pressed = p_event->is_pressed();
  142. if ((is_pressed && action_mode == ACTION_MODE_BUTTON_PRESS) || (!is_pressed && action_mode == ACTION_MODE_BUTTON_RELEASE)) {
  143. if (action_mode == ACTION_MODE_BUTTON_PRESS) {
  144. status.press_attempt = false;
  145. status.pressing_inside = false;
  146. }
  147. status.pressed = !status.pressed;
  148. _unpress_group();
  149. if (button_group.is_valid()) {
  150. button_group->emit_signal(SceneStringName(pressed), this);
  151. }
  152. _toggled(status.pressed);
  153. _pressed();
  154. }
  155. } else {
  156. if ((p_event->is_pressed() && action_mode == ACTION_MODE_BUTTON_PRESS) || (!p_event->is_pressed() && action_mode == ACTION_MODE_BUTTON_RELEASE)) {
  157. _pressed();
  158. }
  159. }
  160. }
  161. if (!p_event->is_pressed()) {
  162. status.press_attempt = false;
  163. status.pressing_inside = false;
  164. if (status.pressed_down_with_focus) {
  165. status.pressed_down_with_focus = false;
  166. emit_signal(SNAME("button_up"));
  167. }
  168. }
  169. queue_redraw();
  170. }
  171. void BaseButton::pressed() {
  172. }
  173. void BaseButton::toggled(bool p_pressed) {
  174. }
  175. void BaseButton::set_disabled(bool p_disabled) {
  176. if (status.disabled == p_disabled) {
  177. return;
  178. }
  179. status.disabled = p_disabled;
  180. if (p_disabled) {
  181. if (!toggle_mode) {
  182. status.pressed = false;
  183. }
  184. status.press_attempt = false;
  185. status.pressing_inside = false;
  186. }
  187. queue_redraw();
  188. update_minimum_size();
  189. }
  190. bool BaseButton::is_disabled() const {
  191. return status.disabled;
  192. }
  193. void BaseButton::set_pressed(bool p_pressed) {
  194. bool prev_pressed = status.pressed;
  195. set_pressed_no_signal(p_pressed);
  196. if (status.pressed == prev_pressed) {
  197. return;
  198. }
  199. if (p_pressed) {
  200. _unpress_group();
  201. if (button_group.is_valid()) {
  202. button_group->emit_signal(SceneStringName(pressed), this);
  203. }
  204. }
  205. _toggled(status.pressed);
  206. }
  207. void BaseButton::set_pressed_no_signal(bool p_pressed) {
  208. if (!toggle_mode) {
  209. return;
  210. }
  211. if (status.pressed == p_pressed) {
  212. return;
  213. }
  214. status.pressed = p_pressed;
  215. queue_redraw();
  216. }
  217. bool BaseButton::is_pressing() const {
  218. return status.press_attempt;
  219. }
  220. bool BaseButton::is_pressed() const {
  221. return toggle_mode ? status.pressed : status.press_attempt;
  222. }
  223. bool BaseButton::is_hovered() const {
  224. return status.hovering;
  225. }
  226. BaseButton::DrawMode BaseButton::get_draw_mode() const {
  227. if (status.disabled) {
  228. return DRAW_DISABLED;
  229. }
  230. if (in_shortcut_feedback) {
  231. return DRAW_HOVER_PRESSED;
  232. }
  233. if (!status.press_attempt && status.hovering) {
  234. if (status.pressed) {
  235. return DRAW_HOVER_PRESSED;
  236. }
  237. return DRAW_HOVER;
  238. } else {
  239. // Determine if pressed or not.
  240. bool pressing;
  241. if (status.press_attempt) {
  242. pressing = (status.pressing_inside || keep_pressed_outside);
  243. if (status.pressed) {
  244. pressing = !pressing;
  245. }
  246. } else {
  247. pressing = status.pressed;
  248. }
  249. if (pressing) {
  250. return DRAW_PRESSED;
  251. } else {
  252. return DRAW_NORMAL;
  253. }
  254. }
  255. }
  256. void BaseButton::set_toggle_mode(bool p_on) {
  257. // Make sure to set 'pressed' to false if we are not in toggle mode
  258. if (!p_on) {
  259. set_pressed(false);
  260. }
  261. toggle_mode = p_on;
  262. update_configuration_warnings();
  263. }
  264. bool BaseButton::is_toggle_mode() const {
  265. return toggle_mode;
  266. }
  267. void BaseButton::set_shortcut_in_tooltip(bool p_on) {
  268. shortcut_in_tooltip = p_on;
  269. }
  270. bool BaseButton::is_shortcut_in_tooltip_enabled() const {
  271. return shortcut_in_tooltip;
  272. }
  273. void BaseButton::set_action_mode(ActionMode p_mode) {
  274. action_mode = p_mode;
  275. }
  276. BaseButton::ActionMode BaseButton::get_action_mode() const {
  277. return action_mode;
  278. }
  279. void BaseButton::set_button_mask(BitField<MouseButtonMask> p_mask) {
  280. button_mask = p_mask;
  281. }
  282. BitField<MouseButtonMask> BaseButton::get_button_mask() const {
  283. return button_mask;
  284. }
  285. void BaseButton::set_keep_pressed_outside(bool p_on) {
  286. keep_pressed_outside = p_on;
  287. }
  288. bool BaseButton::is_keep_pressed_outside() const {
  289. return keep_pressed_outside;
  290. }
  291. void BaseButton::set_shortcut_feedback(bool p_enable) {
  292. shortcut_feedback = p_enable;
  293. }
  294. bool BaseButton::is_shortcut_feedback() const {
  295. return shortcut_feedback;
  296. }
  297. void BaseButton::set_shortcut(const Ref<Shortcut> &p_shortcut) {
  298. shortcut = p_shortcut;
  299. set_process_shortcut_input(shortcut.is_valid());
  300. }
  301. Ref<Shortcut> BaseButton::get_shortcut() const {
  302. return shortcut;
  303. }
  304. void BaseButton::_shortcut_feedback_timeout() {
  305. in_shortcut_feedback = false;
  306. queue_redraw();
  307. }
  308. void BaseButton::shortcut_input(const Ref<InputEvent> &p_event) {
  309. ERR_FAIL_COND(p_event.is_null());
  310. if (!is_disabled() && p_event->is_pressed() && is_visible_in_tree() && !p_event->is_echo() && shortcut.is_valid() && shortcut->matches_event(p_event)) {
  311. if (toggle_mode) {
  312. status.pressed = !status.pressed;
  313. _unpress_group();
  314. if (button_group.is_valid()) {
  315. button_group->emit_signal(SceneStringName(pressed), this);
  316. }
  317. _toggled(status.pressed);
  318. _pressed();
  319. } else {
  320. _pressed();
  321. }
  322. queue_redraw();
  323. accept_event();
  324. if (shortcut_feedback && is_inside_tree()) {
  325. if (shortcut_feedback_timer == nullptr) {
  326. shortcut_feedback_timer = memnew(Timer);
  327. shortcut_feedback_timer->set_one_shot(true);
  328. add_child(shortcut_feedback_timer);
  329. shortcut_feedback_timer->set_wait_time(GLOBAL_GET("gui/timers/button_shortcut_feedback_highlight_time"));
  330. shortcut_feedback_timer->connect("timeout", callable_mp(this, &BaseButton::_shortcut_feedback_timeout));
  331. }
  332. in_shortcut_feedback = true;
  333. shortcut_feedback_timer->start();
  334. }
  335. }
  336. }
  337. Control *BaseButton::make_custom_tooltip(const String &p_text) const {
  338. Control *control = Control::make_custom_tooltip(p_text);
  339. if (control) {
  340. return control;
  341. }
  342. if (!shortcut_in_tooltip || shortcut.is_null() || !shortcut->has_valid_event()) {
  343. return nullptr; // Use the default tooltip label.
  344. }
  345. String text = atr(shortcut->get_name()) + " (" + shortcut->get_as_text() + ")";
  346. if (!p_text.is_empty() && shortcut->get_name().nocasecmp_to(p_text) != 0) {
  347. text += "\n" + atr(p_text);
  348. }
  349. // Make a label similar to the default tooltip label.
  350. // Auto translation is disabled because we already did that manually above.
  351. //
  352. // We can't customize the tooltip text by overriding `get_tooltip()`
  353. // because otherwise user-defined `_make_custom_tooltip()` would receive
  354. // the translated and annotated text.
  355. Label *label = memnew(Label(text));
  356. label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
  357. label->set_theme_type_variation(SNAME("TooltipLabel"));
  358. return label;
  359. }
  360. void BaseButton::set_button_group(const Ref<ButtonGroup> &p_group) {
  361. if (button_group.is_valid()) {
  362. button_group->buttons.erase(this);
  363. }
  364. button_group = p_group;
  365. if (button_group.is_valid()) {
  366. button_group->buttons.insert(this);
  367. }
  368. queue_redraw(); //checkbox changes to radio if set a buttongroup
  369. update_configuration_warnings();
  370. }
  371. Ref<ButtonGroup> BaseButton::get_button_group() const {
  372. return button_group;
  373. }
  374. bool BaseButton::_was_pressed_by_mouse() const {
  375. return was_mouse_pressed;
  376. }
  377. PackedStringArray BaseButton::get_configuration_warnings() const {
  378. PackedStringArray warnings = Control::get_configuration_warnings();
  379. if (get_button_group().is_valid() && !is_toggle_mode()) {
  380. warnings.push_back(RTR("ButtonGroup is intended to be used only with buttons that have toggle_mode set to true."));
  381. }
  382. return warnings;
  383. }
  384. void BaseButton::_bind_methods() {
  385. ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &BaseButton::set_pressed);
  386. ClassDB::bind_method(D_METHOD("is_pressed"), &BaseButton::is_pressed);
  387. ClassDB::bind_method(D_METHOD("set_pressed_no_signal", "pressed"), &BaseButton::set_pressed_no_signal);
  388. ClassDB::bind_method(D_METHOD("is_hovered"), &BaseButton::is_hovered);
  389. ClassDB::bind_method(D_METHOD("set_toggle_mode", "enabled"), &BaseButton::set_toggle_mode);
  390. ClassDB::bind_method(D_METHOD("is_toggle_mode"), &BaseButton::is_toggle_mode);
  391. ClassDB::bind_method(D_METHOD("set_shortcut_in_tooltip", "enabled"), &BaseButton::set_shortcut_in_tooltip);
  392. ClassDB::bind_method(D_METHOD("is_shortcut_in_tooltip_enabled"), &BaseButton::is_shortcut_in_tooltip_enabled);
  393. ClassDB::bind_method(D_METHOD("set_disabled", "disabled"), &BaseButton::set_disabled);
  394. ClassDB::bind_method(D_METHOD("is_disabled"), &BaseButton::is_disabled);
  395. ClassDB::bind_method(D_METHOD("set_action_mode", "mode"), &BaseButton::set_action_mode);
  396. ClassDB::bind_method(D_METHOD("get_action_mode"), &BaseButton::get_action_mode);
  397. ClassDB::bind_method(D_METHOD("set_button_mask", "mask"), &BaseButton::set_button_mask);
  398. ClassDB::bind_method(D_METHOD("get_button_mask"), &BaseButton::get_button_mask);
  399. ClassDB::bind_method(D_METHOD("get_draw_mode"), &BaseButton::get_draw_mode);
  400. ClassDB::bind_method(D_METHOD("set_keep_pressed_outside", "enabled"), &BaseButton::set_keep_pressed_outside);
  401. ClassDB::bind_method(D_METHOD("is_keep_pressed_outside"), &BaseButton::is_keep_pressed_outside);
  402. ClassDB::bind_method(D_METHOD("set_shortcut_feedback", "enabled"), &BaseButton::set_shortcut_feedback);
  403. ClassDB::bind_method(D_METHOD("is_shortcut_feedback"), &BaseButton::is_shortcut_feedback);
  404. ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut"), &BaseButton::set_shortcut);
  405. ClassDB::bind_method(D_METHOD("get_shortcut"), &BaseButton::get_shortcut);
  406. ClassDB::bind_method(D_METHOD("set_button_group", "button_group"), &BaseButton::set_button_group);
  407. ClassDB::bind_method(D_METHOD("get_button_group"), &BaseButton::get_button_group);
  408. GDVIRTUAL_BIND(_pressed);
  409. GDVIRTUAL_BIND(_toggled, "toggled_on");
  410. ADD_SIGNAL(MethodInfo("pressed"));
  411. ADD_SIGNAL(MethodInfo("button_up"));
  412. ADD_SIGNAL(MethodInfo("button_down"));
  413. ADD_SIGNAL(MethodInfo("toggled", PropertyInfo(Variant::BOOL, "toggled_on")));
  414. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled");
  415. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toggle_mode"), "set_toggle_mode", "is_toggle_mode");
  416. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "button_pressed"), "set_pressed", "is_pressed");
  417. ADD_PROPERTY(PropertyInfo(Variant::INT, "action_mode", PROPERTY_HINT_ENUM, "Button Press,Button Release"), "set_action_mode", "get_action_mode");
  418. ADD_PROPERTY(PropertyInfo(Variant::INT, "button_mask", PROPERTY_HINT_FLAGS, "Mouse Left, Mouse Right, Mouse Middle"), "set_button_mask", "get_button_mask");
  419. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_pressed_outside"), "set_keep_pressed_outside", "is_keep_pressed_outside");
  420. ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "button_group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group");
  421. ADD_GROUP("Shortcut", "");
  422. ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "Shortcut"), "set_shortcut", "get_shortcut");
  423. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shortcut_feedback"), "set_shortcut_feedback", "is_shortcut_feedback");
  424. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shortcut_in_tooltip"), "set_shortcut_in_tooltip", "is_shortcut_in_tooltip_enabled");
  425. BIND_ENUM_CONSTANT(DRAW_NORMAL);
  426. BIND_ENUM_CONSTANT(DRAW_PRESSED);
  427. BIND_ENUM_CONSTANT(DRAW_HOVER);
  428. BIND_ENUM_CONSTANT(DRAW_DISABLED);
  429. BIND_ENUM_CONSTANT(DRAW_HOVER_PRESSED);
  430. BIND_ENUM_CONSTANT(ACTION_MODE_BUTTON_PRESS);
  431. BIND_ENUM_CONSTANT(ACTION_MODE_BUTTON_RELEASE);
  432. GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "gui/timers/button_shortcut_feedback_highlight_time", PROPERTY_HINT_RANGE, "0.01,10,0.01,suffix:s"), 0.2);
  433. }
  434. BaseButton::BaseButton() {
  435. set_focus_mode(FOCUS_ALL);
  436. }
  437. BaseButton::~BaseButton() {
  438. if (button_group.is_valid()) {
  439. button_group->buttons.erase(this);
  440. }
  441. }
  442. void ButtonGroup::get_buttons(List<BaseButton *> *r_buttons) {
  443. for (BaseButton *E : buttons) {
  444. r_buttons->push_back(E);
  445. }
  446. }
  447. TypedArray<BaseButton> ButtonGroup::_get_buttons() {
  448. TypedArray<BaseButton> btns;
  449. for (const BaseButton *E : buttons) {
  450. btns.push_back(E);
  451. }
  452. return btns;
  453. }
  454. BaseButton *ButtonGroup::get_pressed_button() {
  455. for (BaseButton *E : buttons) {
  456. if (E->is_pressed()) {
  457. return E;
  458. }
  459. }
  460. return nullptr;
  461. }
  462. void ButtonGroup::set_allow_unpress(bool p_enabled) {
  463. allow_unpress = p_enabled;
  464. }
  465. bool ButtonGroup::is_allow_unpress() {
  466. return allow_unpress;
  467. }
  468. void ButtonGroup::_bind_methods() {
  469. ClassDB::bind_method(D_METHOD("get_pressed_button"), &ButtonGroup::get_pressed_button);
  470. ClassDB::bind_method(D_METHOD("get_buttons"), &ButtonGroup::_get_buttons);
  471. ClassDB::bind_method(D_METHOD("set_allow_unpress", "enabled"), &ButtonGroup::set_allow_unpress);
  472. ClassDB::bind_method(D_METHOD("is_allow_unpress"), &ButtonGroup::is_allow_unpress);
  473. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_unpress"), "set_allow_unpress", "is_allow_unpress");
  474. ADD_SIGNAL(MethodInfo("pressed", PropertyInfo(Variant::OBJECT, "button", PROPERTY_HINT_RESOURCE_TYPE, "BaseButton")));
  475. }
  476. ButtonGroup::ButtonGroup() {
  477. set_local_to_scene(true);
  478. }