diff --git a/DataSpec/DNACommon/CMDL.cpp b/DataSpec/DNACommon/CMDL.cpp index b5ef17063..4a58e20fb 100644 --- a/DataSpec/DNACommon/CMDL.cpp +++ b/DataSpec/DNACommon/CMDL.cpp @@ -28,6 +28,11 @@ void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os, " if loop.vert.index == vert_idx:\n" " return loop\n" "\n" + "def eq_normals(n1, n2):\n" + " if n1[0] == n2[0] and n1[1] == n2[1] and n1[2] == n2[2]:\n" + " return True\n" + " return False\n" + "\n" "def add_triangle(bm, vert_seq, vert_indices, norm_seq, norm_indices, mat_nr, od_list):\n" " if len(set(vert_indices)) != 3:\n" " return None, None\n" @@ -37,6 +42,11 @@ void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os, " verts = [vert_seq[i] for i in vert_indices]\n" " norms = [norm_seq[i] for i in norm_indices]\n" "\n" + " for i in range(3):\n" + " if not eq_normals(verts[i].normal, norms[i]):\n" + " verts[i] = bm.verts.new(verts[i].co, verts[i])\n" + " vert_seq.ensure_lookup_table()\n" + "\n" " # Make the face\n" " face = bm.faces.get(verts)\n" "\n" diff --git a/DataSpec/DNAMP2/MREA.cpp b/DataSpec/DNAMP2/MREA.cpp index 8cb4400e6..51f08bb9d 100644 --- a/DataSpec/DNAMP2/MREA.cpp +++ b/DataSpec/DNAMP2/MREA.cpp @@ -181,6 +181,7 @@ bool MREA::Extract(const SpecBase& dataSpec, mreaDecompOut.seekAlign32(); atUint64 decompLen = drs.length(); mreaDecompOut.writeBytes(drs.readBytes(decompLen).get(), decompLen); + mreaDecompOut.close(); drs.seek(0, Athena::Begin); /* Start up blender connection */ diff --git a/DataSpec/DNAMP3/MREA.cpp b/DataSpec/DNAMP3/MREA.cpp index 3207e8ce8..63490a21b 100644 --- a/DataSpec/DNAMP3/MREA.cpp +++ b/DataSpec/DNAMP3/MREA.cpp @@ -156,6 +156,7 @@ bool MREA::Extract(const SpecBase& dataSpec, mreaDecompOut.seekAlign32(); atUint64 decompLen = drs.length(); mreaDecompOut.writeBytes(drs.readBytes(decompLen).get(), decompLen); + mreaDecompOut.close(); drs.seek(0, Athena::Begin);