From: Mikko Rasa Date: Sat, 29 Oct 2016 17:02:10 +0000 (+0300) Subject: Add properties to export materials as texture array layers X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=1d0b0fcb7ad573053a8730a90f7fb33061038db2;p=libs%2Fgl.git Add properties to export materials as texture array layers --- diff --git a/blender/io_mspgl/export_mesh.py b/blender/io_mspgl/export_mesh.py index 8f868882..1652c1a4 100644 --- a/blender/io_mspgl/export_mesh.py +++ b/blender/io_mspgl/export_mesh.py @@ -321,10 +321,11 @@ class MeshExporter: fmt = ["NORMAL3"] if texunits: for i, u in texunits: + size = str(len(mesh.vertices[0].uvs[i])) if u.unit==0 or force_unit0: - fmt.append("TEXCOORD2") + fmt.append("TEXCOORD"+size) else: - fmt.append("TEXCOORD2_%d"%u.unit) + fmt.append("TEXCOORD%s_%d"%(size, u.unit)) if self.tbn_vecs: fmt += ["TANGENT3", "BINORMAL3"] if self.export_groups: @@ -342,10 +343,11 @@ class MeshExporter: normal = v.normal for i, u in texunits: if v.uvs[i]!=uvs.get(i): + size = str(len(v.uvs[i])) if u.unit==0 or force_unit0: - out_file.write("texcoord2", *v.uvs[i]) + out_file.write("texcoord"+size, *v.uvs[i]) else: - out_file.write("multitexcoord2", u.unit, *v.uvs[i]) + out_file.write("multitexcoord"+size, u.unit, *v.uvs[i]) uvs[i] = v.uvs[i] if self.tbn_vecs: if v.tan!=tan: diff --git a/blender/io_mspgl/mesh.py b/blender/io_mspgl/mesh.py index 2cd64236..d05b9de8 100644 --- a/blender/io_mspgl/mesh.py +++ b/blender/io_mspgl/mesh.py @@ -158,6 +158,13 @@ class Mesh: v.faces.append(f) for u in self.uv_layers: f.uvs.append([u.data[f.loop_indices[i]].uv for i in range(len(f.vertices))]) + if f.material_index