reordered arguments for unwind paths extension

This commit is contained in:
Mario Voigt 2021-05-18 19:38:58 +02:00
parent 1df4de5379
commit 8c1ff97e8d
2 changed files with 14 additions and 9 deletions

View File

@ -6,9 +6,9 @@
<page name="tab_settings" gui-text="Paperfold for Inkscape">
<label appearance="header">Settings</label>
<param name="keep_original" type="bool" gui-text="Keep original paths" gui-description="If selected, the original paths get deleted">false</param>
<param name="break_apart" type="bool" gui-text="Break apart" gui-description="Split each path into single curve segments">false</param>
<param name="render_vertical_dividers" type="bool" gui-text="Render vertical dividers">true</param>
<param name="render_with_dashes" type="bool" gui-text="Use dash style for dividers">true</param>
<param name="break_apart" type="bool" gui-text="Break apart paths" gui-description="Split each path into single curve segments">false</param>
<param name="colorize" type="bool" gui-text="Colorize glue pairs" gui-description="Requires enabled 'Break apart' option">false</param>
<label appearance="header">Extrude Options</label>
<param name="extrude" type="bool" gui-text="Extrude">false</param>
<param name="extrude_height" type="float" min="0.000" max="99999.000" precision="3" gui-text="Extrude height">10.000</param>
<param name="unit" gui-text="Unit" type="optiongroup" appearance="combo">
@ -19,7 +19,8 @@
<option value="pt">pt</option>
<option value="px">px</option>
</param>
<param name="colorize" type="bool" gui-text="Colorize glue pairs" gui-description="Requires enabled 'Break apart' option">false</param>
<param name="render_vertical_dividers" type="bool" gui-text="Render vertical dividers">true</param>
<param name="render_with_dashes" type="bool" gui-text="Use dash style for dividers">true</param>
</page>
<page name="tab_about" gui-text="About">
<label appearance="header">Unwind Paths</label>

View File

@ -41,13 +41,13 @@ class UnwindPaths(inkex.EffectExtension):
pars.add_argument('--tab')
pars.add_argument('--keep_original', type=inkex.Boolean, default=False, help="If selected, the original paths get deleted")
pars.add_argument('--break_apart', type=inkex.Boolean, default=False)
pars.add_argument('--render_vertical_dividers', type=inkex.Boolean, default=False)
pars.add_argument('--render_with_dashes', type=inkex.Boolean, default=False)
pars.add_argument('--colorize', type=inkex.Boolean, default=False, help="Requires enabled 'Break apart' option")
pars.add_argument('--extrude', type=inkex.Boolean, default=False)
pars.add_argument('--extrude_height', type=float, default=10.000)
pars.add_argument('--unit', default="mm")
pars.add_argument('--colorize', type=inkex.Boolean, default=False, help="Requires enabled 'Break apart' option")
pars.add_argument('--render_vertical_dividers', type=inkex.Boolean, default=False)
pars.add_argument('--render_with_dashes', type=inkex.Boolean, default=False)
#if multiple curves are inside the path we split (break apart)
def breakContours(self, element, breakelements = None): #this does the same as "CTRL + SHIFT + K"
if breakelements == None:
@ -82,6 +82,10 @@ class UnwindPaths(inkex.EffectExtension):
def effect(self):
shifting = self.svg.unittouu(str(self.options.extrude_height) + self.options.unit)
#some mode handling
if self.options.colorize is True:
self.options.break_apart = True #required to make it work
if len(self.svg.selected) > 0:
#we break apart combined paths to get distinct contours
for element in self.svg.selection.filter(inkex.PathElement).values():
@ -122,7 +126,7 @@ class UnwindPaths(inkex.EffectExtension):
newOriginalPathGroup = self.svg.get_current_layer().add(inkex.Group(id="new-original-" + element.get('id')))
elemGroup.append(topLineGroup)
elemGroup.append(bottomLineGroup)
elemGroup.append(newOriginalPathGroup)
self.svg.get_current_layer().append(newOriginalPathGroup) #we want this to be one level above unwound stuff
if self.options.extrude is True:
vlinesGroup = self.svg.get_current_layer().add(inkex.Group(id="vlines-" + element.get('id')))