From GIMP Developer Wiki
Revision as of 18:01, 4 June 2012 by Grafxuser (Talk | contribs)

Jump to: navigation, search

Specification for desired behaviors on toggle/untoggle Layer visibility now we have layer groups

The behaviors described here will be implemented ins a series of scripts along gimp2.9 development cycle, and tentatively made available for gimp 2.10

This topic was discussed in the developers mailing list in May of 2012 (subject 'Gimp-developer] feature: Set exclusive layer visibility within groups'). The following layer structure serves as example to clarify the proposals:

  • - G1
  • - - L1
  • - - G2
  • - - - L2
  • - - - L3
  • - L4
  • - G3
  • - - L5
  • - - L6

Scenario 1: all layers and groups are visible
Scenario 2: all layers and groups are visible, except L1 and G3

1. Current behaviour:
on top level: hide the other layers/groups, discard their former visibility state; on lower levels: leave layers/groups untouched

Scenario 1:
Shift+Click L2: hide L4, G3 -> show L4, G3
Shift+Click L4: hide G1, G3 -> show G1, G3

Scenario 2:
Shift+Click L2: hide L4 -> show L4, G3; Do not change L1
Shift+Click L4: hide L4 -> show L4, G3; Do not change L1

2. Proposal 1

  1. When toggling exclusive visibility, first note the full path from image root to the selected item (inclusively) and begin iterating through it.
  2. IF at any point along this path there are any visible sibling items, THEN hide them, leaving only the selected item visible, and break and return.
  3. Otherwise, if we have traversed the entire path without finding any visible siblings, then selected item is the only visible item in the whole image. (Whether the selected item is itself a layer or group is irrelevant.) Therefore, traverse the selected path again and ensure that any and all sibling items at any point along the path are made visible.

This would establish a toggle chain of all items -> selected group -> (subgroup, etc.) -> selected item in group -> all items.
It could also be reversed; all items -> selected item in group -> selected group -> (parent group, etc.) -> all items, but I'm not exactly sure how that logic would pan out. TODO: explain with the scenarios

3. Proposal 2:
Toggle visibility with respect to the former visibility state and the layer/group nesting hierarchy.
Exclusive visibility in group-> ... in the surrounding groups -> ... in the whole layer stack-> Restore previous visibility in the whole layer stack-> ... in the surrounding groups ->... in the current group -> Exclusive visibility in group->.....

Scenario 1:
Shift+Click L2: hide L3, hide L1, hide L4+G3, show L4+G3, show L1, show L3
Shift+Click L4: hide G1+G3, show G1+G3

Scenario 2:
Shift+Click L2: hide L3, hide L4, show L4, show L3. Leave L1 and G3 untouched.
Shift+Click L4: hide G1, show G1. Leave G3 and children of G1 untouched