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:
@@ -32,8 +32,15 @@
|
||||
|
||||
#include "core/object/script_language.h"
|
||||
|
||||
void RichTextEffect::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_process_custom_fx", PropertyInfo(Variant::OBJECT, "char_fx", PROPERTY_HINT_RESOURCE_TYPE, "CharFXTransform")));
|
||||
CharFXTransform::CharFXTransform() {
|
||||
}
|
||||
|
||||
CharFXTransform::~CharFXTransform() {
|
||||
environment.clear();
|
||||
}
|
||||
|
||||
void RichTextEffect::_bind_methods(){
|
||||
GDVIRTUAL_BIND(_process_custom_fx, "char_fx")
|
||||
}
|
||||
|
||||
Variant RichTextEffect::get_bbcode() const {
|
||||
@@ -49,15 +56,10 @@ Variant RichTextEffect::get_bbcode() const {
|
||||
|
||||
bool RichTextEffect::_process_effect_impl(Ref<CharFXTransform> p_cfx) {
|
||||
bool return_value = false;
|
||||
if (get_script_instance()) {
|
||||
Variant v = get_script_instance()->call("_process_custom_fx", p_cfx);
|
||||
if (v.get_type() != Variant::BOOL) {
|
||||
return_value = false;
|
||||
} else {
|
||||
return_value = (bool)v;
|
||||
}
|
||||
if (GDVIRTUAL_CALL(_process_custom_fx, p_cfx, return_value)) {
|
||||
return return_value;
|
||||
}
|
||||
return return_value;
|
||||
return false;
|
||||
}
|
||||
|
||||
RichTextEffect::RichTextEffect() {
|
||||
@@ -101,10 +103,3 @@ void CharFXTransform::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "glyph_index"), "set_glyph_index", "get_glyph_index");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RID, "font"), "set_font", "get_font");
|
||||
}
|
||||
|
||||
CharFXTransform::CharFXTransform() {
|
||||
}
|
||||
|
||||
CharFXTransform::~CharFXTransform() {
|
||||
environment.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user