function to release object from group

Bug #484041 reported by Marcel Partap
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
insaner

Bug Description

hi,
through clicking with CTRL+ALT modifiers, one can select objects within a group. However the only way to separate them from that group is to ungroup the whole bundle, deselect it and regroup the rest. Was looking for a function to just release one object from its parent group but apparently it does not exist.. so reporting this and hoping for some eager beaver to put it in! ;-)

Tags: groups ui
su_v (suv-lp)
Changed in inkscape:
importance: Undecided → Wishlist
tags: added: groups
Revision history for this message
su_v (suv-lp) wrote :

This is already possible without un-grouping the parent group first: you can use the XML Editor to 'move' an individual element (a shape, path or nested group) outside the parent group.

related reports:
Bug #171806 “Layers/Groups Window”
<https://bugs.launchpad.net/inkscape/+bug/171806>
Bug #431877 “A group browser - almost like sublayers” (duplicate of bug #171806)
<https://bugs.launchpad.net/inkscape/+bug/431877>

related blueprint:
Better management of layers (duplicate, drag & drop)
<https://blueprints.launchpad.net/inkscape/+spec/better-layer-management>

tags: added: ui
Revision history for this message
ScislaC (scislac) wrote :

Another way to achieve this is to select what you want to remove from the group, cut (Ctrl+X), and then leave the group and Paste in Place (Ctrl+Alt+V).

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

Would it make sense to have the "Ungroup" command :
* Ungroup all grouped objects when the selection is the group
* Remove only the selected objects from the group when the selection is objects inside a group ?

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

Another existing (but undocumented) method to release a selection from a group:
1) enter the group (Ctrl+Enter)
2) select object(s)
3) use the layer command 'Move Selection to Layer Above' (Shift+PgUp)
4) quit group (Ctrl+Backspace)

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

Correction:
> 4) quit group (Ctrl+Backspace)
This step is not required: the current drawing level changes along with the moved selection.

Revision history for this message
Kris (kris-degussem) wrote :

After reading this report and considering that although the preferred behaviour can already be obtained, it would be good to make it more intuitive. It would be best imho to have the two options ("Ungroup selected", "Ungroup") in the drop down menu as per John Smith (comment 3). Logical position of the new options in the menu would be along with "Go to parent".

Changed in inkscape:
status: New → Confirmed
Revision history for this message
insaner (insaner) wrote :

just ran into the same issue, and began working on a fix. Patch in progress, basic functionality is done.

Changed in inkscape:
assignee: nobody → insaner (insaner)
Revision history for this message
insaner (insaner) wrote :

Hi guys, please test this patch out.

A file menu entry and context menu entries have been added with the name "Pop selected objects out of group". I chose "pop out of group" as the terminology since it does not "ungroup" the selected objects, but rather moves them out of the current group to the next level above which could be another group itself).

You can pop out a single object or a selection of objects.

known issues:
-the file menu entry is not greyed out when action cannot be performed
-using the XML browser to select the objects for some reason does not update the internal selection, and therefore you need to then go and click the objects on the canvas before you can perform the action
-popping out the only item in a group does not remove the empty group

any input on how to fix the above issues would be appreciated.

jazzynico (jazzynico)
Changed in inkscape:
status: Confirmed → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

Tested on Windows XP, Inkscape trunk revision 13963, with simple and nested groups. I didn't check the code, but the feature seems to work as expected.

> I chose "pop out of group" as the terminology since it does not "ungroup" the selected objects

"Remove from group" looks good too. And consistent with "Text>Remove from Path". "Pop selected objects out of group" seems far too long IMHO.

> the file menu entry is not greyed out when action cannot be performed

If I remember correctly (can't find a bug report), none of the menu entries can be greyed out. Only the context menu ones can.

> -using the XML browser to select the objects for some reason does not update the internal selection, and therefore you need to then go and click the objects on the canvas before you can perform the action

The fact that you're in a group is handled independently of the selected object. Another example: select an object in a group by double-clicking on it (you are in the group) and then use the Go to parent context menu command. The object is still selected, but you are considered outside of the group. But I have no idea on how it works exactly.

> popping out the only item in a group does not remove the empty group

What about testing the item count and, if all items from the group are moved, redirect to the ungroup command instead of the pop out one?

Revision history for this message
insaner (insaner) wrote :

Hi jazzynico, thanks for the feedback and testing.

If I were to shorten the context menu entry to just "Pop out of group" would that be OK?

I will have to find some time to implement the item count functionality you mention.

Revision history for this message
jazzynico (jazzynico) wrote :

> If I were to shorten the context menu entry to just "Pop out of group" would that be OK?

Yes, of course. Since it's for the trunk, we still have time to collect users comments and change the menu again if requested.

Revision history for this message
insaner (insaner) wrote :

I have knocked off most of the items raised over IRC. One thing though (or two), su_v said it might not be such a great idea to have the menu item greyed out for only this function, as that would be inconsistent. I think we should aim for consistency, but also for a simple design where the user isn't given options they can't carry out (and then might not see the error msg flash at the bottom). I have therefore included the code, but commented it out. Please provide feedback as to how to proceed. (Ie, should I uncomment and have the inconsistency for the time being, or leave it commented out until more consistency is coded in regards to greying out menu items?)

I can use the code as is as a parting point to at least do the grouping functions (group/ungroup) as well as probably easily the other "object" functions (when there is no object selected). If you guys want that, let me know, or better yet, file the bug and assign me.

In any case, please provide feedback for the code as-is. Especially for a few inline questions I left there because I was not sure if that was the best way to solve the problem. Thanks in advance.

Revision history for this message
Jabiertxof (jabiertxof) wrote :

Hi Insaner!

Not sure about the gray one, anyway I think is better use selection->single Item than begin() because the user realy know whats begin item? Also seems strange to me use the patch into a multiselection.

Cheers

Revision history for this message
insaner (insaner) wrote :

This fixes a mistakenly deleted line that caused a segfault when nothing is selected, as well as removing the commented out "disable menu" code, as requested.

jazzynico (jazzynico)
Changed in inkscape:
milestone: none → 0.92
Revision history for this message
insaner (insaner) wrote :

committed as r14845

Changed in inkscape:
status: In Progress → Fix Committed
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.