diff --git a/src/Classes/Layer.gd b/src/Classes/Layer.gd index 357f22c81..9a2bb85f2 100644 --- a/src/Classes/Layer.gd +++ b/src/Classes/Layer.gd @@ -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 diff --git a/src/Tools/Bucket.gd b/src/Tools/Bucket.gd index 3d37d7c71..37ad806b5 100644 --- a/src/Tools/Bucket.gd +++ b/src/Tools/Bucket.gd @@ -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 diff --git a/src/Tools/Draw.gd b/src/Tools/Draw.gd index 776fc9b08..104e108a7 100644 --- a/src/Tools/Draw.gd +++ b/src/Tools/Draw.gd @@ -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: diff --git a/src/UI/TopMenuContainer.gd b/src/UI/TopMenuContainer.gd index 9607478f2..d25a2bdcd 100644 --- a/src/UI/TopMenuContainer.gd +++ b/src/UI/TopMenuContainer.gd @@ -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: