Specs:Visibility

From GIMP Developer Wiki
Revision as of 20:13, 6 June 2012 by Grafxuser (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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
Scenario 1:
Shift+Click L2:
Shift+Click L4:

Scenario 2:
Shift+Click L2:
Shift+Click L4:

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

4. Proposal 3:
toggle all other layers/groups on/off with respect to their former visibility state.
Scenario 1:
Shift+Click L2: show only L2 and hide all other layers/groups -> hide only L2 and show all other layers/groups
Shift+Click L4: show only L4 and hide all other layers/groups -> hide only L4 and show all other layers/groups

Scenario 2:
Shift+Click L2: show only L2 and hide all other layers/groups -> hide only L2+L1+G3 and show all other layers/groups
Shift+Click L4: show only L4 and hide all other layers/groups -> hide only L4+L1+G3 and show all other layers/groups

5. Proposal 4:
When clicking on a layer group, cycle through four states: show layer group without affecting child layers visibility -> hide layer group without affecting child layers visibility -> hide layer group and all its children at once-> show layer group and all its children at once
Scenario 1:
Click G1: show G1 and all its children -> hide G1 and all its children -> hide G1 and all its children -> show G1 and all its children

Scenario 2:
Click G1: G1+G2+L2+L3 visible, L1 invisible -> G1 invisible, L1 invisible, G2+L2+L3 'visible' (but hidden by G1) -> G1 and all its children invisible -> G1 and all its children visible