diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-20 10:32:26 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-20 10:32:26 +0100 |
commit | f1f6b35b8c840eff55fe5f2b6373f89a6c410fcb (patch) | |
tree | 841a94f1bc76fa75c2d235c9540cfb19f6e05fed /scene/2d | |
parent | 63af5a4cdd2dee691612a6e763bd1b1dba0af5ed (diff) | |
parent | 0572346985eef45123a0f25cbd7c295e06bd9097 (diff) |
Merge pull request #70244 from DarkKilauea/nav-fix-abbrev-compat
[4.x] Fix typo and ensure backwards compatibility for changed property names
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/navigation_region_2d.cpp | 19 | ||||
-rw-r--r-- | scene/2d/navigation_region_2d.h | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index e030628110..675ef7c780 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_region_2d.cpp @@ -309,6 +309,25 @@ void NavigationRegion2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "travel_cost"), "set_travel_cost", "get_travel_cost"); } +#ifndef DISABLE_DEPRECATED +// Compatibility with earlier 4.0 betas. +bool NavigationRegion2D::_set(const StringName &p_name, const Variant &p_value) { + if (p_name == "navpoly") { + set_navigation_polygon(p_value); + return true; + } + return false; +} + +bool NavigationRegion2D::_get(const StringName &p_name, Variant &r_ret) const { + if (p_name == "navpoly") { + r_ret = get_navigation_polygon(); + return true; + } + return false; +} +#endif // DISABLE_DEPRECATED + NavigationRegion2D::NavigationRegion2D() { set_notify_transform(true); diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h index 216e6088bc..45029fd95f 100644 --- a/scene/2d/navigation_region_2d.h +++ b/scene/2d/navigation_region_2d.h @@ -50,6 +50,11 @@ protected: void _notification(int p_what); static void _bind_methods(); +#ifndef DISABLE_DEPRECATED + bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_name, Variant &r_ret) const; +#endif // DISABLE_DEPRECATED + public: #ifdef TOOLS_ENABLED virtual Rect2 _edit_get_rect() const override; |