=== modified file 'src/live_effects/effect.cpp' --- src/live_effects/effect.cpp 2013-11-09 22:36:13 +0000 +++ src/live_effects/effect.cpp 2013-11-10 12:29:29 +0000 @@ -496,21 +496,22 @@ 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()); - } + // SPCurve* curve = SP_SHAPE(lpeitem)->getCurve (); + //hp_vec.push_back(curve->get_pathvector()); + //} // add other helperpaths provided by the effect itself addCanvasIndicators(lpeitem, hp_vec); // add helperpaths provided by the effect's parameters + //TODO: decide if path parameters need helper paths ? for (std::vector::iterator p = param_vector.begin(); p != param_vector.end(); ++p) { (*p)->addCanvasIndicators(lpeitem, hp_vec); } === modified file 'src/ui/tools/node-tool.cpp' --- src/ui/tools/node-tool.cpp 2013-11-09 22:36:13 +0000 +++ src/ui/tools/node-tool.cpp 2013-11-10 12:22:21 +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! @@ -141,6 +143,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; @@ -169,6 +172,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(); @@ -252,6 +259,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; @@ -281,6 +289,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 NodeTool::set(const Inkscape::Preferences::Entry& value) { @@ -376,7 +419,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(); @@ -444,7 +486,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) { @@ -461,6 +503,7 @@ this->flashed_item = NULL; } + if (!SP_IS_SHAPE(over_item)) { break; // for now, handle only shapes } @@ -483,6 +526,7 @@ this->flash_tempitem = desktop->add_temporary_canvasitem(flash, prefs->getInt("/tools/nodes/pathflash_timeout", 500)); + c->unref(); } === modified file 'src/ui/tools/node-tool.h' --- src/ui/tools/node-tool.h 2013-11-09 22:36:13 +0000 +++ src/ui/tools/node-tool.h 2013-11-10 12:22:21 +0000 @@ -51,6 +51,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); @@ -63,6 +64,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;