Skip to content
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
10 changes: 10 additions & 0 deletions addons/io_scene_gltf2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,15 @@ class ImportGLTF2(Operator, ConvertGLTF2_Base, ImportHelper):
default=False,
)

import_ktx_texture: BoolProperty(
name='Import KTX Textures',
description=(
"If a texture exists in KTX format, "
"loads the KTX texture instead of the fallback PNG/JPEG one"
),
default=False,
)

import_unused_materials: BoolProperty(
name='Import Unused Materials & Images',
description='Import materials & Images not assigned to any mesh',
Expand Down Expand Up @@ -2129,6 +2138,7 @@ def import_texture_panel(layout, operator):
if body:
body.prop(operator, 'import_pack_images')
body.prop(operator, 'import_webp_texture')
body.prop(operator, 'import_ktx_texture')
body.prop(operator, 'import_unused_materials')


Expand Down
9 changes: 8 additions & 1 deletion addons/io_scene_gltf2/blender/imp/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,17 @@ def get_source(mh, pytexture):
except Exception:
webp_src = None

try:
ktx_src = pytexture.extensions['KHR_texture_basisu']['source']
except Exception:
ktx_src = None

if mh.gltf.import_settings['import_webp_texture']:
return webp_src if webp_src is not None else src
elif mh.gltf.import_settings['import_ktx_texture']:
return ktx_src if ktx_src is not None else src
else:
return src if src is not None else webp_src
return src if src is not None else webp_src if webp_src is not None else ktx_src


def set_filtering(tex_img, pysampler):
Expand Down
1 change: 1 addition & 0 deletions addons/io_scene_gltf2/io/imp/gltf2_io_gltf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self, filename, import_settings):
'KHR_animation_pointer',
'KHR_materials_volume',
'EXT_texture_webp',
"KHR_texture_basisu",
'KHR_materials_anisotropy',
'KHR_materials_dispersion',
'KHR_materials_iridescence',
Expand Down
Loading