Replace BIND_VMETHOD by new GDVIRTUAL syntax
* New syntax is type safe. * New syntax allows for type safe virtuals in native extensions. * New syntax permits extremely fast calling. Note: Everything was replaced where possible except for `_gui_input` `_input` and `_unhandled_input`. These will require API rework on a separate PR as they work different than the rest of the functions. Added a new method flag METHOD_FLAG_OBJECT_CORE, used internally. Allows to not dump the core virtuals like `_notification` to the json API, since each language will implement those as it is best fits.
This commit is contained in:
@@ -121,17 +121,13 @@ void BaseButton::_notification(int p_what) {
|
||||
}
|
||||
|
||||
void BaseButton::_pressed() {
|
||||
if (get_script_instance()) {
|
||||
get_script_instance()->call(SceneStringNames::get_singleton()->_pressed);
|
||||
}
|
||||
GDVIRTUAL_CALL(_pressed);
|
||||
pressed();
|
||||
emit_signal(SNAME("pressed"));
|
||||
}
|
||||
|
||||
void BaseButton::_toggled(bool p_pressed) {
|
||||
if (get_script_instance()) {
|
||||
get_script_instance()->call(SceneStringNames::get_singleton()->_toggled, p_pressed);
|
||||
}
|
||||
GDVIRTUAL_CALL(_toggled, p_pressed);
|
||||
toggled(p_pressed);
|
||||
emit_signal(SNAME("toggled"), p_pressed);
|
||||
}
|
||||
@@ -440,8 +436,8 @@ void BaseButton::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_shortcut_context", "node"), &BaseButton::set_shortcut_context);
|
||||
ClassDB::bind_method(D_METHOD("get_shortcut_context"), &BaseButton::get_shortcut_context);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_pressed"));
|
||||
BIND_VMETHOD(MethodInfo("_toggled", PropertyInfo(Variant::BOOL, "button_pressed")));
|
||||
GDVIRTUAL_BIND(_pressed);
|
||||
GDVIRTUAL_BIND(_toggled, "button_pressed");
|
||||
|
||||
ADD_SIGNAL(MethodInfo("pressed"));
|
||||
ADD_SIGNAL(MethodInfo("button_up"));
|
||||
|
||||
Reference in New Issue
Block a user