]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_object.py
Add an object property for inheriting the specified technique
[libs/gl.git] / blender / io_mspgl / export_object.py
index 00410a23ff0d071ea9b500967f406ef1daed2393..a12474af94bbfe5505a0d7e8d2fd016b1774aebf 100644 (file)
@@ -50,7 +50,20 @@ class ObjectExporter:
                        out_file.end()
 
                if self.external_tech and obj.technique:
-                       out_file.write("technique", '"{}"'.format(obj.technique))
+                       if obj.inherit_tech and mesh.materials[0].texture_slots:
+                               out_file.begin("technique")
+                               out_file.begin("inherit", '"{}"'.format(obj.technique))
+                               for slot in mesh.materials[0].texture_slots:
+                                       if slot and slot.texture.type=="IMAGE":
+                                               name = image_name(slot.texture.image)
+                                               if slot.use_map_color_diffuse:
+                                                       out_file.write("texture", '"diffuse_map"', '"{}"'.format(name))
+                                               elif slot.use_map_normal:
+                                                       out_file.write("texture", '"normal_map"', '"{}"'.format(name))
+                               out_file.end()
+                               out_file.end()
+                       else:
+                               out_file.write("technique", '"{}"'.format(obj.technique))
                elif self.separate_tech:
                        path, base = os.path.split(out_file.filename)
                        if self.shared_tech and mesh.materials: