extra option for offset paths
This commit is contained in:
parent
89128a94ef
commit
e053781ac7
@ -32,6 +32,7 @@
|
|||||||
</param>
|
</param>
|
||||||
<param name="copy_org" type="bool" gui-text="Keep original path" gui-description="If enabled, keeps original path as a copy">false</param>
|
<param name="copy_org" type="bool" gui-text="Keep original path" gui-description="If enabled, keeps original path as a copy">false</param>
|
||||||
<param name="individual" type="bool" gui-text="Separate into individual paths" gui-description="If enabled, each offset curve will be an individual svg element">false</param>
|
<param name="individual" type="bool" gui-text="Separate into individual paths" gui-description="If enabled, each offset curve will be an individual svg element">false</param>
|
||||||
|
<param name="group" type="bool" gui-text="Put all offset paths into group">true</param>
|
||||||
<param name="path_types" type="optiongroup" appearance="combo" gui-text="Path types to apply" gui-description="Process open, closed or all paths!">
|
<param name="path_types" type="optiongroup" appearance="combo" gui-text="Path types to apply" gui-description="Process open, closed or all paths!">
|
||||||
<option value="both">all paths</option>
|
<option value="both">all paths</option>
|
||||||
<option value="open_paths">open paths</option>
|
<option value="open_paths">open paths</option>
|
||||||
|
@ -37,6 +37,7 @@ class OffsetPaths(inkex.EffectExtension):
|
|||||||
pars.add_argument("--clipperscale", type=int, default=1024, help="Scaling factor. Should be a multiplicator of 2, like 2^4=16 or 2^10=1024. The higher the scale factor the higher the quality.")
|
pars.add_argument("--clipperscale", type=int, default=1024, help="Scaling factor. Should be a multiplicator of 2, like 2^4=16 or 2^10=1024. The higher the scale factor the higher the quality.")
|
||||||
pars.add_argument("--copy_org", type=inkex.Boolean, default=True, help="copy original path")
|
pars.add_argument("--copy_org", type=inkex.Boolean, default=True, help="copy original path")
|
||||||
pars.add_argument("--individual", type=inkex.Boolean, default=True, help="Separate into individual paths")
|
pars.add_argument("--individual", type=inkex.Boolean, default=True, help="Separate into individual paths")
|
||||||
|
pars.add_argument("--group", type=inkex.Boolean, default=True, help="Put all offset paths into group")
|
||||||
pars.add_argument("--path_types", default="both", help="Process open, closed or all paths!")
|
pars.add_argument("--path_types", default="both", help="Process open, closed or all paths!")
|
||||||
|
|
||||||
|
|
||||||
@ -125,8 +126,8 @@ class OffsetPaths(inkex.EffectExtension):
|
|||||||
newPaths.append(sol_p)
|
newPaths.append(sol_p)
|
||||||
|
|
||||||
if self.options.individual is True:
|
if self.options.individual is True:
|
||||||
parentGroup = pathElement.getparent().add(inkex.Group(id="g-offset-{}".format(pathElement.attrib["id"])))
|
|
||||||
parent = pathElement.getparent()
|
parent = pathElement.getparent()
|
||||||
|
if self.options.group is True: parentGroup = parent.add(inkex.Group(id="g-offset-{}".format(pathElement.attrib["id"])))
|
||||||
idx = parent.index(pathElement) + 1
|
idx = parent.index(pathElement) + 1
|
||||||
idSuffix = 0
|
idSuffix = 0
|
||||||
for newPath in newPaths:
|
for newPath in newPaths:
|
||||||
@ -134,9 +135,12 @@ class OffsetPaths(inkex.EffectExtension):
|
|||||||
elementId = copyElement.get('id')
|
elementId = copyElement.get('id')
|
||||||
copyElement.path = CubicSuperPath(newPath)
|
copyElement.path = CubicSuperPath(newPath)
|
||||||
copyElement.set('id', elementId + str(idSuffix))
|
copyElement.set('id', elementId + str(idSuffix))
|
||||||
parentGroup.append(copyElement)
|
if self.options.group is True:
|
||||||
|
parentGroup.append(copyElement)
|
||||||
|
else:
|
||||||
|
parent.append(copyElement)
|
||||||
idSuffix += 1
|
idSuffix += 1
|
||||||
parent.insert(idx, parentGroup)
|
if self.options.group is True: parent.insert(idx, parentGroup)
|
||||||
if self.options.copy_org is False:
|
if self.options.copy_org is False:
|
||||||
pathElement.delete()
|
pathElement.delete()
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user