Mesh: move Extension3MFFactory outside Exporter3MF
This commit is contained in:
@@ -269,7 +269,8 @@ private:
|
||||
exporter.reset( new ExporterAMF(outputFileName, meta, exportAmfCompressed) );
|
||||
}
|
||||
else if (exportFormat == MeshIO::ThreeMF) {
|
||||
exporter.reset( new Exporter3MF(outputFileName) );
|
||||
Extension3MFFactory::initialize();
|
||||
exporter.reset( new Exporter3MF(outputFileName, Extension3MFFactory::createExtensions()) );
|
||||
}
|
||||
else if (exportFormat != MeshIO::Undefined) {
|
||||
exporter.reset( new MergeExporter(outputFileName, exportFormat) );
|
||||
|
||||
@@ -257,7 +257,7 @@ void Extension3MFFactory::initialize()
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Extension3MFPtr> Extension3MFFactory::create()
|
||||
std::vector<Extension3MFPtr> Extension3MFFactory::createExtensions()
|
||||
{
|
||||
std::vector<Extension3MFPtr> ext;
|
||||
for (const auto& it : producer) {
|
||||
@@ -272,19 +272,19 @@ std::vector<Extension3MFProducerPtr> Extension3MFFactory::producer;
|
||||
|
||||
class Exporter3MF::Private {
|
||||
public:
|
||||
explicit Private(const std::string& filename)
|
||||
: writer3mf(filename) {
|
||||
Extension3MFFactory::initialize();
|
||||
ext = Extension3MFFactory::create();
|
||||
explicit Private(const std::string& filename,
|
||||
const std::vector<Extension3MFPtr>& ext)
|
||||
: writer3mf(filename)
|
||||
, ext(ext) {
|
||||
}
|
||||
MeshCore::Writer3MF writer3mf;
|
||||
std::vector<Extension3MFPtr> ext;
|
||||
};
|
||||
|
||||
Exporter3MF::Exporter3MF(std::string fileName)
|
||||
Exporter3MF::Exporter3MF(std::string fileName, const std::vector<Extension3MFPtr>& ext)
|
||||
{
|
||||
throwIfNoPermission(fileName);
|
||||
d.reset(new Private(fileName));
|
||||
d.reset(new Private(fileName, ext));
|
||||
}
|
||||
|
||||
Exporter3MF::~Exporter3MF()
|
||||
|
||||
@@ -171,7 +171,7 @@ class MeshExport Extension3MFFactory
|
||||
public:
|
||||
static void addProducer(Extension3MFProducer* ext);
|
||||
static void initialize();
|
||||
static std::vector<Extension3MFPtr> create();
|
||||
static std::vector<Extension3MFPtr> createExtensions();
|
||||
|
||||
private:
|
||||
static std::vector<Extension3MFProducerPtr> producer;
|
||||
@@ -187,7 +187,7 @@ private:
|
||||
class Exporter3MF : public Exporter
|
||||
{
|
||||
public:
|
||||
Exporter3MF(std::string fileName);
|
||||
Exporter3MF(std::string fileName, const std::vector<Extension3MFPtr>& = {});
|
||||
~Exporter3MF() override;
|
||||
|
||||
bool addMesh(const char *name, const MeshObject & mesh) override;
|
||||
|
||||
Reference in New Issue
Block a user