On 8/10/05, Nicklas Lindgren <nili@...612...> wrote:
The problem seems to be, that they aren't restored later, but they are restored first, with the call to pattern_tile just above the mentioned code. Therefore the objects are in effect duplicated instead, and their id-attributes are changed. After that the objects with the original ids are silently deleted.
The problem is solvable by moving the deletion before the call to pattern_tile.
Hmm, I don't remember off hand, but that definitely was the original intent: delete the object, then create it anew with the same id. In fact the same sequence of actions is used in a lot of commands, so this is almost a cliche. I'm not sure why it's broken here, but of course it must be fixed.
But this exposes another problem. A transform is applied to all objects in the pattern to anchor the top-left in 0,0. Applying a transform to a clone-original affects all the clones, and affects clones included in the pattern twice.
I think that here you could use the same hack I did in the Align dialog. It was the same problem: when aligning or distributing an original with its clones, it went awry because movements of the original disturbed clones. So I did this: before the moves I set the preference to "clones unmoved", which results in each clone feeling the move of its original and reversing it automatically, so it stays unmoved. After that the preference is restored to its previous value. Look it up in ui/dialog/align.cpp.
However note that for this to work, you need to actually move objects by the regular transform functions, not just assign it a transform= attribute. The signal for clones to adjust themselves is sent by sp_item_write_transform, so you need to use either it or some function that calls it eventually.
An alternative that seems to be simpler is to apply x and y attributes to the newly created pattern element, rather than transforming each contained object, but this seems to make pattern-drawing buggy :-(.
Yeah, I think I tried that but it didn't work. If you can make it work, however, clones would still be distirbed, even if the parent of the original moves, not the original itself.