1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-30 23:19:49 +00:00

Make layers uneditable when they're invisible

This commit is contained in:
Manolis Papadeas 2021-04-21 00:12:05 +03:00
parent b70ef905fa
commit 8363e9d8c7
4 changed files with 7 additions and 3 deletions

View file

@ -17,3 +17,7 @@ func _init(_name := tr("Layer") + " 0", _visible := true, _locked := false, _fra
frame_container = _frame_container
new_cels_linked = _new_cels_linked
linked_cels = _linked_cels
func can_layer_get_drawn() -> bool:
return visible && !locked

View file

@ -94,7 +94,7 @@ func update_pattern() -> void:
func draw_start(position : Vector2) -> void:
if Global.current_project.layers[Global.current_project.current_layer].locked or !Global.current_project.tile_mode_rects[Global.TileMode.NONE].has_point(position):
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn() or !Global.current_project.tile_mode_rects[Global.TileMode.NONE].has_point(position):
return
if Global.current_project.selected_pixels and not position in Global.current_project.selected_pixels:
return

View file

@ -179,7 +179,7 @@ func commit_undo(action : String) -> void:
func draw_tool(position : Vector2) -> void:
if Global.current_project.layers[Global.current_project.current_layer].locked:
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return
var strength := _strength
if Global.pressure_sensitivity_mode == Global.PressureSensitivity.ALPHA:

View file

@ -405,7 +405,7 @@ func toggle_fullscreen() -> void:
func image_menu_id_pressed(id : int) -> void:
if Global.current_project.layers[Global.current_project.current_layer].locked: # No changes if the layer is locked
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn(): # No changes if the layer is locked or invisible
return
var image : Image = Global.current_project.frames[Global.current_project.current_frame].cels[Global.current_project.current_layer].image
match id: