mirror of https://github.com/AxioDL/metaforce.git
Integrate SDNA parser for checking .blend types
This commit is contained in:
parent
b76ee77ecf
commit
45fb8db388
|
@ -23,28 +23,7 @@ typedef athena::io::DNAV<athena::Big> BigDNAV;
|
|||
typedef athena::io::DNAVYaml<athena::Big> BigDNAVYaml;
|
||||
|
||||
/** FourCC with DNA read/write */
|
||||
class DNAFourCC final : public BigDNA, public hecl::FourCC
|
||||
{
|
||||
public:
|
||||
DNAFourCC() : hecl::FourCC() {}
|
||||
DNAFourCC(const hecl::FourCC& other)
|
||||
: hecl::FourCC() {num = other.toUint32();}
|
||||
DNAFourCC(const char* name)
|
||||
: hecl::FourCC(name) {}
|
||||
DNAFourCC(uint32_t n)
|
||||
: hecl::FourCC(n) {}
|
||||
AT_DECL_EXPLICIT_DNA_YAML
|
||||
};
|
||||
template <> inline void DNAFourCC::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
||||
{ r.readUBytesToBuf(fcc, 4); }
|
||||
template <> inline void DNAFourCC::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
||||
{ w.writeUBytes((atUint8*)fcc, 4); }
|
||||
template <> inline void DNAFourCC::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
||||
{ std::string rs = r.readString(nullptr); strncpy(fcc, rs.c_str(), 4); }
|
||||
template <> inline void DNAFourCC::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
||||
{ w.writeString(nullptr, std::string(fcc, 4)); }
|
||||
template <> inline void DNAFourCC::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
||||
{ s += 4; }
|
||||
using DNAFourCC = hecl::DNAFourCC;
|
||||
|
||||
class DNAColor final : public BigDNA, public zeus::CColor
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "hecl/ClientProcess.hpp"
|
||||
#include "nod/nod.hpp"
|
||||
#include "hecl/Blender/Connection.hpp"
|
||||
#include "hecl/Blender/SDNARead.hpp"
|
||||
#include "hecl/MultiProgressPrinter.hpp"
|
||||
|
||||
#include <png.h>
|
||||
|
@ -233,10 +234,7 @@ bool SpecBase::canCook(const hecl::ProjectPath& path, hecl::blender::Token& btok
|
|||
|
||||
if (hecl::IsPathBlend(asBlend))
|
||||
{
|
||||
hecl::blender::Connection& conn = btok.getBlenderConnection();
|
||||
if (!conn.openBlend(asBlend))
|
||||
return false;
|
||||
hecl::blender::BlendType type = conn.getBlendType();
|
||||
hecl::blender::BlendType type = hecl::blender::GetBlendType(asBlend.getAbsolutePath());
|
||||
if (type != hecl::blender::BlendType::None)
|
||||
return cookPass < 0 ||
|
||||
(cookPass == 0 && type == hecl::blender::BlendType::Mesh) || // CMDL only
|
||||
|
@ -288,14 +286,13 @@ const hecl::Database::DataSpecEntry* SpecBase::overrideDataSpec(const hecl::Proj
|
|||
hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR(".ANIM")))
|
||||
return oldEntry;
|
||||
|
||||
hecl::blender::Connection& conn = btok.getBlenderConnection();
|
||||
if (!conn.openBlend(asBlend))
|
||||
hecl::blender::BlendType type = hecl::blender::GetBlendType(asBlend.getAbsolutePath());
|
||||
if (type == hecl::blender::BlendType::None)
|
||||
{
|
||||
Log.report(logvisor::Error, _SYS_STR("unable to cook '%s'"),
|
||||
path.getAbsolutePath().data());
|
||||
return nullptr;
|
||||
}
|
||||
hecl::blender::BlendType type = conn.getBlendType();
|
||||
if (type == hecl::blender::BlendType::Mesh ||
|
||||
type == hecl::blender::BlendType::Area)
|
||||
return oldEntry;
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "hecl/ClientProcess.hpp"
|
||||
#include "hecl/MultiProgressPrinter.hpp"
|
||||
#include "hecl/Blender/Connection.hpp"
|
||||
#include "hecl/Blender/SDNARead.hpp"
|
||||
#include "nod/nod.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
|
@ -574,11 +575,7 @@ struct SpecMP1 : SpecBase
|
|||
|
||||
if (hecl::IsPathBlend(asBlend))
|
||||
{
|
||||
hecl::blender::Connection& conn = btok.getBlenderConnection();
|
||||
if (!conn.openBlend(asBlend))
|
||||
return {};
|
||||
|
||||
switch (conn.getBlendType())
|
||||
switch (hecl::blender::GetBlendType(asBlend.getAbsolutePath()))
|
||||
{
|
||||
case hecl::blender::BlendType::Mesh:
|
||||
return {SBIG('CMDL'), path.hash().val32()};
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit e83f40f5ca9c5f0bc7664bbda19c43574172f42e
|
||||
Subproject commit 7561dd66e6ab5f5b7d4f94fc7bf732653ce104fb
|
Loading…
Reference in New Issue