From 418e2db02e4c6ed7ebccd0d518f2c6331704f050 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 6 Jun 2018 21:54:37 +0200 Subject: Fixes to extension system and simplify the code --- src/extension/implementation/script.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/extension/implementation/script.cpp') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index d77695bf1..d725ff8cc 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -690,11 +690,17 @@ void Script::effect(Inkscape::Extension::Effect *module, if (desktop) { Inkscape::Selection * selection = desktop->getSelection(); - if (!selection->isEmpty()) { - selection->setBackup(); + if (selection) { + //No working dialog run once + if (!selection->isEmpty()) { + selection->setBackup(); + } else { + selection->restoreBackup(); + } + params = selection->params; + module->paramListString(params); + selection->clear(); } - params = selection->params; - module->paramListString(params); } file_listener fileout; @@ -758,12 +764,10 @@ void Script::effect(Inkscape::Extension::Effect *module, //set the current layer desktop->setCurrentLayer(layer); } - SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop) { Inkscape::Selection * selection = desktop->getSelection(); - if (selection && selection->isEmpty() && !desktop->on_live_extension) { + if (selection && selection->isEmpty()) { selection->restoreBackup(); - selection->emptyBackup(); } } } -- cgit v1.2.3