inplace_transform_stroke_strategy.cpp (krita-5.1.3.tar.xz) | : | inplace_transform_stroke_strategy.cpp (krita-5.1.4.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
#include <kis_painter.h> | #include <kis_painter.h> | |||
#include <kis_transform_worker.h> | #include <kis_transform_worker.h> | |||
#include <kis_transform_mask.h> | #include <kis_transform_mask.h> | |||
#include "kis_transform_mask_adapter.h" | #include "kis_transform_mask_adapter.h" | |||
#include "kis_transform_utils.h" | #include "kis_transform_utils.h" | |||
#include "kis_abstract_projection_plane.h" | #include "kis_abstract_projection_plane.h" | |||
#include "kis_recalculate_transform_mask_job.h" | #include "kis_recalculate_transform_mask_job.h" | |||
#include "kis_projection_leaf.h" | #include "kis_projection_leaf.h" | |||
#include "kis_modify_transform_mask_command.h" | #include "kis_modify_transform_mask_command.h" | |||
#include "KisAnimAutoKey.h" | ||||
#include "kis_sequential_iterator.h" | #include "kis_sequential_iterator.h" | |||
#include "kis_selection_mask.h" | #include "kis_selection_mask.h" | |||
#include "kis_image_config.h" | #include "kis_image_config.h" | |||
#include "kis_layer_utils.h" | #include "kis_layer_utils.h" | |||
#include <QQueue> | #include <QQueue> | |||
#include <KisDeleteLaterWrapper.h> | #include <KisDeleteLaterWrapper.h> | |||
#include "transform_transaction_properties.h" | #include "transform_transaction_properties.h" | |||
#include "krita_container_utils.h" | #include "krita_container_utils.h" | |||
#include "commands_new/kis_saved_commands.h" | #include "commands_new/kis_saved_commands.h" | |||
skipping to change at line 51 | skipping to change at line 52 | |||
#include "commands_new/KisHoldUIUpdatesCommand.h" | #include "commands_new/KisHoldUIUpdatesCommand.h" | |||
#include "KisDecoratedNodeInterface.h" | #include "KisDecoratedNodeInterface.h" | |||
#include "kis_sync_lod_cache_stroke_strategy.h" | #include "kis_sync_lod_cache_stroke_strategy.h" | |||
#include "kis_lod_transform.h" | #include "kis_lod_transform.h" | |||
#include <boost/optional.hpp> | #include <boost/optional.hpp> | |||
#include "kis_selection_mask.h" | #include "kis_selection_mask.h" | |||
#include "kis_undo_stores.h" | #include "kis_undo_stores.h" | |||
#include "kis_transparency_mask.h" | #include "kis_transparency_mask.h" | |||
#include "commands_new/KisDisableDirtyRequestsCommand.h" | #include "commands_new/KisDisableDirtyRequestsCommand.h" | |||
#include <kis_shape_layer.h> | #include <kis_shape_layer.h> | |||
#include "kis_raster_keyframe_channel.h" | ||||
#include "kis_image_animation_interface.h" | ||||
struct InplaceTransformStrokeStrategy::Private | struct InplaceTransformStrokeStrategy::Private | |||
{ | { | |||
// initial conditions passed from the tool | // initial conditions passed from the tool | |||
KisUpdatesFacade *updatesFacade; | KisUpdatesFacade *updatesFacade; | |||
KisStrokeUndoFacade *undoFacade; | KisStrokeUndoFacade *undoFacade; | |||
ToolTransformArgs::TransformMode mode; | ToolTransformArgs::TransformMode mode; | |||
QString filterId; | QString filterId; | |||
bool forceReset; | bool forceReset; | |||
KisNodeSP rootNode; | KisNodeSP rootNode; | |||
skipping to change at line 353 | skipping to change at line 356 | |||
* just override the rect calculated before | * just override the rect calculated before | |||
*/ | */ | |||
KisBatchNodeUpdate updates; | KisBatchNodeUpdate updates; | |||
Q_FOREACH (KisNodeSP node, m_d->processedNodes) { | Q_FOREACH (KisNodeSP node, m_d->processedNodes) { | |||
updates.addUpdate(node, node->projectionPlane()->tightUserVisibl eBounds()); | updates.addUpdate(node, node->projectionPlane()->tightUserVisibl eBounds()); | |||
} | } | |||
m_d->initialUpdatesBeforeClear = updates.compressed(); | m_d->initialUpdatesBeforeClear = updates.compressed(); | |||
*m_d->updateDataForUndo = m_d->initialUpdatesBeforeClear; | *m_d->updateDataForUndo = m_d->initialUpdatesBeforeClear; | |||
/** | ||||
* We need to make sure that the nodes will be successfully be | ||||
* transformed back in case the stroke will be finished before | ||||
* sigTransactionGenerated() signal is delivered. | ||||
*/ | ||||
m_d->pendingUpdateArgs = m_d->initialTransformArgs; | ||||
}); | }); | |||
} | } | |||
KritaUtils::addJobSequential(extraInitJobs, [this]() { | if (KisAutoKey::activeMode() > KisAutoKey::NONE) { | |||
// When dealing with animated transform mask layers, create keyframe and | KritaUtils::addJobSequential(extraInitJobs, [this]() { | |||
save the command for undo. | // When dealing with animated transform mask layers, create keyframe | |||
Q_FOREACH (KisNodeSP node, m_d->processedNodes) { | and save the command for undo. | |||
if (KisTransformMask* transformMask = dynamic_cast<KisTransformMask* | Q_FOREACH (KisNodeSP node, m_d->processedNodes) { | |||
>(node.data())) { | if (KisTransformMask* transformMask = dynamic_cast<KisTransformM | |||
QSharedPointer<KisInitializeTransformMaskKeyframesCommand> addKe | ask*>(node.data())) { | |||
yCommand(new KisInitializeTransformMaskKeyframesCommand(transformMask, | QSharedPointer<KisInitializeTransformMaskKeyframesCommand> a | |||
ddKeyCommand(new KisInitializeTransformMaskKeyframesCommand(transformMask, | ||||
KisTransformMaskParamsIn | ||||
terfaceSP( | KisTransformMaskPara | |||
msInterfaceSP( | ||||
new KisTransformMask | ||||
Adapter(m_d->initialTransformArgs)))); | new KisTransform | |||
runAndSaveCommand( addKeyCommand, KisStrokeJobData::CONCURRENT, | MaskAdapter(m_d->initialTransformArgs)))); | |||
KisStrokeJobData::NORMAL); | runAndSaveCommand( addKeyCommand, KisStrokeJobData::CONCURRE | |||
NT, KisStrokeJobData::NORMAL); | ||||
} else if (node->hasEditablePaintDevice()){ | ||||
// Try to create a copy keyframe if available. | ||||
KisPaintDeviceSP device = node->paintDevice(); | ||||
KIS_ASSERT(device); | ||||
if (device->keyframeChannel()) { | ||||
KUndo2CommandSP undo(new KUndo2Command); | ||||
const int activeKeyframe = device->keyframeChannel()->ac | ||||
tiveKeyframeTime(); | ||||
const int targetKeyframe = node->image()->animationInter | ||||
face()->currentTime(); | ||||
device->keyframeChannel()->copyKeyframe(activeKeyframe, | ||||
targetKeyframe, undo.data()); | ||||
runAndSaveCommand(undo, KisStrokeJobData::BARRIER, KisSt | ||||
rokeJobData::NORMAL); | ||||
} | ||||
} | ||||
} | } | |||
} | }); | |||
}); | } | |||
KritaUtils::addJobSequential(extraInitJobs, [this]() { | KritaUtils::addJobSequential(extraInitJobs, [this]() { | |||
/** | /** | |||
* We must request shape layers to rerender areas outside image bounds | * We must request shape layers to rerender areas outside image bounds | |||
*/ | */ | |||
KisLayerUtils::forceAllHiddenOriginalsUpdate(m_d->rootNode); | KisLayerUtils::forceAllHiddenOriginalsUpdate(m_d->rootNode); | |||
}); | }); | |||
KritaUtils::addJobBarrier(extraInitJobs, [this]() { | KritaUtils::addJobBarrier(extraInitJobs, [this]() { | |||
/** | /** | |||
skipping to change at line 943 | skipping to change at line 966 | |||
/** | /** | |||
* Transform masks don't have internal state switch for LoD mode , | * Transform masks don't have internal state switch for LoD mode , | |||
* therefore all the preview transformations must be cancelled | * therefore all the preview transformations must be cancelled | |||
* before applying the final command | * before applying the final command | |||
*/ | */ | |||
undoTransformCommands(m_d->previewLevelOfDetail); | undoTransformCommands(m_d->previewLevelOfDetail); | |||
}); | }); | |||
} | } | |||
reapplyTransform(m_d->currentTransformArgs, mutatedJobs, 0, true); | reapplyTransform(m_d->currentTransformArgs, mutatedJobs, 0, true); | |||
} else { | ||||
if (m_d->pendingUpdateArgs) { | ||||
mutatedJobs << new BarrierUpdateData(true); | ||||
} | ||||
} | } | |||
mutatedJobs << new UpdateTransformData(m_d->currentTransformArgs, | mutatedJobs << new UpdateTransformData(m_d->currentTransformArgs, | |||
UpdateTransformData::SELECTION); | UpdateTransformData::SELECTION); | |||
// the rest of the transform finishing work cannot be cancelled... | // the rest of the transform finishing work cannot be cancelled... | |||
KritaUtils::addJobBarrier(mutatedJobs, [this]() { | KritaUtils::addJobBarrier(mutatedJobs, [this]() { | |||
m_d->strokeCompletionHasBeenStarted = true; | m_d->strokeCompletionHasBeenStarted = true; | |||
QVector<KisStrokeJobData *> nonCancellableFinishJobs; | QVector<KisStrokeJobData *> nonCancellableFinishJobs; | |||
End of changes. 6 change blocks. | ||||
18 lines changed or deleted | 49 lines changed or added |