diff options
| -rw-r--r-- | src/live_effects/effect.cpp | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-bendpath.cpp | 8 | ||||
| -rw-r--r-- | src/live_effects/lpe-bendpath.h | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-measure-segments.h | 2 | ||||
| -rw-r--r-- | src/path-chemistry.cpp | 2 | ||||
| -rw-r--r-- | src/selection-chemistry.cpp | 4 | ||||
| -rw-r--r-- | src/sp-ellipse.cpp | 6 | ||||
| -rw-r--r-- | src/sp-item-group.cpp | 6 | ||||
| -rw-r--r-- | src/sp-item.cpp | 8 | ||||
| -rw-r--r-- | src/sp-lpe-item.cpp | 48 | ||||
| -rw-r--r-- | src/sp-lpe-item.h | 7 | ||||
| -rw-r--r-- | src/sp-spiral.cpp | 6 | ||||
| -rw-r--r-- | src/sp-star.cpp | 9 |
13 files changed, 69 insertions, 43 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 2e1160764..5674e29dc 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -563,8 +563,8 @@ void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) setCurrentShape(shape); doBeforeEffect(lpeitem); if (apply_to_clippath_and_mask && SP_IS_GROUP(sp_lpe_item)) { - sp_lpe_item->apply_to_clippath(sp_lpe_item); - sp_lpe_item->apply_to_mask(sp_lpe_item); + sp_lpe_item->applyToClipPath(sp_lpe_item); + sp_lpe_item->applyToMask(sp_lpe_item); } update_helperpath(); } diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp index 39714e629..ff5f738eb 100644 --- a/src/live_effects/lpe-bendpath.cpp +++ b/src/live_effects/lpe-bendpath.cpp @@ -152,6 +152,14 @@ LPEBendPath::resetDefaults(SPItem const* item) } void +LPEBendPath::transform_multiply(Geom::Affine const& postmul, bool set) +{ + if (sp_lpe_item) { + sp_lpe_item_update_patheffect(sp_lpe_item, false, false); + } +} + +void LPEBendPath::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec) { hp_vec.push_back(bp_helper_path); diff --git a/src/live_effects/lpe-bendpath.h b/src/live_effects/lpe-bendpath.h index 54c5d70fe..f232687ce 100644 --- a/src/live_effects/lpe-bendpath.h +++ b/src/live_effects/lpe-bendpath.h @@ -43,6 +43,8 @@ public: virtual void resetDefaults(SPItem const* item); + virtual void transform_multiply(Geom::Affine const& postmul, bool set); + void addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec); virtual void addKnotHolderEntities(KnotHolder * knotholder, SPItem * item); diff --git a/src/live_effects/lpe-measure-segments.h b/src/live_effects/lpe-measure-segments.h index 3b14fb191..903a5cbd2 100644 --- a/src/live_effects/lpe-measure-segments.h +++ b/src/live_effects/lpe-measure-segments.h @@ -44,7 +44,7 @@ public: virtual void doOnRemove (SPLPEItem const* /*lpeitem*/); virtual void doEffect (SPCurve * curve){}; //stop the chain virtual void doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/); - virtual void transform_multiply(Geom::Affine const& postmul, bool set); + virtual void transform_multiply(Geom::Affine const& postmul, bool set); virtual Geom::PathVector doEffect_path(Geom::PathVector const &path_in); void createLine(Geom::Point start,Geom::Point end, const char * id, bool main, bool remove, bool arrows = false); void createTextLabel(Geom::Point pos, size_t counter, double length, Geom::Coord angle, bool remove, bool valid); diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 89cf6fb43..67a742ed2 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -556,8 +556,6 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) return g_repr; } - - SP_LPE_ITEM(item)->removeAllPathEffects(true); SPCurve *curve = NULL; { SPShape *shape = dynamic_cast<SPShape *>(item); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 863d8858a..0bd611163 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -761,6 +761,10 @@ Inkscape::XML::Node* ObjectSet::group() { group->setPosition(topmost + 1); set(doc->getObjectByRepr(group)); + SPLPEItem *lpeitem = dynamic_cast<SPLPEItem*>(*(items().begin())); + if (lpeitem) { + sp_lpe_item_update_patheffect(lpeitem, true, true); + } DocumentUndo::done(doc, SP_VERB_SELECTION_GROUP, C_("Verb", "Group")); diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index bf50128f6..166237c8e 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -505,9 +505,9 @@ Geom::Affine SPGenericEllipse::set_transform(Geom::Affine const &xform) { if (hasPathEffect() && pathEffectsEnabled() && (this->hasPathEffectOfType(Inkscape::LivePathEffect::CLONE_ORIGINAL) || - this->hasPathEffectOfType(Inkscape::LivePathEffect::BEND_PATH) || - this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_MANY) || - this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_STROKES) ) ) + this->hasPathEffectOfType(Inkscape::LivePathEffect::BEND_PATH) || + this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_MANY) || + this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_STROKES) ) ) { // if path has this LPE applied, don't write the transform to the pathdata, but write it 'unoptimized' // also if the effect is type BEND PATH to fix bug #179842 diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 27bee1541..3d4d7b253 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -967,11 +967,7 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *top_group, bool write) } } } - //SPPath *sub_path = dynamic_cast<SPPath *>(sub_shape); - c = sub_shape->getCurveBeforeLPE(); - if (!c || (sub_shape->getCurve() != c)) { - c = sub_shape->getCurve(); - } + c = sub_shape->getCurve(); bool success = false; // only run LPEs when the shape has a curve defined if (c) { diff --git a/src/sp-item.cpp b/src/sp-item.cpp index a780f1a29..3fef28e5b 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -1406,9 +1406,11 @@ void SPItem::adjust_livepatheffect (Geom::Affine const &postmul, bool set) for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); ++it) { LivePathEffectObject *lpeobj = (*it)->lpeobject; - if (lpeobj && lpeobj->get_lpe()) { - Inkscape::LivePathEffect::Effect * effect = lpeobj->get_lpe(); - effect->transform_multiply(postmul, set); + if (lpeobj) { + Inkscape::LivePathEffect::Effect * lpe = lpeobj->get_lpe(); + if (lpe && lpe->isReady()) { + lpe->transform_multiply(postmul, set); + } } } } diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 6e30419ef..c0688f869 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -35,6 +35,7 @@ #include "inkscape.h" #include "desktop.h" #include "ui/shape-editor.h" +#include "path-chemistry.h" #include "sp-ellipse.h" #include "display/curve.h" #include "svg/svg.h" @@ -304,8 +305,8 @@ bool SPLPEItem::performPathEffect(SPCurve *curve, SPShape *current, bool is_clip } } if(!SP_IS_GROUP(this) && !is_clip_or_mask && has_clipormask_lpe){ - this->apply_to_clippath(this); - this->apply_to_mask(this); + this->applyToClipPath(this); + this->applyToMask(this); } } return true; @@ -437,7 +438,9 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths) } repr->setAttribute("inkscape:original-d", NULL); } else { - sp_lpe_item_update_patheffect(lpeitem, true, true); + if (!keep_paths) { + sp_lpe_item_update_patheffect(lpeitem, true, true); + } } } else if (SP_IS_SHAPE(lpeitem)) { Inkscape::XML::Node *repr = lpeitem->getRepr(); @@ -451,14 +454,25 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths) } mask = dynamic_cast<SPMask *>(lpeitem->parent); clip_path = dynamic_cast<SPClipPath *>(lpeitem->parent); - if ((!lpeitem->hasPathEffectRecursive() && repr->attribute("inkscape:original-d")) || - ((mask || clip_path) && !lpeitem->hasPathEffectOnClipOrMaskRecursive() && repr->attribute("inkscape:original-d"))) + if ((!lpeitem->hasPathEffectRecursive() && repr->attribute("d")) || + ((mask || clip_path) && !lpeitem->hasPathEffectOnClipOrMaskRecursive() && repr->attribute("d"))) { if (!keep_paths) { repr->setAttribute("d", NULL); + } else { + SPDesktop * desktop = SP_ACTIVE_DESKTOP; + if (desktop) { + std::vector<SPItem*> items; + items.push_back(SP_ITEM(lpeitem)); + std::vector<SPItem*> selected = items; + std::vector<Inkscape::XML::Node*> to_select; + sp_item_list_to_curves(items, selected, to_select, true); + } } } else { - sp_lpe_item_update_patheffect(lpeitem, true, true); + if (!keep_paths) { + sp_lpe_item_update_patheffect(lpeitem, true, true); + } } } @@ -583,8 +597,10 @@ void SPLPEItem::removeAllPathEffects(bool keep_paths) LivePathEffectObject *lpeobj = (*it)->lpeobject; if (lpeobj) { Inkscape::LivePathEffect::Effect * lpe = lpeobj->get_lpe(); - lpe->keep_paths = keep_paths; - lpe->doOnRemove(this); + if (lpe) { + lpe->keep_paths = keep_paths; + lpe->doOnRemove(this); + } } // unlink and delete all references in the list (*it)->unlink(); @@ -713,53 +729,53 @@ bool SPLPEItem::hasPathEffectRecursive() const } void -SPLPEItem::apply_to_clippath(SPItem *item) +SPLPEItem::applyToClipPath(SPItem *item) { SPClipPath *clip_path = item->clip_ref->getObject(); if(clip_path) { std::vector<SPObject*> clip_path_list = clip_path->childList(true); for ( std::vector<SPObject*>::const_iterator iter=clip_path_list.begin();iter!=clip_path_list.end();++iter) { SPObject * clip_data = *iter; - apply_to_clip_or_mask(SP_ITEM(clip_data), item); + applyToClipPathOrMask(SP_ITEM(clip_data), item); } } if(SP_IS_GROUP(item)){ std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(item)); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();++iter) { SPObject *subitem = *iter; - apply_to_clippath(SP_ITEM(subitem)); + applyToClipPath(SP_ITEM(subitem)); } } } void -SPLPEItem::apply_to_mask(SPItem *item) +SPLPEItem::applyToMask(SPItem *item) { SPMask *mask = item->mask_ref->getObject(); if(mask) { std::vector<SPObject*> mask_list = mask->childList(true); for ( std::vector<SPObject*>::const_iterator iter=mask_list.begin();iter!=mask_list.end();++iter) { SPObject * mask_data = *iter; - apply_to_clip_or_mask(SP_ITEM(mask_data), item); + applyToClipPathOrMask(SP_ITEM(mask_data), item); } } if(SP_IS_GROUP(item)){ std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(item)); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();++iter) { SPObject *subitem = *iter; - apply_to_mask(SP_ITEM(subitem)); + applyToMask(SP_ITEM(subitem)); } } } void -SPLPEItem::apply_to_clip_or_mask(SPItem *clip_mask, SPItem *item) +SPLPEItem::applyToClipPathOrMask(SPItem *clip_mask, SPItem *item) { if (SP_IS_GROUP(clip_mask)) { std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(clip_mask)); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();++iter) { SPItem *subitem = *iter; - apply_to_clip_or_mask(subitem, item); + applyToClipPathOrMask(subitem, item); } } else if (SP_IS_SHAPE(clip_mask)) { SPCurve * c = NULL; diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h index d5d4e118b..82f3940c1 100644 --- a/src/sp-lpe-item.h +++ b/src/sp-lpe-item.h @@ -94,14 +94,13 @@ public: void removeAllPathEffects(bool keep_paths); void addPathEffect(std::string value, bool reset); void addPathEffect(LivePathEffectObject * new_lpeobj); - void apply_to_mask(SPItem * item); - void apply_to_clippath(SPItem * item); - void apply_to_clip_or_mask(SPItem * clip_mask, SPItem * item); + void applyToMask(SPItem * item); + void applyToClipPath(SPItem * item); + void applyToClipPathOrMask(SPItem * clip_mask, SPItem * item); bool forkPathEffectsIfNecessary(unsigned int nr_of_allowed_users = 1); void editNextParamOncanvas(SPDesktop *dt); }; - void sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write); // careful, class already has method with *very* similar name! #endif /* !SP_LPE_ITEM_H_SEEN */ diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index f35d5e86b..a84fc6041 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -431,9 +431,9 @@ Geom::Affine SPSpiral::set_transform(Geom::Affine const &xform) { if (hasPathEffect() && pathEffectsEnabled() && (this->hasPathEffectOfType(Inkscape::LivePathEffect::CLONE_ORIGINAL) || - this->hasPathEffectOfType(Inkscape::LivePathEffect::BEND_PATH) || - this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_MANY) || - this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_STROKES) ) ) + this->hasPathEffectOfType(Inkscape::LivePathEffect::BEND_PATH) || + this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_MANY) || + this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_STROKES) ) ) { // if path has this LPE applied, don't write the transform to the pathdata, but write it 'unoptimized' // also if the effect is type BEND PATH to fix bug #179842 diff --git a/src/sp-star.cpp b/src/sp-star.cpp index ccc8323d4..9844df98a 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -512,18 +512,19 @@ void SPStar::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape:: Geom::Affine SPStar::set_transform(Geom::Affine const &xform) { bool opt_trans = (randomized == 0); + // Allow live effects if (hasPathEffect() && pathEffectsEnabled() && (this->hasPathEffectOfType(Inkscape::LivePathEffect::CLONE_ORIGINAL) || - this->hasPathEffectOfType(Inkscape::LivePathEffect::BEND_PATH) || - this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_MANY) || - this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_STROKES) ) ) + this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_MANY) || + this->hasPathEffectOfType(Inkscape::LivePathEffect::BEND_PATH) || + this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_STROKES) ) ) { // if path has this LPE applied, don't write the transform to the pathdata, but write it 'unoptimized' - // also if the effect is type BEND PATH to fix bug #179842 this->adjust_livepatheffect(xform); this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); return xform; } + // Only set transform with proportional scaling if (!xform.withoutTranslation().isUniformScale()) { // Adjust livepatheffect |
