diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2015-09-17 00:33:36 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2015-09-17 00:33:36 +0000 |
| commit | e3695d9cfcc753be45cbee0733751f6950191145 (patch) | |
| tree | 50e172cd2951e8e5c0cf5b5b32e5e84133699632 | |
| parent | Extensions. Interpolate: set same default value for zsort in OptionParser as ... (diff) | |
| download | inkscape-e3695d9cfcc753be45cbee0733751f6950191145.tar.gz inkscape-e3695d9cfcc753be45cbee0733751f6950191145.zip | |
Extensions. Interpolate attribute in group: use z-order instead of selection order for multiple selection
(bzr r14374)
| -rw-r--r-- | share/extensions/interp_att_g.inx | 1 | ||||
| -rwxr-xr-x | share/extensions/interp_att_g.py | 13 |
2 files changed, 12 insertions, 2 deletions
diff --git a/share/extensions/interp_att_g.inx b/share/extensions/interp_att_g.inx index 39c043519..7a0ef1d5c 100644 --- a/share/extensions/interp_att_g.inx +++ b/share/extensions/interp_att_g.inx @@ -40,6 +40,7 @@ <item>cm</item> <item>mm</item> </param> + <param name="zsort" type="boolean" _gui-text="Use Z-order" _gui-description="Workaround for reversed selection order in Live Preview cycles" gui-hidden="true">true</param> </page> <page name="Help" _gui-text="Help"> <_param name="intro" type="description">This effect applies a value for any interpolatable attribute for all elements inside the selected group or for all elements in a multiple selection.</_param> diff --git a/share/extensions/interp_att_g.py b/share/extensions/interp_att_g.py index 0798f7f58..168e7ffb0 100755 --- a/share/extensions/interp_att_g.py +++ b/share/extensions/interp_att_g.py @@ -23,6 +23,7 @@ import string # local library import inkex import simplestyle +from pathmodifier import zSort inkex.localize() @@ -58,6 +59,10 @@ class InterpAttG(inkex.Effect): action="store", type="string", dest="unit", default="color", help="Values unit.") + self.OptionParser.add_option("--zsort", + action="store", type="inkbool", + dest="zsort", default=True, + help="use z-order instead of selection order") self.OptionParser.add_option("--tab", action="store", type="string", dest="tab", @@ -116,8 +121,12 @@ class InterpAttG(inkex.Effect): return False if len( self.selected ) > 1: # multiple selection - self.collection = self.options.ids - for i in self.options.ids: + if self.options.zsort: + sorted_ids = zSort(self.document.getroot(),self.selected.keys()) + else: + sorted_ids = self.options.ids + self.collection = list(sorted_ids) + for i in sorted_ids: path = '//*[@id="%s"]' % i self.collection[self.tot_el] = self.document.xpath(path, namespaces=inkex.NSS)[0] self.tot_el += 1 |
