mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Make layers uneditable when they're invisible
This commit is contained in:
parent
b70ef905fa
commit
8363e9d8c7
|
@ -17,3 +17,7 @@ func _init(_name := tr("Layer") + " 0", _visible := true, _locked := false, _fra
|
||||||
frame_container = _frame_container
|
frame_container = _frame_container
|
||||||
new_cels_linked = _new_cels_linked
|
new_cels_linked = _new_cels_linked
|
||||||
linked_cels = _linked_cels
|
linked_cels = _linked_cels
|
||||||
|
|
||||||
|
|
||||||
|
func can_layer_get_drawn() -> bool:
|
||||||
|
return visible && !locked
|
||||||
|
|
|
@ -94,7 +94,7 @@ func update_pattern() -> void:
|
||||||
|
|
||||||
|
|
||||||
func draw_start(position : Vector2) -> 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
|
return
|
||||||
if Global.current_project.selected_pixels and not position in Global.current_project.selected_pixels:
|
if Global.current_project.selected_pixels and not position in Global.current_project.selected_pixels:
|
||||||
return
|
return
|
||||||
|
|
|
@ -179,7 +179,7 @@ func commit_undo(action : String) -> void:
|
||||||
|
|
||||||
|
|
||||||
func draw_tool(position : Vector2) -> 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
|
return
|
||||||
var strength := _strength
|
var strength := _strength
|
||||||
if Global.pressure_sensitivity_mode == Global.PressureSensitivity.ALPHA:
|
if Global.pressure_sensitivity_mode == Global.PressureSensitivity.ALPHA:
|
||||||
|
|
|
@ -405,7 +405,7 @@ func toggle_fullscreen() -> void:
|
||||||
|
|
||||||
|
|
||||||
func image_menu_id_pressed(id : int) -> 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
|
return
|
||||||
var image : Image = Global.current_project.frames[Global.current_project.current_frame].cels[Global.current_project.current_layer].image
|
var image : Image = Global.current_project.frames[Global.current_project.current_frame].cels[Global.current_project.current_layer].image
|
||||||
match id:
|
match id:
|
||||||
|
|
Loading…
Reference in a new issue