Commit d82899b0 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Fix loading of pre-krita-4.0 transform masks

We should be more tolerant for older configs that do not have
all the options we support.

BUG:396815
parent 59b7e838
......@@ -411,7 +411,6 @@ ToolTransformArgs ToolTransformArgs::fromXML(const QDomElement &e)
KisDomUtils::loadValue(freeEl, "transformedCenter", &args.m_transformedCenter) &&
KisDomUtils::loadValue(freeEl, "originalCenter", &args.m_originalCenter) &&
KisDomUtils::loadValue(freeEl, "rotationCenterOffset", &args.m_rotationCenterOffset) &&
KisDomUtils::loadValue(freeEl, "transformAroundRotationCenter", &args.m_transformAroundRotationCenter) &&
KisDomUtils::loadValue(freeEl, "aX", &args.m_aX) &&
KisDomUtils::loadValue(freeEl, "aY", &args.m_aY) &&
......@@ -427,9 +426,14 @@ ToolTransformArgs ToolTransformArgs::fromXML(const QDomElement &e)
KisDomUtils::loadValue(freeEl, "keepAspectRatio", &args.m_keepAspectRatio) &&
KisDomUtils::loadValue(freeEl, "flattenedPerspectiveTransform", &args.m_flattenedPerspectiveTransform) &&
KisDomUtils::loadValue(freeEl, "filterId", &filterId);
// transformAroundRotationCenter is a new parameter introduced in Krita 4.0,
// so it might be not present in older transform masks
if (!KisDomUtils::loadValue(freeEl, "transformAroundRotationCenter", &args.m_transformAroundRotationCenter)) {
args.m_transformAroundRotationCenter = false;
}
if (result) {
args.m_filter = KisFilterStrategyRegistry::instance()->value(filterId);
result = (bool) args.m_filter;
......@@ -452,9 +456,12 @@ ToolTransformArgs ToolTransformArgs::fromXML(const QDomElement &e)
KisDomUtils::loadValue(warpEl, "alpha", &args.m_alpha);
if(args.m_mode == CAGE){
result = result &&
KisDomUtils::loadValue(warpEl, "pixelPrecision", &args.m_pixelPrecision) &&
KisDomUtils::loadValue(warpEl, "previewPixelPrecision", &args.m_previewPixelPrecision);
// Pixel precision is a parameter introduced in Krita 4.2, so we should
// expect it not being present in older files. In case it is not found,
// just use the defalt value initialized by c-tor (that is, do nothing).
(void) KisDomUtils::loadValue(warpEl, "pixelPrecision", &args.m_pixelPrecision);
(void) KisDomUtils::loadValue(warpEl, "previewPixelPrecision", &args.m_previewPixelPrecision);
}
if (result && warpType >= 0 && warpType < KisWarpTransformWorker::N_MODES) {
......@@ -475,7 +482,7 @@ ToolTransformArgs ToolTransformArgs::fromXML(const QDomElement &e)
KIS_ASSERT_RECOVER_NOOP(0 && "Unknown transform mode");
}
if (!result) {
KIS_SAFE_ASSERT_RECOVER(result) {
args = ToolTransformArgs();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment