-
Notifications
You must be signed in to change notification settings - Fork 293
Description
Issue Summary
For a while now, when attempting to do things like drawing on a hidden layer, the action is prevented and a dialog pops up warning the user that the action cannot be performed on a hidden layer. I believe this is done primarily to prevent accidental modifications, but there may be some narrow situations where there are also technical reasons for this.
This is a non-exhaustive list of actions which can currently be performed on hidden layers:
- Clear frame
- Select all
- With selection active (with select all or by selecting before hiding the layer):
- Delete selection
- Move selection with arrow keys
- Cut selection
- Flip selection X/Y
- Paste
- Paste from previous frame
- Move key (timeline dragging and shortcuts)
Actual Results
Attempting to perform any of the aforementioned operations on a hidden layer will succeed and no dialog will be produced.
Expected Results
These operations should be prevented, and a warning dialog should be show to the user.
Pencil2D version
0.7.0, Nightly Build Sep 25 2025 (d3acc02)
Developer Notes
The most simple immediate solution would be to add layer visibility checks to all the actions mentioned, any others I may have missed. And I think such a solution should be welcome in the short term. However this isn't a very good long-term solution because it is easy to miss something, or forget to add a check when adding a new feature. I'm not sure where it's best to consolidate the logic for this. Maybe the layer and/or keyframe methods that modify themselves could return Status and have error types for hidden layers that the calling class from app is expected to handle and pass the information to the user.
If we make the check more generally for modifiability (isReadOnly() or canModify() perhaps) and it returns a reason if it cannot be modified, then that could be used to make implementing some features easier in the future, such as locking frames/layers, external file references (for read-only files especially), and loop instances.