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:
@@ -28,9 +28,9 @@ const QString ChromaKeyNode::kColorInput = QStringLiteral("color_key");
|
||||
const QString ChromaKeyNode::kMaskOnlyInput = QStringLiteral("mask_only_in");
|
||||
const QString ChromaKeyNode::kInvertInput = QStringLiteral("invert_in");
|
||||
const QString ChromaKeyNode::kUpperToleranceInput =
|
||||
QStringLiteral("upper_tolerence_in");
|
||||
QStringLiteral("upper_tolerance_in");
|
||||
const QString ChromaKeyNode::kLowerToleranceInput =
|
||||
QStringLiteral("lower_tolerence_in");
|
||||
QStringLiteral("lower_tolerance_in");
|
||||
const QString ChromaKeyNode::kGarbageMatteInput = QStringLiteral("garbage_in");
|
||||
const QString ChromaKeyNode::kCoreMatteInput = QStringLiteral("core_in");
|
||||
const QString ChromaKeyNode::kShadowsInput = QStringLiteral("shadows_in");
|
||||
@@ -163,4 +163,17 @@ void ChromaKeyNode::ConfigChanged()
|
||||
GenerateProcessor();
|
||||
}
|
||||
|
||||
QString ChromaKeyNode::GetInputIDForLegacyID(const QString &id) const
|
||||
{
|
||||
// Older project files used the misspelled "tolerence" input IDs
|
||||
if (id == QStringLiteral("upper_tolerence_in")) {
|
||||
return kUpperToleranceInput;
|
||||
}
|
||||
if (id == QStringLiteral("lower_tolerence_in")) {
|
||||
return kLowerToleranceInput;
|
||||
}
|
||||
|
||||
return super::GetInputIDForLegacyID(id);
|
||||
}
|
||||
|
||||
} // namespace olive
|
||||
|
||||
@@ -46,6 +46,10 @@ public:
|
||||
|
||||
virtual void ConfigChanged() override;
|
||||
|
||||
// Maps the misspelled tolerance input IDs from old project files onto the
|
||||
// corrected ones
|
||||
virtual QString GetInputIDForLegacyID(const QString &id) const override;
|
||||
|
||||
static const QString kColorInput;
|
||||
static const QString kInvertInput;
|
||||
static const QString kMaskOnlyInput;
|
||||
|
||||
Reference in New Issue
Block a user