[mod_converter] Allow to process and print loaded .mod files from Viewer.exe from AIM2 SDK.

This commit is contained in:
lzwdgc 2020-12-09 05:10:07 +03:00
parent 27b175238a
commit 0f06403862
3 changed files with 14 additions and 2 deletions

View file

@ -86,9 +86,10 @@ auto read_model(const path &fn)
model m; model m;
if (fn.extension() == ".mod") // single block file from m2 sdk viewer if (fn.extension() == ".mod") // single block file from m2 sdk viewer
{ {
block bl; block bl = {};
bl.printable = true; // allow to output
bl.h.name = to_printable_string(fn.stem()); bl.h.name = to_printable_string(fn.stem());
bl.loadPayload(b); bl.loadPayloadAndProcess(b);
m.blocks.push_back(bl); m.blocks.push_back(bl);
} }
else else

View file

@ -482,6 +482,12 @@ void block::load(const buffer &b)
pmd = process_block(md); pmd = process_block(md);
} }
void block::loadPayloadAndProcess(const buffer &b)
{
loadPayload(b);
pmd = process_block(md);
}
void block::loadPayload(const buffer &data) void block::loadPayload(const buffer &data)
{ {
// anims // anims
@ -692,6 +698,9 @@ bool block::isEngineFx() const
bool block::canPrint() const bool block::canPrint() const
{ {
if (printable)
return true;
// block all lods except 0 // block all lods except 0
if (!(h.all_lods == 15 || h.LODs.lod1)) if (!(h.all_lods == 15 || h.LODs.lod1))
return false; return false;

View file

@ -343,6 +343,7 @@ struct block
void load(const buffer &b); void load(const buffer &b);
void loadPayload(const buffer &b); void loadPayload(const buffer &b);
void loadPayloadAndProcess(const buffer &b);
void linkFaces(); void linkFaces();
std::string printMtl() const; std::string printMtl() const;
@ -354,6 +355,7 @@ struct block
// //
processed_model_data pmd; processed_model_data pmd;
bool printable = false;
}; };
struct model struct model