Commit 9abe69538c34a96b02feb2afb5ff07c495b17f6e

Authored by Charles Otto
1 parent bd688ffc

More elaborate stored transform handling

If an unknown transform string is encountered in an algorithm, attempt
to load it via LoadStore, e.g.
"Open+Cascade+landmark_model"
would expand landmark_model to <landmark_model>. Additionally, arguments
supplied to such unknown transforms are set via setPropertyRecursive
e.g.
"Open+Cascade+landmark_model(something=true)"
works.

Also allow _ in model names specified as the first argument to LoadStore
openbr/openbr_plugin.cpp
... ... @@ -1413,6 +1413,13 @@ Transform *Transform::make(QString str, QObject *parent)
1413 1413 if (str.startsWith('(') && str.endsWith(')'))
1414 1414 return make(str.mid(1, str.size()-2), parent);
1415 1415  
  1416 + // Base name not found? Try constructing it via LoadStore
  1417 + if (!Factory<Transform>::names().contains(parsed.suffix())) {
  1418 + Transform *tform = make("<"+parsed.suffix()+">", parent);
  1419 + applyAdditionalProperties(parsed, tform);
  1420 + return tform;
  1421 + }
  1422 +
1416 1423 //! [Construct the root transform]
1417 1424 Transform *transform = Factory<Transform>::make("." + str);
1418 1425 //! [Construct the root transform]
... ...
openbr/plugins/meta.cpp
... ... @@ -540,7 +540,7 @@ private:
540 540 void init()
541 541 {
542 542 if (transform != NULL) return;
543   - if (fileName.isEmpty()) baseName = QRegExp("^[a-zA-Z0-9]+$").exactMatch(transformString) ? transformString : QtUtils::shortTextHash(transformString);
  543 + if (fileName.isEmpty()) baseName = QRegExp("^[_a-zA-Z0-9]+$").exactMatch(transformString) ? transformString : QtUtils::shortTextHash(transformString);
544 544 else baseName = fileName;
545 545 if (!tryLoad())
546 546 transform = make(transformString);
... ...