From f54014807291bde72ed5781be42460a820ea68b8 Mon Sep 17 00:00:00 2001 From: RedworkDE <10944644+RedworkDE@users.noreply.github.com> Date: Thu, 9 Mar 2023 17:07:39 +0100 Subject: [PATCH] Add dedicated setter for `ImageTextureLayered::_images` to fix `create_from_images` being hidden from the C# bindings --- scene/resources/texture.cpp | 7 ++++++- scene/resources/texture.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 651bad1aa71..282c531555f 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -2935,6 +2935,10 @@ TypedArray ImageTextureLayered::_get_images() const { return images; } +void ImageTextureLayered::_set_images(const TypedArray &p_images) { + ERR_FAIL_COND(_create_from_images(p_images) != OK); +} + Error ImageTextureLayered::create_from_images(Vector> p_images) { int new_layers = p_images.size(); ERR_FAIL_COND_V(new_layers == 0, ERR_INVALID_PARAMETER); @@ -3014,8 +3018,9 @@ void ImageTextureLayered::_bind_methods() { ClassDB::bind_method(D_METHOD("update_layer", "image", "layer"), &ImageTextureLayered::update_layer); ClassDB::bind_method(D_METHOD("_get_images"), &ImageTextureLayered::_get_images); + ClassDB::bind_method(D_METHOD("_set_images", "images"), &ImageTextureLayered::_set_images); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_images", PROPERTY_HINT_ARRAY_TYPE, "Image", PROPERTY_USAGE_INTERNAL), "create_from_images", "_get_images"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_images", PROPERTY_HINT_ARRAY_TYPE, "Image", PROPERTY_USAGE_INTERNAL), "_set_images", "_get_images"); } ImageTextureLayered::ImageTextureLayered(LayeredType p_layered_type) { diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 7c4d479da8a..50bcec58f6e 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -427,6 +427,7 @@ class ImageTextureLayered : public TextureLayered { Error _create_from_images(const TypedArray &p_images); TypedArray _get_images() const; + void _set_images(const TypedArray &p_images); protected: static void _bind_methods();