ImageTexture.load returns an error code.
This commit is contained in:
parent
81b1d3c846
commit
622a754584
@ -338,6 +338,7 @@
|
|||||||
<argument index="0" name="buffer" type="PoolByteArray">
|
<argument index="0" name="buffer" type="PoolByteArray">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
|
Loads an image from the binary contents of a JPEG file.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="load_png_from_buffer">
|
<method name="load_png_from_buffer">
|
||||||
@ -346,6 +347,7 @@
|
|||||||
<argument index="0" name="buffer" type="PoolByteArray">
|
<argument index="0" name="buffer" type="PoolByteArray">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
|
Loads an image from the binary contents of a PNG file.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="lock">
|
<method name="lock">
|
||||||
|
@ -47,12 +47,12 @@
|
|||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="load">
|
<method name="load">
|
||||||
<return type="void">
|
<return type="int" enum="Error">
|
||||||
</return>
|
</return>
|
||||||
<argument index="0" name="path" type="String">
|
<argument index="0" name="path" type="String">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Load an [code]ImageTexture[/code].
|
Load an [code]ImageTexture[/code] from a file path.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_data">
|
<method name="set_data">
|
||||||
|
@ -220,12 +220,15 @@ Image::Format ImageTexture::get_format() const {
|
|||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageTexture::load(const String &p_path) {
|
Error ImageTexture::load(const String &p_path) {
|
||||||
|
|
||||||
Ref<Image> img;
|
Ref<Image> img;
|
||||||
img.instance();
|
img.instance();
|
||||||
img->load(p_path);
|
Error err = img->load(p_path);
|
||||||
create_from_image(img);
|
if (err == OK) {
|
||||||
|
create_from_image(img);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageTexture::set_data(const Ref<Image> &p_image) {
|
void ImageTexture::set_data(const Ref<Image> &p_image) {
|
||||||
|
@ -124,7 +124,7 @@ public:
|
|||||||
void set_flags(uint32_t p_flags);
|
void set_flags(uint32_t p_flags);
|
||||||
uint32_t get_flags() const;
|
uint32_t get_flags() const;
|
||||||
Image::Format get_format() const;
|
Image::Format get_format() const;
|
||||||
void load(const String &p_path);
|
Error load(const String &p_path);
|
||||||
void set_data(const Ref<Image> &p_image);
|
void set_data(const Ref<Image> &p_image);
|
||||||
Ref<Image> get_data() const;
|
Ref<Image> get_data() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user