diff options
author | kobewi <kobewi4e@gmail.com> | 2023-01-13 19:16:49 +0100 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2023-01-13 19:16:49 +0100 |
commit | 54abd5b56045536b7ef48f6178b2d6a5308edb0f (patch) | |
tree | 00ce4441d52cfef83fcb7de5577589a82f7f417b /scene/gui | |
parent | 228db366bf7eee5cc1623f009d27e88ed80b5d7d (diff) |
Add expand mode compat to TextureRect
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/texture_rect.cpp | 10 | ||||
-rw-r--r-- | scene/gui/texture_rect.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index 5a3f4af106..20472ab46e 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -178,6 +178,16 @@ void TextureRect::_bind_methods() { BIND_ENUM_CONSTANT(STRETCH_KEEP_ASPECT_COVERED); } +#ifndef DISABLE_DEPRECATED +bool TextureRect::_set(const StringName &p_name, const Variant &p_value) { + if ((p_name == SNAME("expand") || p_name == SNAME("ignore_texture_size")) && p_value.operator bool()) { + expand_mode = EXPAND_IGNORE_SIZE; + return true; + } + return false; +} +#endif + void TextureRect::_texture_changed() { if (texture.is_valid()) { queue_redraw(); diff --git a/scene/gui/texture_rect.h b/scene/gui/texture_rect.h index 6f17ebd87f..2425c6094b 100644 --- a/scene/gui/texture_rect.h +++ b/scene/gui/texture_rect.h @@ -69,6 +69,9 @@ protected: void _notification(int p_what); virtual Size2 get_minimum_size() const override; static void _bind_methods(); +#ifndef DISABLE_DEPRECATED + bool _set(const StringName &p_name, const Variant &p_value); +#endif public: void set_texture(const Ref<Texture2D> &p_tex); |