added option "keep selected" to longest cont. path extension
This commit is contained in:
parent
23cdd26c4f
commit
817a0d35e1
@ -8,7 +8,8 @@
|
|||||||
<option value="1">Allow some</option>
|
<option value="1">Allow some</option>
|
||||||
<option value="2">Allow none</option>
|
<option value="2">Allow none</option>
|
||||||
</param>
|
</param>
|
||||||
<param name="enableLog" type="bool" gui-text="Debug">false</param>
|
<param name="enableLog" type="bool" gui-text="Show debug log">false</param>
|
||||||
|
<param name="keepSelected" type="bool" gui-text="Keep selected elements">false</param>
|
||||||
<effect>
|
<effect>
|
||||||
<object-type>path</object-type>
|
<object-type>path</object-type>
|
||||||
<effects-menu>
|
<effects-menu>
|
||||||
|
@ -168,6 +168,7 @@ class OptimizePaths(inkex.GenerateExtension):
|
|||||||
self.arg_parser.add_argument("-t", "--tolerance", type=float, default=0.1, help="the distance below which 2 nodes will be merged")
|
self.arg_parser.add_argument("-t", "--tolerance", type=float, default=0.1, help="the distance below which 2 nodes will be merged")
|
||||||
self.arg_parser.add_argument("-l", "--enableLog", type=inkex.Boolean, default=False, help="Enable logging")
|
self.arg_parser.add_argument("-l", "--enableLog", type=inkex.Boolean, default=False, help="Enable logging")
|
||||||
self.arg_parser.add_argument("-o", "--overwriteRule", type=int, default=1, help="Options to control edge overwrite rules")
|
self.arg_parser.add_argument("-o", "--overwriteRule", type=int, default=1, help="Options to control edge overwrite rules")
|
||||||
|
self.arg_parser.add_argument("-k", "--keepSelected", type=inkex.Boolean, default=False, help="Keep selected elements")
|
||||||
|
|
||||||
def parseSVG(self):
|
def parseSVG(self):
|
||||||
vertices = []
|
vertices = []
|
||||||
@ -195,6 +196,12 @@ class OptimizePaths(inkex.GenerateExtension):
|
|||||||
else:
|
else:
|
||||||
self.log("This extension only works with paths and currently doesn't support groups")
|
self.log("This extension only works with paths and currently doesn't support groups")
|
||||||
|
|
||||||
|
if self.options.keepSelected is False:
|
||||||
|
for object in objects:
|
||||||
|
if object.getparent() is not None:
|
||||||
|
#inkex.utils.debug(object.get('id'))
|
||||||
|
object.getparent().remove(object)
|
||||||
|
|
||||||
return (vertices, edges)
|
return (vertices, edges)
|
||||||
|
|
||||||
# Also computes edge weight
|
# Also computes edge weight
|
||||||
|
Reference in New Issue
Block a user