X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport_material.py;h=617a683f9628ffcbde9e69d5adbd9333efd5452b;hb=27ba68e3d81098c59b7114a8f54996278c05e4ef;hp=792ab2903576ba4a10518fef480c06cb5cc49ac9;hpb=3e4e6a2c15b5a61f6e713e12290cd10e82b20513;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export_material.py b/blender/io_mspgl/export_material.py index 792ab290..617a683f 100644 --- a/blender/io_mspgl/export_material.py +++ b/blender/io_mspgl/export_material.py @@ -1,8 +1,7 @@ import os def create_technique_resource(material, resources): - # This operates on a Blender material, not a custom object - from .datafile import Resource, Statement + from .datafile import Resource, Statement, Token tech_res = Resource(material.name+".tech", "technique") mat_res = resources[material.name+".mat"] @@ -26,19 +25,21 @@ def create_technique_resource(material, resources): tech_res.statements.append(st) else: - st = Statement("method", "") + base_method = "blended" if material.blended else "" + st = Statement("method", base_method) if mat_res: st.sub.append(tech_res.create_embed_statement("material", mat_res)) - if material.render_mode!='CUSTOM': - if material.receive_shadows: - st.sub.append(Statement("receive_shadows", True)) - if material.image_based_lighting: - st.sub.append(Statement("image_based_lighting", True)) + if material.blended: + ss.sub.append(Statement("blend", Token("SRC_ALPHA"), Token("ONE_MINUS_SRC_ALPHA"))) + if material.receive_shadows: + st.sub.append(Statement("receive_shadows", True)) + if material.image_based_lighting: + st.sub.append(Statement("image_based_lighting", True)) tech_res.statements.append(st) - if material.shadow_method!='NONE': + if material.cast_shadows: st = Statement("method", "shadow") st.sub.append(Statement("shader", "occluder.glsl.shader")) tech_res.statements.append(st) @@ -56,7 +57,8 @@ class MaterialExporter: sampler_export = SamplerExporter() from .material import Material - material = Material(material) + if type(material)!=Material: + material = Material(material) for p in material.properties: if p.texture: @@ -76,6 +78,10 @@ class MaterialExporter: resources[mat_name] = None def export_technique(self, material, resources): + from .material import Material + if type(material)!=Material: + material = Material(material) + return create_technique_resource(material, resources) def export_material(self, material, resources):