diff --git a/sdk/core/core.cpp b/sdk/core/core.cpp index e0bcb8b..3db24ed 100644 --- a/sdk/core/core.cpp +++ b/sdk/core/core.cpp @@ -124,6 +124,8 @@ struct AlgorithmCore Globals->totalSteps = i.size(); Globals->startTime.start(); + const bool noDuplicates = gallery.contains("noDuplicates"); + QStringList fileNames = noDuplicates ? fileList.names() : QStringList(); const int subBlockSize = 4*std::max(1, Globals->parallelism); const int numSubBlocks = ceil(1.0*Globals->blockSize/subBlockSize); int totalCount = 0, failureCount = 0; @@ -132,6 +134,10 @@ struct AlgorithmCore for (int subBlock = 0; subBlockblockSize + subBlock*subBlockSize, subBlockSize); if (data.isEmpty()) break; + if (noDuplicates) + for (int i=data.size()-1; i>=0; i--) + if (fileNames.contains(data[i].file.name)) + data.removeAt(i); const int numFiles = data.size(); if (Globals->backProject) { diff --git a/sdk/openbr_plugin.h b/sdk/openbr_plugin.h index 9c10a54..5435060 100644 --- a/sdk/openbr_plugin.h +++ b/sdk/openbr_plugin.h @@ -505,6 +505,12 @@ public: Q_PROPERTY(float ageDelta READ get_ageDelta WRITE set_ageDelta RESET reset_ageDelta) BR_PROPERTY(float, ageDelta, std::numeric_limits::max()) + /*! + * \brief If \c true a template will be skipped over if its file name already exists in the gallery. + */ + Q_PROPERTY(bool noDuplicates READ get_noDuplicates WRITE set_noDuplicates RESET reset_noDuplicates) + BR_PROPERTY(bool, noDuplicates, false) + QHash abbreviations; /*!< \brief Used by br::Transform::make() to expand abbreviated algorithms into their complete definitions. */ QHash classes; /*!< \brief Used by classifiers to associate text class labels with unique integers IDs. */ QTime startTime; /*!< \brief Used to estimate timeRemaining(). */