nodes: fix serialized ID typos with backward compatibility
- ChromaKey tolerance inputs are now spelled "upper/lower_tolerance_in"; old projects with the misspelled "tolerence" IDs keep loading (values and connections) via a new Node::GetInputIDForLegacyID() hook applied in LoadInput and connection deserialization - flip/ripple/swirl/tile/wave node IDs moved to the consistent org.olivevideoeditor.Olive.* domain; NodeFactory::CreateFromID maps the old org.oliveeditor.* IDs so old projects still resolve - Regression tests: legacy ChromaKey IDs (values + connections) and legacy factory IDs
This commit is contained in:
+19
-1
@@ -22,6 +22,7 @@
|
||||
#include "factory.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QHash>
|
||||
|
||||
#include "audio/pan/pan.h"
|
||||
#include "audio/volume/volume.h"
|
||||
@@ -224,8 +225,25 @@ QString NodeFactory::GetNameFromID(const QString &id)
|
||||
|
||||
Node *NodeFactory::CreateFromID(const QString &id)
|
||||
{
|
||||
QString resolved_id = id;
|
||||
|
||||
// Node IDs renamed after older project files were written
|
||||
static const QHash<QString, QString> kLegacyIDs = {
|
||||
{ QStringLiteral("org.oliveeditor.Olive.flip"),
|
||||
QStringLiteral("org.olivevideoeditor.Olive.flip") },
|
||||
{ QStringLiteral("org.oliveeditor.Olive.ripple"),
|
||||
QStringLiteral("org.olivevideoeditor.Olive.ripple") },
|
||||
{ QStringLiteral("org.oliveeditor.Olive.swirl"),
|
||||
QStringLiteral("org.olivevideoeditor.Olive.swirl") },
|
||||
{ QStringLiteral("org.oliveeditor.Olive.tile"),
|
||||
QStringLiteral("org.olivevideoeditor.Olive.tile") },
|
||||
{ QStringLiteral("org.oliveeditor.Olive.wave"),
|
||||
QStringLiteral("org.olivevideoeditor.Olive.wave") },
|
||||
};
|
||||
resolved_id = kLegacyIDs.value(id, id);
|
||||
|
||||
foreach (Node *n, library_) {
|
||||
if (n->id() == id) {
|
||||
if (n->id() == resolved_id) {
|
||||
return n->copy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user