summaryrefslogtreecommitdiffstats
path: root/share/extensions/interp.py
diff options
context:
space:
mode:
Diffstat (limited to 'share/extensions/interp.py')
-rwxr-xr-xshare/extensions/interp.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/share/extensions/interp.py b/share/extensions/interp.py
index 459190c0e..093a98fda 100755
--- a/share/extensions/interp.py
+++ b/share/extensions/interp.py
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-import inkex, cubicsuperpath, simplestyle, copy, math, bezmisc, simpletransform
+import inkex, cubicsuperpath, simplestyle, copy, math, bezmisc, simpletransform, pathmodifier
def numsegs(csp):
return sum([len(p)-1 for p in csp])
@@ -103,6 +103,10 @@ class Interp(inkex.Effect):
action="store", type="inkbool",
dest="style", default=True,
help="try interpolation of some style properties")
+ self.OptionParser.add_option("--zsort",
+ action="store", type="inkbool",
+ dest="zsort", default=False,
+ help="use z-order instead of selection order")
def tweenstyleunit(self, property, start, end, time): # moved here so we can call 'unittouu'
sp = self.unittouu(start[property])
@@ -122,7 +126,15 @@ class Interp(inkex.Effect):
paths = {}
styles = {}
- for id in self.options.ids:
+
+ if self.options.zsort:
+ # work around selection order swapping with Live Preview
+ sorted_ids = pathmodifier.zSort(self.document.getroot(),self.selected.keys())
+ else:
+ # use selection order (default)
+ sorted_ids = self.options.ids
+
+ for id in sorted_ids:
node = self.selected[id]
if node.tag ==inkex.addNS('path','svg'):
paths[id] = cubicsuperpath.parsePath(node.get('d'))
@@ -131,13 +143,13 @@ class Interp(inkex.Effect):
if trans:
simpletransform.applyTransformToPath(simpletransform.parseTransform(trans), paths[id])
else:
- self.options.ids.remove(id)
+ sorted_ids.remove(id)
- for i in range(1,len(self.options.ids)):
- start = copy.deepcopy(paths[self.options.ids[i-1]])
- end = copy.deepcopy(paths[self.options.ids[i]])
- sst = copy.deepcopy(styles[self.options.ids[i-1]])
- est = copy.deepcopy(styles[self.options.ids[i]])
+ for i in range(1,len(sorted_ids)):
+ start = copy.deepcopy(paths[sorted_ids[i-1]])
+ end = copy.deepcopy(paths[sorted_ids[i]])
+ sst = copy.deepcopy(styles[sorted_ids[i-1]])
+ est = copy.deepcopy(styles[sorted_ids[i]])
basestyle = copy.deepcopy(sst)
if basestyle.has_key('stroke-width'):
basestyle['stroke-width'] = self.tweenstyleunit('stroke-width',sst,est,0)