X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport_material.py;h=1df5347098571a3a84d25db46f1df91c3626d229;hp=41ed287bd3ab1c154ad146c2d760053ff9340455;hb=401f74574e55fd9e490eaa4f16f1cc97d0603513;hpb=2bf5645d38492c5ef829478f3e04e78f31802fe6 diff --git a/blender/io_mspgl/export_material.py b/blender/io_mspgl/export_material.py index 41ed287b..1df53470 100644 --- a/blender/io_mspgl/export_material.py +++ b/blender/io_mspgl/export_material.py @@ -40,7 +40,7 @@ class MaterialExporter: material = Material(material) if self.use_textures: - for p in material.properties.values(): + for p in material.properties: if p.texture: tex_name = p.texture.image.name+".tex2d" if tex_name not in resources: @@ -68,12 +68,12 @@ class MaterialExporter: raise Exception("Can't export unknown material type "+material.type) st = Statement(material.type) - for kw, p in material.properties.items(): - ss = self.create_property_statement(mat_res, p, kw, resources) + for p in material.properties: + ss = self.create_property_statement(mat_res, p, resources) if ss: st.sub.append(ss) if self.use_textures: - first_tex = (p.texture for p in material.properties.values() if p.texture).__next__() + first_tex = (p.texture for p in material.properties if p.texture).__next__() if first_tex and not first_tex.default_filter: from .export_texture import SamplerExporter sampler_export = SamplerExporter() @@ -82,22 +82,22 @@ class MaterialExporter: return mat_res - def create_property_statement(self, mat_res, prop, keyword, resources): + def create_property_statement(self, mat_res, prop, resources): from .datafile import Statement if self.use_textures and prop.texture: tex_res = resources[prop.texture.image.name+".tex2d"] from .util import basename fn = basename(prop.texture.image.filepath) if prop.texture.default_filter and fn: - return Statement(keyword+"_map", fn) + return Statement(prop.tex_keyword, fn) else: - return mat_res.create_reference_statement(keyword+"_map", tex_res) - elif prop.value is None: + return mat_res.create_reference_statement(prop.tex_keyword, tex_res) + elif not prop.keyword: return elif type(prop.value)==tuple: - return Statement(keyword, *prop.value) + return Statement(prop.keyword, *prop.value) else: - return Statement(keyword, prop.value) + return Statement(prop.keyword, prop.value) class MaterialMapExporter: