[krita/rempt/impex-refactoring] libs/image: Don't merge onion skins when merging two layers

Dmitry Kazakov dimula73 at gmail.com
Thu Nov 3 08:15:00 UTC 2016


Git commit 3f69cfc7cad2d5194220dadd2c8c3c1a979b28d8 by Dmitry Kazakov.
Committed on 03/11/2016 at 08:14.
Pushed by dkazakov into branch 'rempt/impex-refactoring'.

Don't merge onion skins when merging two layers

That was quite an old bug :)

BUG:363115
CC:kimageshop at kde.org

M  +30   -4    libs/image/kis_layer_utils.cpp

http://commits.kde.org/krita/3f69cfc7cad2d5194220dadd2c8c3c1a979b28d8

diff --git a/libs/image/kis_layer_utils.cpp b/libs/image/kis_layer_utils.cpp
index 319bab9..0d8a691 100644
--- a/libs/image/kis_layer_utils.cpp
+++ b/libs/image/kis_layer_utils.cpp
@@ -173,6 +173,30 @@ namespace KisLayerUtils {
         MergeDownInfoBaseSP m_info;
     };
 
+    struct DisableOnionSkins : public KisCommandUtils::AggregateCommand {
+        DisableOnionSkins(MergeDownInfoBaseSP info) : m_info(info) {}
+
+        void populateChildCommands() override {
+            Q_FOREACH (KisNodeSP node, m_info->allSrcNodes()) {
+                recursiveApplyNodes(node,
+                                    [this] (KisNodeSP node) {
+                                        if (KisLayerPropertiesIcons::nodeProperty(node, KisLayerPropertiesIcons::onionSkins, false).toBool()) {
+
+                                            KisBaseNode::PropertyList props = node->sectionModelProperties();
+                                            KisLayerPropertiesIcons::setNodeProperty(&props,
+                                                                                     KisLayerPropertiesIcons::onionSkins,
+                                                                                     false);
+
+                                            addCommand(new KisNodePropertyListCommand(node, props));
+                                        }
+                                    });
+            }
+        }
+
+    private:
+        MergeDownInfoBaseSP m_info;
+    };
+
     struct RefreshHiddenAreas : public KUndo2Command {
         RefreshHiddenAreas(MergeDownInfoBaseSP info) : m_info(info) {}
 
@@ -739,9 +763,10 @@ namespace KisLayerUtils {
         if (layer->visible() && prevLayer->visible()) {
             MergeDownInfoSP info(new MergeDownInfo(image, prevLayer, layer));
 
-            // disable key strokes on all colorize masks and wait until
-            // update is finished with a barrier
+            // disable key strokes on all colorize masks, all onion skins on
+            // paint layers and wait until update is finished with a barrier
             applicator.applyCommand(new DisableColorizeKeyStrokes(info));
+            applicator.applyCommand(new DisableOnionSkins(info));
             applicator.applyCommand(new KUndo2Command(), KisStrokeJobData::BARRIER);
 
             applicator.applyCommand(new KeepMergedNodesSelected(info, false));
@@ -1034,9 +1059,10 @@ namespace KisLayerUtils {
         if (mergedNodes.size() > 1 || invisibleNodes.isEmpty()) {
             MergeMultipleInfoSP info(new MergeMultipleInfo(image, mergedNodes));
 
-            // disable key strokes on all colorize masks and wait until
-            // update is finished with a barrier
+            // disable key strokes on all colorize masks, all onion skins on
+            // paint layers and wait until update is finished with a barrier
             applicator.applyCommand(new DisableColorizeKeyStrokes(info));
+            applicator.applyCommand(new DisableOnionSkins(info));
             applicator.applyCommand(new KUndo2Command(), KisStrokeJobData::BARRIER);
 
             applicator.applyCommand(new KeepMergedNodesSelected(info, putAfter, false));


More information about the kimageshop mailing list