Auto-palette swatches duplicated on copy and paste

Bug #643150 reported by Guillermo Espertino (Gez)
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
John Smith

Bug Description

If a drawing containing spot swatches is copied and pasted, a new duplicate of the existing swatches is created for each object copied, resulting in a huge amount of duplicates.
I think that once a color is assigned as spot swatch, it shouldn't be duplicated at all, regardless the preferences setting about how to treat gradient definitions.

Tags: color
Changed in inkscape:
assignee: nobody → Jon A. Cruz (jon-joncruz)
su_v (suv-lp)
tags: added: color
Revision history for this message
su_v (suv-lp) wrote :

Reproduced with Inkscape 0.48+devel r9772 on OS X 10.5.8

Pasting object(s) with a swatch color duplicates the entries in the auto-palette; 'Dupllicate' (Ctrl+D) does not.

Note that both commands (paste, duplicate) are not affected by the preference setting 'Prevent sharing of gradient definitions' (the setting only prevents forking when editing a (shared) gradient on-canvas or in the gradient editor).

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote :

This bug also affects the process of pasting styles. A new definition is created each time the style is pasted.
A nasty side effect of this bug is the huge performance hit that so many duplicated gradients cause, making it almost impossible to work with the document.
So I'm marking the importance of this bug as high, because it affects documents in a really bad way, that it's also difficult to revert (the definitions have to be removed one by one, or the fill of each element has to be re-assigned manually).

Changed in inkscape:
importance: Undecided → High
Changed in inkscape:
milestone: none → 0.48.1
Revision history for this message
su_v (suv-lp) wrote :

@Gez - the milestone 0.48.1 is unrealistic: Inkscape 0.48.1 is to be released any day now, and there has been no activity here nor a patch available.

Revision history for this message
su_v (suv-lp) wrote :

<off-topic>
Also - while I do understand that the issue is important to you, I doubt that priority 'High' is in accordance with bug triage as described in <http://wiki.inkscape.org/wiki/index.php/Bug_management#Bug_importance>. Normally we use it for bugs which e.g. trigger a crash, data-loss or build failure.
</off-topic>

Changed in inkscape:
milestone: 0.48.1 → none
Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote :

I wanted to check if 0.48.2 was listed and I must have clicked on 0.48.1 accidentally. I'm aware that 0.48.1 is waiting for packaging. My apologies for the inconvenience, I just removed the milestone mark.

Back to the topic, I marked this bug as important because it could cause data-loss colaterally. See, if you copy and paste a complex design with a large amount of elements with swatch fills or strokes, inkscape locks until every swatch definition is duplicated. In extreme cases it can take several minutes, and a user unaware of this situation could interpret this as a program lock (it won't respond to esc, and during the lock the window won't be redrawn if it's minimized and restored).
I wouldn't say it's just important for me. At least I know the situation and I can avoid it.

su_v (suv-lp)
Changed in inkscape:
milestone: none → 0.49
Revision history for this message
su_v (suv-lp) wrote :

@Gez - would you agree that sharing custom swatches should be optionally allowed when importing SVG files, too, to share (spot) color definitions instead of duplicating them (i.e. not limited to when copy&pasting objects or styles within the same document)? I figure that within a project (possible splitted into several files, and merged into a single one for the final layout), it would be useful to optionally keep the same spot colors defined and reused/shared in the imported parts as well.

Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote :

@~suv:
I think colors marked as spot should never be duplicated. Ever.
If you copy/paste items they should reference to a single spot color. Two identical spot colors in the same palete is something that doesn't make sense.
So yes, if you import a file that has a spot color that uses the same name/color value, it should be merged into a single swatch and never duplicated.

p.s.: Sorry for the late reply :)

Revision history for this message
John Smith (john-smithi) wrote :

Here is a patch that should not duplicate solid swatches when copy/pasting within a doc or importing from another doc.
Other defs (patterns / regular gradients etc) should not be affected, but it should now be easy to stop gradients from being duplicated as well. Please test if you can, to ensure no other side effects are occuring.

Changed in inkscape:
assignee: Jon A. Cruz (jon-joncruz) → John Smith (john-smithi)
status: Confirmed → In Progress
Revision history for this message
ScislaC (scislac) wrote :

Looks good. If others would be so kind as to double check that I didn't overlook things in my limited testing, that would be greatly appreciated.

Revision history for this message
John Smith (john-smithi) wrote :

Committed as r11677 - please test if you can.
Should prevent duplicate swatches on copy/paste and svg file import.

Changed in inkscape:
status: In Progress → Fix Committed
Revision history for this message
insaner (insaner) wrote :

how difficult would it be to get this to work with /all/ swatches (not just spot colors)? i am working on a project that has a main file, but i do small designs of objects in their own files, and then paste them into the main file.. right now, some swatches appear some 10+ times.. and all except one are unused.

would it be possible to detect a swatch being pasted with the same name and then compare its properties (gradient etc) and if equal, just reuse the swatch already in the doc? from what ive understood of swatches, thats the whole point, right?

Revision history for this message
insaner (insaner) wrote :

the fix in comment #8 has been traced to cause bug #1171109 ... i have started looking into this, but john-smithi , if you could contact me to discuss this (especially if you cant fix this right now) that would really help me a bunch. thanks

Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
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.