![](https://secure.gravatar.com/avatar/c41bd7e32c84a9734a2bb5e390873d4a.jpg?s=120&d=mm&r=g)
Hi all,
I prefer adding objects into a group before applying a mask, because it allows me to manipulate masked content easily without unsetting mask. But I often forget to group objects before I apply a clip/mask. So I decided to take a look at inkscape source code and made this little feature that does it automatically for me. It needs one more thing to work properly though - when automatically enclosing each object in a group it should mark that group as made by that feature so when unsetting mask it ungroups only those automatically added groups.
So where should be stored some info about whether this group should be automatically removed? There are two possibilities that I think of: either inkscape:groupmode attribute or custom attribute for this purpose
Also, is it sufficient to manipulate those attributes directly or is there any class that takes responsibility for this? At least there is some code managing inkscape:groupmode attribute, right?
I've added a new checkbox in Inkscape Preferences/Clippaths and masks called "Enclose masked objects in groups" to activate this feature (disabled by default to be consistent with previous behavior), so don't forget to check it before testing ;)
As I'm not very familar with C++ or Inkscape source code I hope I've not introduced any memory leaks or crashes. Also if you find any coding style violations, please notify me.
Patch attached.
Any comments are welcome ;)
Best regards, Martin Sucha