diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-02-20 14:42:16 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2019-02-20 14:42:16 +0000 |
| commit | 211c530b8aae569ce8d5a17abef5524394e18632 (patch) | |
| tree | 6455fec8615c3a7a4c5a3836313132114e3eb96b /src | |
| parent | Prevent crashes in node tool (diff) | |
| download | inkscape-211c530b8aae569ce8d5a17abef5524394e18632.tar.gz inkscape-211c530b8aae569ce8d5a17abef5524394e18632.zip | |
Fix for issue 95: Crash on applying Perspective/Envelope LPE to a group
Diffstat (limited to 'src')
| -rw-r--r-- | src/object/sp-item-group.cpp | 1 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 28 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.h | 3 |
3 files changed, 24 insertions, 8 deletions
diff --git a/src/object/sp-item-group.cpp b/src/object/sp-item-group.cpp index c6b6f7340..12d245f77 100644 --- a/src/object/sp-item-group.cpp +++ b/src/object/sp-item-group.cpp @@ -927,6 +927,7 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *top_group, Inkscape::LivePa { std::vector<SPItem*> const item_list = sp_item_group_item_list(group); for (auto sub_item : item_list) { + std::cout << sub_item << "aaaa" << std::endl; SPGroup *sub_group = dynamic_cast<SPGroup *>(sub_item); if (sub_group) { sp_group_perform_patheffect(sub_group, top_group, lpe, write); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 13d4f3dc4..78b26093a 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -407,7 +407,25 @@ LivePathEffectEditor::setDesktop(SPDesktop *desktop) } } - +void +LivePathEffectEditor::rectsToCurves(SPItem* topitem, SPItem *item) +{ + Inkscape::Selection *sel = _getSelection(); + if ( dynamic_cast<SPRect *>(item) ) { + sel->clear(); + sel->set(item); + sel->toCurves(); + if (topitem == item) { + return; + } + } else if( SPGroup *group = dynamic_cast<SPGroup *>(item)){ + std::vector<SPItem*> const item_list = sp_item_group_item_list(group); + for (auto sub_item : item_list) { + rectsToCurves(topitem, sub_item); + } + } + sel->set(topitem); +} /*######################################################################## @@ -437,12 +455,8 @@ LivePathEffectEditor::onAdd() if (!data) { return; } - - // If item is a SPRect, convert it to path first: - if ( dynamic_cast<SPRect *>(item) ) { - sel->toCurves(); - item = sel->singleItem(); // get new item - } + rectsToCurves(item, item); + item = sel->singleItem(); // get new item LivePathEffect::Effect::createAndApply(data->key.c_str(), doc, item); diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index fdcb49145..600754ce3 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -18,6 +18,7 @@ #include <gtkmm/frame.h> #include "ui/widget/combo-enums.h" #include "ui/widget/frame.h" +#include "object/sp-item.h" #include "live_effects/effect-enum.h" #include <gtkmm/liststore.h> #include <gtkmm/eventbox.h> @@ -70,7 +71,7 @@ private: void effect_list_reload(SPLPEItem *lpeitem); void set_sensitize_all(bool sensitive); - + void rectsToCurves(SPItem *topitem, SPItem *item); void showParams(LivePathEffect::Effect& effect); void showText(Glib::ustring const &str); void selectInList(LivePathEffect::Effect* effect); |
