bmesh generation tweaks

This commit is contained in:
Jack Andersen 2015-09-10 18:53:32 -10:00
parent cb7c642dac
commit 40c39ee83b
4 changed files with 44 additions and 1 deletions

View File

@ -145,6 +145,16 @@ void FinishBlenderMesh(HECL::BlenderConnection::PyOutStream& os,
"\n"
"bm.to_mesh(mesh)\n"
"bm.free()\n"
"\n"
"# Remove redundant materials\n"
"present_mats = set()\n"
"for poly in mesh.polygons:\n"
" present_mats.add(poly.material_index)\n"
"for mat_idx in reversed(range(len(mesh.materials))):\n"
" if mat_idx not in present_mats:\n"
" mesh.materials.pop(index=mat_idx, update_data=True)\n"
"\n"
"mesh.update()\n"
"\n";
}

View File

@ -1,5 +1,6 @@
make_dnalist(liblist
CMDL)
CMDL
DeafBabe)
add_library(DNACommon
DNACommon.hpp DNACommon.cpp
${liblist}
@ -10,5 +11,6 @@ add_library(DNACommon
TXTR.hpp TXTR.cpp
ANCS.hpp
ANIM.hpp ANIM.cpp
DeafBabe.cpp
Tweaks/ITweakPlayer.hpp
Tweaks/ITweakPlayerControl.hpp)

View File

View File

@ -0,0 +1,31 @@
#ifndef _DNACOMMON_DEAFBABE_HPP_
#define _DNACOMMON_DEAFBABE_HPP_
#include "DNACommon.hpp"
namespace Retro
{
namespace DNACommon
{
struct DeafBabe : BigDNA
{
Delete expl;
std::vector<atUint64> materials;
std::vector<atUint8> vertMats;
std::vector<atUint8> edgeMats;
std::vector<atUint8> polyMats;
std::vector<std::pair<atUint16, atUint16>> edgeVertConnections;
std::vector<std::pair<atUint16, atUint16>> triangleEdgeConnections;
void read(Athena::io::IStreamReader& reader)
{
}
void write(Athena::io::IStreamWriter& writer) const
{
}
};
}
}
#endif // _DNACOMMON_DEAFBABE_HPP_