2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 17:44:56 +00:00

More reliable 2-face model extraction

This commit is contained in:
Jack Andersen
2018-11-08 14:25:55 -10:00
parent 4c61119970
commit 304fc7e69e
4 changed files with 75 additions and 33 deletions

View File

@@ -5,7 +5,7 @@ namespace DataSpec::DNAMP1
{
#if DCLN_DUMP_OBB
void DCLN::Collision::NodesendToBlender(hecl::blender::PyOutStream& os) const
void DCLN::Collision::Node::sendToBlender(hecl::blender::PyOutStream& os) const
{
os.format("obj = bpy.data.objects.new('%s', None)\n"
"obj.empty_draw_type = 'CUBE'\n"
@@ -62,15 +62,15 @@ void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
/* Open Py Stream and read sections */
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector, Matrix\n"
"\n"
"bpy.context.scene.name = '%s'\n"
"# Clear Scene\n"
"for ob in bpy.data.objects:\n"
" if ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n",
"import bmesh\n"
"from mathutils import Vector, Matrix\n"
"\n"
"bpy.context.scene.name = '%s'\n"
"# Clear Scene\n"
"for ob in bpy.data.objects:\n"
" if ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n",
entryName.data());
DeafBabe::BlenderInit(os);
@@ -119,6 +119,13 @@ bool DCLN::Cook(const hecl::ProjectPath& outPath,
colOut.memSize = atUint32(colOut.root.getMemoryUsage());
}
#if DCLN_DUMP_OBB
hecl::blender::Connection& conn = hecl::blender::SharedBlenderToken.getBlenderConnection();
conn.createBlend(outPath.getWithExtension(_SYS_STR(".blend")), hecl::blender::BlendType::ColMesh);
dcln.sendToBlender(conn, "BLAH");
conn.saveBlend();
#endif
athena::io::FileWriter w(outPath.getAbsolutePath());
dcln.write(w);
int64_t rem = w.position() % 32;

View File

@@ -77,7 +77,7 @@ struct DCLN : BigDNA
}
#if DCLN_DUMP_OBB
sendToBlender(hecl::blender::PyOutStream& os) const;
void sendToBlender(hecl::blender::PyOutStream& os) const;
#endif
};
Node root;