Commit bc729a67b17359c093d0201c8956f47fd5f3488f

Authored by Jordan
1 parent a8dad531

Updated openTransform to not overwrite Templates with matrix data

Showing 1 changed file with 12 additions and 9 deletions
openbr/plugins/misc.cpp
@@ -35,16 +35,19 @@ class OpenTransform : public UntrainableMetaTransform @@ -35,16 +35,19 @@ class OpenTransform : public UntrainableMetaTransform
35 35
36 void project(const Template &src, Template &dst) const 36 void project(const Template &src, Template &dst) const
37 { 37 {
38 - if (Globals->verbose) qDebug("Opening %s", qPrintable(src.file.flat()));  
39 - dst.file = src.file;  
40 - foreach (const File &file, src.file.split()) {  
41 - QScopedPointer<Format> format(Factory<Format>::make(file));  
42 - Template t = format->read();  
43 - if (t.isEmpty()) qWarning("Can't open %s from %s", qPrintable(file.flat()), qPrintable(QDir::currentPath()));  
44 - dst.append(t);  
45 - dst.file.append(t.file.localMetadata()); 38 + if (!src.m().empty()) dst.append(src.clone());
  39 + else {
  40 + if (Globals->verbose) qDebug("Opening %s", qPrintable(src.file.flat()));
  41 + dst.file = src.file;
  42 + foreach (const File &file, src.file.split()) {
  43 + QScopedPointer<Format> format(Factory<Format>::make(file));
  44 + Template t = format->read();
  45 + if (t.isEmpty()) qWarning("Can't open %s from %s", qPrintable(file.flat()), qPrintable(QDir::currentPath()));
  46 + dst.append(t);
  47 + dst.file.append(t.file.localMetadata());
  48 + }
  49 + dst.file.set("FTO", dst.isEmpty());
46 } 50 }
47 - dst.file.set("FTO", dst.isEmpty());  
48 } 51 }
49 }; 52 };
50 53