=== modified file 'src/live_effects/effect.cpp' --- src/live_effects/effect.cpp 2013-10-04 21:57:28 +0000 +++ src/live_effects/effect.cpp 2013-10-31 02:53:38 +0000 @@ -496,12 +496,12 @@ if (!SP_IS_SHAPE(lpeitem)) { // g_print ("How to handle helperpaths for non-shapes?\n"); // non-shapes are for example SPGroups. - return hp_vec; +// return hp_vec; } // TODO: we can probably optimize this by using a lot more references // rather than copying PathVectors all over the place - if (show_orig_path) { + if (SP_IS_SHAPE(lpeitem) && show_orig_path) { // add original path to helperpaths SPCurve* curve = SP_SHAPE(lpeitem)->getCurve (); hp_vec.push_back(curve->get_pathvector()); === modified file 'src/ui/tool/node-tool.cpp' --- src/ui/tool/node-tool.cpp 2013-10-09 21:41:20 +0000 +++ src/ui/tool/node-tool.cpp 2013-10-31 16:18:05 +0000 @@ -20,6 +20,8 @@ #include "display/sp-canvas.h" #include "document.h" #include "live_effects/lpeobject.h" +#include "live_effects/effect.h" +#include "display/curve.h" #include "message-context.h" #include "selection.h" #include "shape-editor.h" // temporary! @@ -137,6 +139,7 @@ this->edit_masks = false; this->show_outline = false; this->flash_tempitem = 0; + this->helperpath_tmpitem = 0; this->cursor_shape = cursor_node_xpm; this->hot_x = 1; @@ -165,6 +168,10 @@ if (this->flash_tempitem) { this->desktop->remove_temporary_canvasitem(this->flash_tempitem); } + if (this->helperpath_tmpitem) { + this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); + } + this->_selection_changed_connection.disconnect(); //this->_selection_modified_connection.disconnect(); @@ -248,6 +255,7 @@ this->cursor_drag = false; this->show_transform_handles = true; this->single_node_transform_handles = false; + this->helperpath_tmpitem = NULL; this->flash_tempitem = NULL; this->flashed_item = NULL; this->_last_over = NULL; @@ -277,6 +285,41 @@ } this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive + this->update_helperpath(); +} + +void InkNodeTool::update_helperpath(){ + Inkscape::Selection *selection = sp_desktop_selection (this->desktop); + if (this->helperpath_tmpitem) { + this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); + this->helperpath_tmpitem = NULL; + } + if (SP_IS_LPE_ITEM(selection->singleItem())) { + Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); + if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { + if (lpe) { + SPCurve *c = new SPCurve(); + SPCurve *cc = new SPCurve(); + std::vector cs = lpe->getHelperPaths(SP_LPE_ITEM(selection->singleItem())); + for (std::vector::iterator p = cs.begin(); p != cs.end(); ++p) { + cc->set_pathvector(*p); + c->append(cc, false); + cc->reset(); + } + if (!c->is_empty()) { + c->transform(selection->singleItem()->i2dt_affine()); + SPCanvasItem *helperpath = sp_canvas_bpath_new(sp_desktop_tempgroup(this->desktop), c); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), + 0x0000ff9A, 1.0, + SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); + sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO); + this->helperpath_tmpitem = this->desktop->add_temporary_canvasitem(helperpath,0); + } + c->unref(); + cc->unref(); + } + } + } } void InkNodeTool::set(const Inkscape::Preferences::Entry& value) { @@ -372,7 +415,6 @@ gather_items(this, NULL, static_cast(obj), SHAPE_ROLE_NORMAL, shapes); } } - // use multiple ShapeEditors for now, to allow editing many shapes at once // needs to be rethought for (boost::ptr_map::iterator i = this->_shape_editors.begin(); @@ -440,7 +482,7 @@ //ink_node_tool_update_tip(nt, event); this->update_tip(event); } - + this->update_helperpath(); // create pathflash outline if (prefs->getBool("/tools/nodes/pathflash_enabled")) { if (over_item == this->flashed_item) { @@ -457,6 +499,7 @@ this->flashed_item = NULL; } + if (!SP_IS_SHAPE(over_item)) { break; // for now, handle only shapes } @@ -479,6 +522,7 @@ this->flash_tempitem = desktop->add_temporary_canvasitem(flash, prefs->getInt("/tools/nodes/pathflash_timeout", 500)); + c->unref(); } === modified file 'src/ui/tool/node-tool.h' --- src/ui/tool/node-tool.h 2013-10-09 21:41:20 +0000 +++ src/ui/tool/node-tool.h 2013-10-31 16:17:28 +0000 @@ -47,6 +47,7 @@ static const std::string prefsPath; virtual void setup(); + virtual void update_helperpath(); virtual void set(const Inkscape::Preferences::Entry& val); virtual bool root_handler(GdkEvent* event); @@ -59,6 +60,7 @@ SPItem *flashed_item; Inkscape::Display::TemporaryItem *flash_tempitem; + Inkscape::Display::TemporaryItem *helperpath_tmpitem; Inkscape::UI::Selector* _selector; Inkscape::UI::PathSharedData* _path_data; SPCanvasGroup *_transform_handle_group;