From 217fe61a00d26d6254aa6a35ae7cb869e153f86b Mon Sep 17 00:00:00 2001
From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com>
Date: Wed, 21 Apr 2021 00:48:36 +0300
Subject: [PATCH] Image effects will not longer get applied to locked and/or
hidden layers.
---
CHANGELOG.md | 2 ++
src/Classes/ImageEffect.gd | 17 ++++++++++++++---
src/UI/TopMenuContainer.gd | 2 --
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2d43ca800..d7cefb9e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,7 @@ Laurenz Reinthaler (Schweini07), kleonc, Fayez Akhtar (Variable), THWLF, Gamespl
- Undo and redo now work when their respective keyboard shortcuts are being held. ([#405](https://github.com/Orama-Interactive/Pixelorama/pull/405))
- CPU usage has been significantly been lowered when Pixelorama is idle. ([#394](https://github.com/Orama-Interactive/Pixelorama/pull/394))
- The FPS of the project animation is now stored in the pxo file. This effectively means that every project can have its own FPS.
+- You can no longer draw on hidden layers.
- You can now toggle if you want the grid to be drawn over the tile mode or just the original part of the canvas. ([#434](https://github.com/Orama-Interactive/Pixelorama/pull/434))
- Frame tags can now be set for frames larger than 100. ([#408](https://github.com/Orama-Interactive/Pixelorama/pull/408))
- The "lock aspect ratio" button in the create new image dialog has been changed to a texture button.
@@ -63,6 +64,7 @@ Laurenz Reinthaler (Schweini07), kleonc, Fayez Akhtar (Variable), THWLF, Gamespl
- Fixed potential index out of bounds error when loading backup files. ([#446](https://github.com/Orama-Interactive/Pixelorama/pull/446))
- Mirroring view should now work on all tools.
- Fixed hue and saturation getting reset when draging value slider to zero. ([#473](https://github.com/Orama-Interactive/Pixelorama/pull/473))
+- Image effects will not longer get applied to locked and/or hidden layers.
## [v0.8.2] - 2020-12-12
diff --git a/src/Classes/ImageEffect.gd b/src/Classes/ImageEffect.gd
index 9f4d711b0..9945ccb63 100644
--- a/src/Classes/ImageEffect.gd
+++ b/src/Classes/ImageEffect.gd
@@ -47,20 +47,28 @@ func _about_to_show() -> void:
func _confirmed() -> void:
if affect == CEL:
+ if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn(): # No changes if the layer is locked or invisible
+ return
Global.canvas.handle_undo("Draw")
commit_action(current_cel, pixels)
Global.canvas.handle_redo("Draw")
elif affect == FRAME:
Global.canvas.handle_undo("Draw", Global.current_project, -1)
+ var i := 0
for cel in Global.current_project.frames[Global.current_project.current_frame].cels:
- commit_action(cel.image, pixels)
+ if Global.current_project.layers[i].can_layer_get_drawn():
+ commit_action(cel.image, pixels)
+ i += 1
Global.canvas.handle_redo("Draw", Global.current_project, -1)
elif affect == ALL_FRAMES:
Global.canvas.handle_undo("Draw", Global.current_project, -1, -1)
for frame in Global.current_project.frames:
+ var i := 0
for cel in frame.cels:
- commit_action(cel.image, pixels)
+ if Global.current_project.layers[i].can_layer_get_drawn():
+ commit_action(cel.image, pixels)
+ i += 1
Global.canvas.handle_redo("Draw", Global.current_project, -1, -1)
elif affect == ALL_PROJECTS:
@@ -75,8 +83,11 @@ func _confirmed() -> void:
Global.canvas.handle_undo("Draw", project, -1, -1)
for frame in project.frames:
+ var i := 0
for cel in frame.cels:
- commit_action(cel.image, _pixels, project)
+ if project.layers[i].can_layer_get_drawn():
+ commit_action(cel.image, _pixels, project)
+ i += 1
Global.canvas.handle_redo("Draw", project, -1, -1)
diff --git a/src/UI/TopMenuContainer.gd b/src/UI/TopMenuContainer.gd
index d25a2bdcd..d3d256c83 100644
--- a/src/UI/TopMenuContainer.gd
+++ b/src/UI/TopMenuContainer.gd
@@ -405,8 +405,6 @@ func toggle_fullscreen() -> void:
func image_menu_id_pressed(id : int) -> void:
- 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:
ImageMenuId.SCALE_IMAGE: