Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Image::get_mipmap_count() and add GLTFState::get_source_images() #79368

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/io/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3393,6 +3393,7 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_height"), &Image::get_height);
ClassDB::bind_method(D_METHOD("get_size"), &Image::get_size);
ClassDB::bind_method(D_METHOD("has_mipmaps"), &Image::has_mipmaps);
ClassDB::bind_method(D_METHOD("get_mipmap_count"), &Image::get_mipmap_count);
ClassDB::bind_method(D_METHOD("get_format"), &Image::get_format);
ClassDB::bind_method(D_METHOD("get_data"), &Image::get_data);

Expand Down
6 changes: 6 additions & 0 deletions doc/classes/Image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@
Returns the image's height.
</description>
</method>
<method name="get_mipmap_count" qualifiers="const">
<return type="int" />
<description>
Returns the image's number of mipmaps.
</description>
</method>
<method name="get_mipmap_offset" qualifiers="const">
<return type="int" />
<param index="0" name="mipmap" type="int" />
Expand Down
6 changes: 6 additions & 0 deletions modules/gltf/doc_classes/GLTFState.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@
Returns an array of all [GLTFSkin]s in the GLTF file. These are the skins that the [member GLTFNode.skin] index refers to.
</description>
</method>
<method name="get_source_images">
<return type="Image[]" />
<description>
Gets the source images of the GLTF file as an array of [Image]s. These are the images that the [member GLTFTexture.src_image] index refers to.
</description>
</method>
<method name="get_texture_samplers">
<return type="GLTFTextureSampler[]" />
<description>
Expand Down
5 changes: 5 additions & 0 deletions modules/gltf/gltf_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void GLTFState::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture_samplers", "texture_samplers"), &GLTFState::set_texture_samplers);
ClassDB::bind_method(D_METHOD("get_images"), &GLTFState::get_images);
ClassDB::bind_method(D_METHOD("set_images", "images"), &GLTFState::set_images);
ClassDB::bind_method(D_METHOD("get_source_images"), &GLTFState::get_source_images);
ClassDB::bind_method(D_METHOD("get_skins"), &GLTFState::get_skins);
ClassDB::bind_method(D_METHOD("set_skins", "skins"), &GLTFState::set_skins);
ClassDB::bind_method(D_METHOD("get_cameras"), &GLTFState::get_cameras);
Expand Down Expand Up @@ -261,6 +262,10 @@ TypedArray<Texture2D> GLTFState::get_images() {
return GLTFTemplateConvert::to_array(images);
}

TypedArray<Image> GLTFState::get_source_images() {
return GLTFTemplateConvert::to_array(source_images);
}

void GLTFState::set_images(TypedArray<Texture2D> p_images) {
GLTFTemplateConvert::set_from_array(images, p_images);
}
Expand Down
2 changes: 2 additions & 0 deletions modules/gltf/gltf_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ class GLTFState : public Resource {
TypedArray<Texture2D> get_images();
void set_images(TypedArray<Texture2D> p_images);

TypedArray<Image> get_source_images();

TypedArray<GLTFSkin> get_skins();
void set_skins(TypedArray<GLTFSkin> p_skins);

Expand Down