summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRedworkDE <10944644+RedworkDE@users.noreply.github.com>2023-03-09 17:07:39 +0100
committerYuri Sizov <yuris@humnom.net>2023-03-27 17:21:29 +0200
commitc0c5bdc510ce8d29193f6455f59afc27ab691f30 (patch)
tree26abc480d6f8728d93c70407a29c68f6827cb8b8 /scene
parent516323f4ab139f07c9a46bb35ebb71dc3df5509b (diff)
Add dedicated setter for `ImageTextureLayered::_images` to fix `create_from_images` being hidden from the C# bindings
(cherry picked from commit f54014807291bde72ed5781be42460a820ea68b8)
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/texture.cpp7
-rw-r--r--scene/resources/texture.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 651bad1aa7..282c531555 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -2935,6 +2935,10 @@ TypedArray<Image> ImageTextureLayered::_get_images() const {
return images;
}
+void ImageTextureLayered::_set_images(const TypedArray<Image> &p_images) {
+ ERR_FAIL_COND(_create_from_images(p_images) != OK);
+}
+
Error ImageTextureLayered::create_from_images(Vector<Ref<Image>> 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 7c4d479da8..50bcec58f6 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<Image> &p_images);
TypedArray<Image> _get_images() const;
+ void _set_images(const TypedArray<Image> &p_images);
protected:
static void _bind_methods();