diff options
author | reduz <reduzio@gmail.com> | 2021-06-19 12:58:49 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2021-06-25 17:32:45 -0300 |
commit | b1d15c51bc1ded928b266ffc06459dd8b2046eb4 (patch) | |
tree | 176b9bb1217200cafec3613df6cf8369dcd73dd4 /scene | |
parent | c8444c3ee078e33c33287cf879aa5daecb962a80 (diff) |
Implement native extension system
* Deprecates GDNative in favor of a simpler, lower level interface.
* New extension system allows registering core engine classes.
* Simple header interface in gdnative_interace.h
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/control.cpp | 17 | ||||
-rw-r--r-- | scene/gui/control.h | 2 | ||||
-rw-r--r-- | scene/register_scene_types.cpp | 5 |
3 files changed, 11 insertions, 13 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index a8060615d4..0ae1bb04b7 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -651,19 +651,10 @@ void Control::_notification(int p_notification) { } bool Control::has_point(const Point2 &p_point) const { - if (get_script_instance()) { - Variant v = p_point; - const Variant *p = &v; - Callable::CallError ce; - Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_has_point, &p, 1, ce); - if (ce.error == Callable::CallError::CALL_OK) { - return ret; - } + bool ret; + if (GDVIRTUAL_CALL(_has_point, p_point, ret)) { + return ret; } - /*if (has_stylebox("mask")) { - Ref<StyleBox> mask = get_stylebox("mask"); - return mask->test_mask(p_point,Rect2(Point2(),get_size())); - }*/ return Rect2(Point2(), get_size()).has_point(p_point); } @@ -2932,5 +2923,5 @@ void Control::_bind_methods() { ADD_SIGNAL(MethodInfo("minimum_size_changed")); ADD_SIGNAL(MethodInfo("theme_changed")); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_point", PropertyInfo(Variant::VECTOR2, "point"))); + GDVIRTUAL_BIND(_has_point); } diff --git a/scene/gui/control.h b/scene/gui/control.h index ad6b4136e1..87fad96571 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -32,6 +32,7 @@ #define CONTROL_H #include "core/math/transform_2d.h" +#include "core/object/gdvirtual.gen.inc" #include "core/templates/rid.h" #include "scene/gui/shortcut.h" #include "scene/main/canvas_item.h" @@ -264,6 +265,7 @@ private: static bool has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner_window, Theme::DataType p_data_type, const StringName &p_name, List<StringName> p_theme_types); _FORCE_INLINE_ void _get_theme_type_dependencies(const StringName &p_theme_type, List<StringName> *p_list) const; + GDVIRTUAL1RC(bool, _has_point, Vector2) protected: virtual void add_child_notify(Node *p_child) override; virtual void remove_child_notify(Node *p_child) override; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 3a2b34c6c8..8d0283d536 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -31,6 +31,7 @@ #include "register_scene_types.h" #include "core/config/project_settings.h" +#include "core/extension/native_extension_manager.h" #include "core/object/class_db.h" #include "core/os/os.h" #include "scene/2d/animated_sprite_2d.h" @@ -1040,9 +1041,13 @@ void register_scene_types() { } } SceneDebugger::initialize(); + + NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SCENE); } void unregister_scene_types() { + NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SCENE); + SceneDebugger::deinitialize(); clear_default_theme(); |