diff --git a/DataSpec/DNACommon/CMDL.hpp b/DataSpec/DNACommon/CMDL.hpp index 5db08b2f7..db3ac0dd7 100644 --- a/DataSpec/DNACommon/CMDL.hpp +++ b/DataSpec/DNACommon/CMDL.hpp @@ -1027,7 +1027,7 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn, template bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath, const Mesh& mesh) { - Athena::io::FileWriter writer(outPath.getAbsolutePath()); + //Athena::io::FileWriter writer(outPath.getAbsolutePath()); Header head; head.magic = 0xDEADBABE; @@ -1042,23 +1042,19 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath /* Build material sets */ { HECL::Frontend::Frontend FE; - int setIdx = 0; for (const std::vector& mset : mesh.materialSets) { - int matIdx = 0; for (const Mesh::Material& mat : mset) { - std::string diagName = HECL::SysFormat(_S("%s:%d:%d"), inPath.getLastComponent(), setIdx, matIdx); + std::string diagName = HECL::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str()); HECL::Frontend::IR matIR = FE.compileSource(mat.source, diagName); HECL::Backend::GX matGX; - matGX.reset(matIR); - ++matIdx; + matGX.reset(matIR, FE.getDiagnostics()); } - ++setIdx; } } - head.write(writer); + //head.write(writer); return true; diff --git a/DataSpec/DNAMP1/CMDL.hpp b/DataSpec/DNAMP1/CMDL.hpp index d2053f1e0..f0bb1eebf 100644 --- a/DataSpec/DNAMP1/CMDL.hpp +++ b/DataSpec/DNAMP1/CMDL.hpp @@ -45,10 +45,11 @@ struct CMDL return conn.saveBlend(); } - static bool Cook(const DNACMDL::Mesh& mesh, - const HECL::ProjectPath& outPath) + static bool Cook(const HECL::ProjectPath& outPath, + const HECL::ProjectPath& inPath, + const DNACMDL::Mesh& mesh) { - return true; + return DNACMDL::WriteCMDL(outPath, inPath, mesh); } }; diff --git a/DataSpec/SpecBase.cpp b/DataSpec/SpecBase.cpp index 0a18ee2f0..acf11890e 100644 --- a/DataSpec/SpecBase.cpp +++ b/DataSpec/SpecBase.cpp @@ -124,19 +124,19 @@ void SpecBase::doCook(const HECL::ProjectPath& path, const HECL::ProjectPath& co case HECL::BlenderConnection::TypeMesh: { HECL::BlenderConnection::DataStream ds = conn.beginData(); - cookMesh(path, ds, cookedPath); + cookMesh(cookedPath, path, ds); break; } case HECL::BlenderConnection::TypeActor: { HECL::BlenderConnection::DataStream ds = conn.beginData(); - cookActor(path, ds, cookedPath); + cookActor(cookedPath, path, ds); break; } case HECL::BlenderConnection::TypeArea: { HECL::BlenderConnection::DataStream ds = conn.beginData(); - cookArea(path, ds, cookedPath); + cookArea(cookedPath, path, ds); break; } default: break; @@ -145,7 +145,7 @@ void SpecBase::doCook(const HECL::ProjectPath& path, const HECL::ProjectPath& co else if (HECL::IsPathYAML(path)) { FILE* fp = HECL::Fopen(path.getAbsolutePath().c_str(), _S("r")); - cookYAML(fp, cookedPath); + cookYAML(cookedPath, path, fp); } } diff --git a/DataSpec/SpecBase.hpp b/DataSpec/SpecBase.hpp index 11f0217cf..ae09231ce 100644 --- a/DataSpec/SpecBase.hpp +++ b/DataSpec/SpecBase.hpp @@ -46,11 +46,11 @@ struct SpecBase : HECL::Database::IDataSpec /* Cook handlers */ using BlendStream = HECL::BlenderConnection::DataStream; using Mesh = BlendStream::Mesh; - virtual void cookMesh(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const=0; - virtual void cookActor(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const=0; - virtual void cookArea(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const=0; - virtual void cookYAML(FILE* in, const HECL::ProjectPath& out) const=0; + virtual void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const=0; + virtual void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const=0; + virtual void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const=0; + virtual void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in, FILE* fin) const=0; const HECL::ProjectPath& getMasterShaderPath() const {return m_masterShader;} diff --git a/DataSpec/SpecMP1.cpp b/DataSpec/SpecMP1.cpp index cb0c1e759..4c7256869 100644 --- a/DataSpec/SpecMP1.cpp +++ b/DataSpec/SpecMP1.cpp @@ -280,21 +280,21 @@ struct SpecMP1 : SpecBase return false; } - void cookMesh(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const + void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const { Mesh mesh = ds.compileMesh(); - DNAMP1::CMDL::Cook(mesh, out); + DNAMP1::CMDL::Cook(out, in, mesh); } - void cookActor(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const + void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const { } - void cookArea(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const + void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const { } - void cookYAML(FILE* in, const HECL::ProjectPath& out) const + void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in, FILE* fin) const { } }; diff --git a/DataSpec/SpecMP2.cpp b/DataSpec/SpecMP2.cpp index cce85c6bd..82d0239ac 100644 --- a/DataSpec/SpecMP2.cpp +++ b/DataSpec/SpecMP2.cpp @@ -270,19 +270,19 @@ struct SpecMP2 : SpecBase return false; } - void cookMesh(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const + void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const { } - void cookActor(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const + void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const { } - void cookArea(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const + void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const { } - void cookYAML(FILE* in, const HECL::ProjectPath& out) const + void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in, FILE* fin) const { } }; diff --git a/DataSpec/SpecMP3.cpp b/DataSpec/SpecMP3.cpp index 326bf51da..75c16eac1 100644 --- a/DataSpec/SpecMP3.cpp +++ b/DataSpec/SpecMP3.cpp @@ -453,19 +453,19 @@ struct SpecMP3 : SpecBase return false; } - void cookMesh(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const + void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const { } - void cookActor(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const + void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const { } - void cookArea(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const + void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const { } - void cookYAML(FILE* in, const HECL::ProjectPath& out) const + void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in, FILE* fin) const { } }; diff --git a/hecl b/hecl index abb371d22..18f692317 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit abb371d22ba32982f87c174d494756e0477c21c1 +Subproject commit 18f692317a8b043fbf52bad6efffd043ae7a352d