Menu

#105 Merge Transformations

open
nobody
None
5
2003-07-21
2003-07-21
No

Currently, most transformations just sit on an object
as a transform tag. When this is data such as a move or
a scale, it is often just wasted space.

I don't know how easy it would be to do, but it would
be very nice to have a 'Merge Transformations' Button
which would make all the transform tags go away by
changing the other tags to to reflect the current
outwards appearance.

That was stated fairly badly, but I think it's a fairly
straightforward concept, so I hope you can understand
what the heck I'm talking about.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    If you meant to just take the transform data and 'put' it
    into the normal object tags (by recalculation them) I'm
    right behind you.

     
  • Lauris Kaplinski

    Logged In: YES
    user_id=19294

    There is now 2 features:
    Select/transform tool has 'optimize' mode, where it tries
    to remove transformation fro object.
    There is explicit 'Apply transformation' menu item, that
    does it explicitly.
    Currently it works for rects, paths and texts.

     
  • Gary

    Gary - 2004-02-27

    Logged In: YES
    user_id=984549

    Hi there, not sure how to use the "optimize" mode or the
    "Apply" feature correctly. I'm not even sure what they do.
    They don't really seem to do anything useful, that I can
    see... Anyway, I had the same thought so I cooked up a Perl
    script that sort of takes care of this. You can use the
    script from the command line, or from a script menu item in
    an editor like Nedit. Just give the text of the item/group
    to be transformed as input (not an argument).

    Note that this can only make changes to one item/group at a
    time, and only for translations (moves), no scale or rotate.
    I wanted this since I tend to work outside the defined page
    area a lot.

    If you use this, make sure to test and tweak.. It may not do
    exactly what you want. Here it is:

    #!/usr/bin/perl
    use strict;
    my @tr;
    @ARGV = ();
    while (<STDIN>) {
    @tr = (, ) if m/transform="translate\(([-.\d]+)[,
    ]+([-.\d]+)\)"/i;
    my $d = if m/ d="(.+)"$/;
    if ($d and @tr) {
    $_ = $d;
    my $f;
    $f .= while s/ *([MCLZz]) */ /;
    s/^ *(.+[^ ]) *$//;
    push @ARGV, while s/^ *([-.\d]+ [-.\d]+)//;
    foreach (@ARGV) {
    @_ = split;
    $_ = ' '.($_[0] + $tr[0]).' '.($_[1] + $tr[1]);
    }
    $_ =' d="';
    while ($f=~s/^(.)//){
    $_ .= " ";
    unless ( =~ /z/i){
    $_ .= shift;
    $_ .= (shift) . shift if eq 'C';
    }
    }
    $_ .= '"';
    }
    print;
    }

    It's not spectacular, but if someone wants to clean it up,
    please re-post it.
    Cheers.

     

Log in to post a comment.