> Date: Wed, 23 May 2012 18:04:49 +0200 > From: gfx user online de > To: gimp-developer-list gnome org > Subject: Re: [Gimp-developer] feature: Set exclusive layer visibility within groups > > Richard Gitschlag wrote: > > I have a little gripe about setting "exclusive visibility" > > (shift+click a layer's visibility icon) in an image. Now that we have > > layer groups in GIMP 2.8, it only functions on the "top level" of the > > layer stack -- it seems impossible to toggle exclusive visibility > > inside a group. > > > > Since a layer group can itself be a complex combination of layers > > (apparently including other layer groups!), we should have some > > ability to toggle exclusive visibility with respect to other members > > in that group only. > You're right. > > I'm also missing two other possibilities in changing layers' visibility: > 1) Only one layer can be selected at one time. It can be useful to make > just a few layers visible while hiding the others. Could it be made > possible to multiselect layers? That is an unrelated question. As far as I know GIMP only allows one 'active' layer at a time because that is the surface that any drawing operations are applied to. > 2) Shift-clicking on a layers visibility icon toggles between the state > of 'exclusive visibility' and the state 'all layers are visible', no > matter whether all layers were visible before. > > grafxuser On further reflection I agree - if you Shift+click on a layer within a group it should toggle between all items visible and THAT LAYER (regardless of location within the overall layer tree) exclusively. If you want to do this for an entire layer group as a whole, you Shift+click on the layer group. Simple! Besides, the behavior should be that your first Shift+clicking on a layer should hide all layers except that one, but I'm having difficulty figuring out the conceptual logic of making it unhide the parent layers (if any) one at a time -- too difficult to differentiate between that state and "all layers visible" state. After all, in the current behavior, if an image contains multiple layers but only some are visible, the first Shift+Click is to make only the selected layer visible. Only when the selected layer is the sole visible item does it restore visibility to all layers. So a better loop that preserves the two-state "all items -> selected layer only -> all items" click chain, but also supports layers within groups, would look like: 1 - Note the full layer path from image root to the selected item (excluding the selected item). It does not matter whether the selected item is itself a layer or group. (Note that if we clicked a top-level item, the path will have only contain one entry: the image root itself.) 2 - Begin iterating through the path starting at the top-level of the layer tree. 3 - At each node in the path, retrieve a list of all child nodes (layers or groups) and note which one actually belongs to the selected path. IF that item is not visible, OR if any other (sibling) items are visible, THEN the action to take is "set exclusive visibility = true"; we can break from the loop and proceed directly to step 6. 4 - Repeat step 3 until we have reached the end of the path. 5 - If we do reach the end of the path, this means the selected item is the only thing visible in the entire image (whether or not it is a group containing visible sublayers is irrelevant), and the action to take is "set exclusive visibility = false". 6 - Now that we've determined what action we are performing, iterate through the path a second time and apply visibility accordingly. If the child of a node belongs to the selected path, its visibility becomes true. Otherwise, it is only a sibling to such a node and its visibility becomes FALSE (show selected item only) or TRUE (show all items). Also, as you hinted above a way to toggle exclusive visibility with respect to the current item's group WITHOUT evaluating or affecting other layers higher up in the layer tree can also be useful. Maybe a Shift+Alt or Shift+Ctrl modifier for this purpose. The same logic above applies, except that instead of iterating the fullpath from top level to selected item, we'd be evaluating a partial path using the item's parent group only. -- Stratadrake strata_ranger hotmail com -------------------- Numbers may not lie, but neither do they tell the whole truth. |