If a generator expression produces no items, trying to access __next__()
produces a StopIteration exception. It's better to create a list so we
can check if it's empty.
if ss:
st.sub.append(ss)
if self.use_textures:
- first_tex = (p.texture for p in material.properties if p.texture).__next__()
- if first_tex and not first_tex.default_filter:
+ textures = [p.texture for p in material.properties if p.texture]
+ if textures and not textures[0].default_filter:
from .export_texture import SamplerExporter
sampler_export = SamplerExporter()
- st.sub.append(mat_res.create_reference_statement("sampler", resources[sampler_export.get_sampler_name(first_tex)]))
+ st.sub.append(mat_res.create_reference_statement("sampler", resources[sampler_export.get_sampler_name(textures[0])]))
mat_res.statements.append(st)
return mat_res