kopia lustrzana https://github.com/inkstitch/inkstitch
add satins only option to force lock stitch extension (#2773)
rodzic
ea4d48119a
commit
3121bbaedf
|
@ -20,6 +20,7 @@ class LetteringForceLockStitches(InkstitchExtension):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
InkstitchExtension.__init__(self, *args, **kwargs)
|
InkstitchExtension.__init__(self, *args, **kwargs)
|
||||||
|
self.arg_parser.add_argument("-s", "--satin_only", type=inkex.Boolean, dest="satin_only")
|
||||||
self.arg_parser.add_argument("-a", "--max_distance", type=float, default=3, dest="max_distance")
|
self.arg_parser.add_argument("-a", "--max_distance", type=float, default=3, dest="max_distance")
|
||||||
self.arg_parser.add_argument("-i", "--min_distance", type=float, default=1, dest="min_distance")
|
self.arg_parser.add_argument("-i", "--min_distance", type=float, default=1, dest="min_distance")
|
||||||
self.arg_parser.add_argument("-l", "--last_element", type=inkex.Boolean, dest="last_element")
|
self.arg_parser.add_argument("-l", "--last_element", type=inkex.Boolean, dest="last_element")
|
||||||
|
@ -65,7 +66,7 @@ class LetteringForceLockStitches(InkstitchExtension):
|
||||||
# set force lock stitches attribute if needed
|
# set force lock stitches attribute if needed
|
||||||
for last_element in last_elements:
|
for last_element in last_elements:
|
||||||
last_element.attrib.pop('lastglyphelement')
|
last_element.attrib.pop('lastglyphelement')
|
||||||
if self.options.last_element:
|
if self.options.last_element and not (self.options.satin_only and not last_element.get('inkstitch:satin_column', False)):
|
||||||
last_element.set(INKSTITCH_ATTRIBS['force_lock_stitches'], True)
|
last_element.set(INKSTITCH_ATTRIBS['force_lock_stitches'], True)
|
||||||
|
|
||||||
# hide glyph layers again
|
# hide glyph layers again
|
||||||
|
@ -74,7 +75,9 @@ class LetteringForceLockStitches(InkstitchExtension):
|
||||||
def _set_force_attribute(self, first_stitch, last_stitch, previous_element):
|
def _set_force_attribute(self, first_stitch, last_stitch, previous_element):
|
||||||
distance_mm = first_stitch.distance(last_stitch) / PIXELS_PER_MM
|
distance_mm = first_stitch.distance(last_stitch) / PIXELS_PER_MM
|
||||||
|
|
||||||
if distance_mm < self.options.max_distance and distance_mm > self.options.min_distance:
|
if (distance_mm < self.options.max_distance and
|
||||||
|
distance_mm > self.options.min_distance and
|
||||||
|
not (self.options.satin_only and not previous_element.get_boolean_param('satin_column', False))):
|
||||||
previous_element.node.set(INKSTITCH_ATTRIBS['force_lock_stitches'], True)
|
previous_element.node.set(INKSTITCH_ATTRIBS['force_lock_stitches'], True)
|
||||||
|
|
||||||
def _update_layer_visibility(self, display):
|
def _update_layer_visibility(self, display):
|
||||||
|
|
|
@ -20,8 +20,12 @@
|
||||||
<label indent="1">
|
<label indent="1">
|
||||||
This extension has been build to help font authors to define "force lock stitches"-attributes automatically if they are placed in a predefined distance to the next object.
|
This extension has been build to help font authors to define "force lock stitches"-attributes automatically if they are placed in a predefined distance to the next object.
|
||||||
</label>
|
</label>
|
||||||
<param indent="1" name="min_distance" type="float" gui-text="Minimum distance (mm)" min="0" max="3">1</param>
|
<spacer />
|
||||||
<param indent="1" name="max_distance" type="float" gui-text="Maximum distance (mm)" min="1" max="10">3</param>
|
<separator />
|
||||||
|
<spacer />
|
||||||
|
<param indent="1" name="satin_only" type="boolean" gui-text="Restrict to Satin">false</param>
|
||||||
|
<param indent="1" name="min_distance" type="float" gui-text="Minimum distance (mm)" min="0" max="20">1</param>
|
||||||
|
<param indent="1" name="max_distance" type="float" gui-text="Maximum distance (mm)" min="1" max="20">3</param>
|
||||||
<separator />
|
<separator />
|
||||||
<param indent="1" name="last_element" type="boolean" gui-text="Add force lock stitches attribute to the last element of each glyph">false</param>
|
<param indent="1" name="last_element" type="boolean" gui-text="Add force lock stitches attribute to the last element of each glyph">false</param>
|
||||||
<script>
|
<script>
|
||||||
|
|
Ładowanie…
Reference in New Issue