Hi!
I'm new to this forum, hope this is a good place to ask:
I'm writing a Live Path Effect. In the effect code, I need to get the label and/or id (the values you see in the Object Properties dialog) of the path object to which the effect is being applied. I tried this:
LivePathEffectObject *myLPE = (LivePathEffectObject*)this->getLPEObj();
myLPE->defaultLabel();
... but of course this gets me the label of the path effect, not the path.
Any suggesitons welcome...
Getting object label/id in C++ code.
Re: Getting object label/id in C++ code.
Got the answer courtesy of Johan via the inkscape-devel mailing list (Thanks Johan!). Will post here in case it helps anyone else:
By design, LPEs do not know about SVG objects and all that. An LPE just receives a path (the actual path data only) and should output a path.However, a trick was implemented to allow for some special LPEs that need a bit more information. Have a look at Effect::doBeforeEffect, which is called before doEffect and receives the item on which the LPE is applied (LPEBendPath uses it for example). Careful though: test whether your stuff works when the LPE is applied on a group!-
By design, LPEs do not know about SVG objects and all that. An LPE just receives a path (the actual path data only) and should output a path.However, a trick was implemented to allow for some special LPEs that need a bit more information. Have a look at Effect::doBeforeEffect, which is called before doEffect and receives the item on which the LPE is applied (LPEBendPath uses it for example). Careful though: test whether your stuff works when the LPE is applied on a group!-