ID clash when copying/importing gradients across documents

Bug #165936 reported by Kidproto
48
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
sas

Bug Description

Originally I though there is mainly an issue with
patterns/tiles in that a shape using a pattern when
copied from document A to document B, the pattern (a
DEF) is not copied along with the shape.

The same case goes for gradients, and I'm sure for
other DEFs.

I tried this with a gradient and if one uses a standard
gradient that works (as I'm sure there is some hack to
help this along). If one changes the gradient in
document A, or creates a new gradient and then copies
that shape with gradient to document B, the gradient is
eiather like the older/predefined gradient, or if a new
gradient in DEF, the gradient does not show up.

This is an annoying bug. You rule supreme if you fix
this...

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Please ALWAYS attach a sample file. This bug was reported as
fixed long ago, I have just checked it and it works in
simple cases as you describe. If it's breaking in some
situation, we need a sample (both from and to documents for
which the copy does not work).

Revision history for this message
Kidproto (kidproto) wrote :

My apologies...here is a sample file.

I tried CVS today which is 2004-09-09 and the patterns copy
fine between docs. I was having a problem with them copying
yesterday on a build from maybe a week ago.

However, I can get gradients to not work properly by
creating one gradient on a simple shape, then copying it to
a new or another document and then it looks ok and is the
same. But, after changing one of the documents gradient with
the gradient editor (which keeps it the same DEF id), and
then copying back to the other doc, it reverts to the old
color. That is incorrect behavior, but I am lowering the
necessity of this fix and am attaching two docs.

Revision history for this message
Kidproto (kidproto) wrote : Test file 02 with gradient

Other attachments

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

So this is caused by the unresolved ID clash between the
newly pasted gradient and the one already in the document.
As a workaround, you can manually rename the gradient and
the reference to it in the source document or in the target
document before copy/paste.

Revision history for this message
jimmac (jimmac) wrote :

Not having right to boost a priority of this bug, let me
just whine here that this is quite a showstopper for me.
Many times I need to assemble an image consisting of various
artwork that shares elements and thus has gradients with
same ids.

I can't just take an image, copy and paste into this collage
image without gradients going all screwy.

Reusing the same gradient on multiple objects is a good
functionality, mostly comming from the SVG spec side of
things though. As an artist, if I consider filesize an issue
or want to have gradient changes apply to everything, I can
go an manually pick the same gradients to be used by
multiple objects. I consider this a very special case.

By default Inkscape should just create a new gradient every
time a new object gets created. Copying objects should not
point to the same gradient defs.

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

I think we have a good balance of sharing/forking gradients.
There're really no reason to fork it when all you do is
duplicate an object. However it's automatically forked when
you do anything to it that would affect gradient. The ONLY
way to change one gradient and to have more than one object
display that is by editing it in the gradient editor; this
is why the Edit... button has a Duplicate button right
beside it. Perhaps after I implement HSL controls on
multiple objects we can get rid of this sharing too (so a
gradient would fork everytime you open Gradient Editor with
it) but for now it should stay, because changing the
gradient on many objects at once is a useful feature.

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Originator: NO

4 more bugs closed as duplicates of this one

hash (hash-g)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
sas (sas-sas) wrote :

I've fixed this for importing (bug 168626). I haven't looked at copying yet, but it's likely that the clash-resolving functions could be moved to a separate file and used for that case too.

sas (sas-sas)
Changed in inkscape:
assignee: nobody → sas-sas
status: Confirmed → In Progress
Revision history for this message
sas (sas-sas) wrote :

Here's a patch for resolving ID clashes when pasting.

I had to extend the clash-resolution functions to handle inkscape:clipboard elements in order to get "paste style" working properly.

I've moved the clash-resolution stuff out of file.cpp, as it's no longer appropriate there.

Revision history for this message
sas (sas-sas) wrote :

Added to SVN (revision 19036).

Changed in inkscape:
status: In Progress → Fix Released
jazzynico (jazzynico)
Changed in inkscape:
milestone: none → 0.47
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.