]> git.tdb.fi Git - libs/gl.git/commitdiff
Add blend statement also with custom shaders
authorMikko Rasa <tdb@tdb.fi>
Sat, 16 Oct 2021 12:51:11 +0000 (15:51 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 16 Oct 2021 16:03:01 +0000 (19:03 +0300)
blender/io_mspgl/export_material.py

index 617a683f9628ffcbde9e69d5adbd9333efd5452b..6a194dfbe59e5352a79a3d2f6344c5970e72fbd8 100644 (file)
@@ -6,12 +6,19 @@ def create_technique_resource(material, resources):
 
        mat_res = resources[material.name+".mat"]
 
+       blend_st = None
+       if material.blended:
+               blend_st = Statement("blend", Token("SRC_ALPHA"), Token("ONE_MINUS_SRC_ALPHA"))
+
        if material.render_mode=='CUSTOM':
                for m in material.render_methods:
                        st = Statement("method", m.tag)
                        if mat_res and m.use_material:
                                st.sub.append(tech_res.create_reference_statement("material", mat_res))
 
+                       if m.tag=="blended" and blend_st:
+                               st.sub.append(blend_st)
+
                        shader = m.shader
                        if shader.endswith(".glsl"):
                                shader += ".shader"
@@ -30,8 +37,8 @@ def create_technique_resource(material, resources):
                if mat_res:
                        st.sub.append(tech_res.create_embed_statement("material", mat_res))
 
-               if material.blended:
-                       ss.sub.append(Statement("blend", Token("SRC_ALPHA"), Token("ONE_MINUS_SRC_ALPHA")))
+               if blend_st:
+                       st.sub.append(blend_st)
                if material.receive_shadows:
                        st.sub.append(Statement("receive_shadows", True))
                if material.image_based_lighting: