mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Added option to affect all projects in the HSVDialog
HSVDialog should be ready now. These options will also appear in the rest of the image effects.
This commit is contained in:
parent
95ccd42e48
commit
2cb07fb848
|
@ -277,71 +277,73 @@ func notification_label(text : String) -> void:
|
||||||
get_tree().get_root().add_child(notification)
|
get_tree().get_root().add_child(notification)
|
||||||
|
|
||||||
|
|
||||||
func general_undo() -> void:
|
func general_undo(project : Project = current_project) -> void:
|
||||||
current_project.undos -= 1
|
project.undos -= 1
|
||||||
var action_name : String = current_project.undo_redo.get_current_action_name()
|
var action_name : String = project.undo_redo.get_current_action_name()
|
||||||
notification_label("Undo: %s" % action_name)
|
notification_label("Undo: %s" % action_name)
|
||||||
|
|
||||||
|
|
||||||
func general_redo() -> void:
|
func general_redo(project : Project = current_project) -> void:
|
||||||
if current_project.undos < current_project.undo_redo.get_version(): # If we did undo and then redo
|
if project.undos < project.undo_redo.get_version(): # If we did undo and then redo
|
||||||
current_project.undos = current_project.undo_redo.get_version()
|
project.undos = project.undo_redo.get_version()
|
||||||
if control.redone:
|
if control.redone:
|
||||||
var action_name : String = current_project.undo_redo.get_current_action_name()
|
var action_name : String = project.undo_redo.get_current_action_name()
|
||||||
notification_label("Redo: %s" % action_name)
|
notification_label("Redo: %s" % action_name)
|
||||||
|
|
||||||
|
|
||||||
func undo(_frame_index := -1, _layer_index := -1) -> void:
|
func undo(_frame_index := -1, _layer_index := -1, project : Project = current_project) -> void:
|
||||||
general_undo()
|
general_undo(project)
|
||||||
var action_name : String = current_project.undo_redo.get_current_action_name()
|
var action_name : String = project.undo_redo.get_current_action_name()
|
||||||
if action_name == "Draw" or action_name == "Rectangle Select" or action_name == "Scale" or action_name == "Merge Layer" or action_name == "Link Cel" or action_name == "Unlink Cel":
|
if action_name == "Draw" or action_name == "Rectangle Select" or action_name == "Scale" or action_name == "Merge Layer" or action_name == "Link Cel" or action_name == "Unlink Cel":
|
||||||
if _layer_index > -1 and _frame_index > -1:
|
if _layer_index > -1 and _frame_index > -1:
|
||||||
canvas.update_texture(_layer_index, _frame_index)
|
canvas.update_texture(_layer_index, _frame_index, project)
|
||||||
else:
|
else:
|
||||||
for i in current_project.frames.size():
|
for i in project.frames.size():
|
||||||
for j in current_project.layers.size():
|
for j in project.layers.size():
|
||||||
canvas.update_texture(j, i)
|
canvas.update_texture(j, i, project)
|
||||||
|
|
||||||
if action_name == "Scale":
|
if action_name == "Scale":
|
||||||
canvas.camera_zoom()
|
canvas.camera_zoom()
|
||||||
|
|
||||||
elif "Frame" in action_name:
|
elif "Frame" in action_name:
|
||||||
# This actually means that frames.size is one, but it hasn't been updated yet
|
# This actually means that frames.size is one, but it hasn't been updated yet
|
||||||
if current_project.frames.size() == 2: # Stop animating
|
if project.frames.size() == 2: # Stop animating
|
||||||
play_forward.pressed = false
|
play_forward.pressed = false
|
||||||
play_backwards.pressed = false
|
play_backwards.pressed = false
|
||||||
animation_timer.stop()
|
animation_timer.stop()
|
||||||
|
|
||||||
canvas.update()
|
canvas.update()
|
||||||
if !current_project.has_changed:
|
if !project.has_changed:
|
||||||
current_project.has_changed = true
|
project.has_changed = true
|
||||||
self.window_title = window_title + "(*)"
|
if project == current_project:
|
||||||
|
self.window_title = window_title + "(*)"
|
||||||
|
|
||||||
|
|
||||||
func redo(_frame_index := -1, _layer_index := -1) -> void:
|
func redo(_frame_index := -1, _layer_index := -1, project : Project = current_project) -> void:
|
||||||
general_redo()
|
general_redo(project)
|
||||||
var action_name : String = current_project.undo_redo.get_current_action_name()
|
var action_name : String = project.undo_redo.get_current_action_name()
|
||||||
if action_name == "Draw" or action_name == "Rectangle Select" or action_name == "Scale" or action_name == "Merge Layer" or action_name == "Link Cel" or action_name == "Unlink Cel":
|
if action_name == "Draw" or action_name == "Rectangle Select" or action_name == "Scale" or action_name == "Merge Layer" or action_name == "Link Cel" or action_name == "Unlink Cel":
|
||||||
if _layer_index > -1 and _frame_index > -1:
|
if _layer_index > -1 and _frame_index > -1:
|
||||||
canvas.update_texture(_layer_index, _frame_index)
|
canvas.update_texture(_layer_index, _frame_index, project)
|
||||||
else:
|
else:
|
||||||
for i in current_project.frames.size():
|
for i in project.frames.size():
|
||||||
for j in current_project.layers.size():
|
for j in project.layers.size():
|
||||||
canvas.update_texture(j, i)
|
canvas.update_texture(j, i, project)
|
||||||
|
|
||||||
if action_name == "Scale":
|
if action_name == "Scale":
|
||||||
canvas.camera_zoom()
|
canvas.camera_zoom()
|
||||||
|
|
||||||
elif "Frame" in action_name:
|
elif "Frame" in action_name:
|
||||||
if current_project.frames.size() == 1: # Stop animating
|
if project.frames.size() == 1: # Stop animating
|
||||||
play_forward.pressed = false
|
play_forward.pressed = false
|
||||||
play_backwards.pressed = false
|
play_backwards.pressed = false
|
||||||
animation_timer.stop()
|
animation_timer.stop()
|
||||||
|
|
||||||
canvas.update()
|
canvas.update()
|
||||||
if !current_project.has_changed:
|
if !project.has_changed:
|
||||||
current_project.has_changed = true
|
project.has_changed = true
|
||||||
self.window_title = window_title + "(*)"
|
if project == current_project:
|
||||||
|
self.window_title = window_title + "(*)"
|
||||||
|
|
||||||
|
|
||||||
func title_changed(value : String) -> void:
|
func title_changed(value : String) -> void:
|
||||||
|
|
|
@ -164,7 +164,7 @@ func handle_undo(action : String, project : Project = Global.current_project, la
|
||||||
var data = cel.image.data
|
var data = cel.image.data
|
||||||
cel.image.lock()
|
cel.image.lock()
|
||||||
project.undo_redo.add_undo_property(cel.image, "data", data)
|
project.undo_redo.add_undo_property(cel.image, "data", data)
|
||||||
project.undo_redo.add_undo_method(Global, "undo", frame_index, layer_index)
|
project.undo_redo.add_undo_method(Global, "undo", frame_index, layer_index, project)
|
||||||
|
|
||||||
can_undo = false
|
can_undo = false
|
||||||
|
|
||||||
|
@ -199,19 +199,20 @@ func handle_redo(_action : String, project : Project = Global.current_project, l
|
||||||
|
|
||||||
for cel in cels:
|
for cel in cels:
|
||||||
project.undo_redo.add_do_property(cel.image, "data", cel.image.data)
|
project.undo_redo.add_do_property(cel.image, "data", cel.image.data)
|
||||||
project.undo_redo.add_do_method(Global, "redo", frame_index, layer_index)
|
project.undo_redo.add_do_method(Global, "redo", frame_index, layer_index, project)
|
||||||
project.undo_redo.commit_action()
|
project.undo_redo.commit_action()
|
||||||
|
|
||||||
|
|
||||||
func update_texture(layer_index : int, frame_index := -1) -> void:
|
func update_texture(layer_index : int, frame_index := -1, project : Project = Global.current_project) -> void:
|
||||||
if frame_index == -1:
|
if frame_index == -1:
|
||||||
frame_index = Global.current_project.current_frame
|
frame_index = project.current_frame
|
||||||
var current_cel : Cel = Global.current_project.frames[frame_index].cels[layer_index]
|
var current_cel : Cel = project.frames[frame_index].cels[layer_index]
|
||||||
current_cel.image_texture.create_from_image(current_cel.image, 0)
|
current_cel.image_texture.create_from_image(current_cel.image, 0)
|
||||||
|
|
||||||
var frame_texture_rect : TextureRect
|
if project == Global.current_project:
|
||||||
frame_texture_rect = Global.find_node_by_name(Global.current_project.layers[layer_index].frame_container.get_child(frame_index), "CelTexture")
|
var frame_texture_rect : TextureRect
|
||||||
frame_texture_rect.texture = current_cel.image_texture
|
frame_texture_rect = Global.find_node_by_name(project.layers[layer_index].frame_container.get_child(frame_index), "CelTexture")
|
||||||
|
frame_texture_rect.texture = current_cel.image_texture
|
||||||
|
|
||||||
|
|
||||||
func onion_skinning() -> void:
|
func onion_skinning() -> void:
|
||||||
|
|
|
@ -45,17 +45,27 @@ func _on_Apply_pressed() -> void:
|
||||||
Global.canvas.handle_undo("Draw")
|
Global.canvas.handle_undo("Draw")
|
||||||
DrawingAlgos.adjust_hsv(current_cel, hue_slider.value, sat_slider.value, val_slider.value, pixels)
|
DrawingAlgos.adjust_hsv(current_cel, hue_slider.value, sat_slider.value, val_slider.value, pixels)
|
||||||
Global.canvas.handle_redo("Draw")
|
Global.canvas.handle_redo("Draw")
|
||||||
|
|
||||||
elif affect == FRAME:
|
elif affect == FRAME:
|
||||||
Global.canvas.handle_undo("Draw", Global.current_project, -1)
|
Global.canvas.handle_undo("Draw", Global.current_project, -1)
|
||||||
for cel in Global.current_project.frames[Global.current_project.current_frame].cels:
|
for cel in Global.current_project.frames[Global.current_project.current_frame].cels:
|
||||||
DrawingAlgos.adjust_hsv(cel.image, hue_slider.value, sat_slider.value, val_slider.value, pixels)
|
DrawingAlgos.adjust_hsv(cel.image, hue_slider.value, sat_slider.value, val_slider.value, pixels)
|
||||||
Global.canvas.handle_redo("Draw", Global.current_project, -1)
|
Global.canvas.handle_redo("Draw", Global.current_project, -1)
|
||||||
|
|
||||||
elif affect == ALL_FRAMES:
|
elif affect == ALL_FRAMES:
|
||||||
Global.canvas.handle_undo("Draw", Global.current_project, -1, -1)
|
Global.canvas.handle_undo("Draw", Global.current_project, -1, -1)
|
||||||
for frame in Global.current_project.frames:
|
for frame in Global.current_project.frames:
|
||||||
for cel in frame.cels:
|
for cel in frame.cels:
|
||||||
DrawingAlgos.adjust_hsv(cel.image, hue_slider.value, sat_slider.value, val_slider.value, pixels)
|
DrawingAlgos.adjust_hsv(cel.image, hue_slider.value, sat_slider.value, val_slider.value, pixels)
|
||||||
Global.canvas.handle_redo("Draw", Global.current_project, -1, -1)
|
Global.canvas.handle_redo("Draw", Global.current_project, -1, -1)
|
||||||
|
|
||||||
|
elif affect == ALL_PROJECTS:
|
||||||
|
for project in Global.projects:
|
||||||
|
Global.canvas.handle_undo("Draw", project, -1, -1)
|
||||||
|
for frame in project.frames:
|
||||||
|
for cel in frame.cels:
|
||||||
|
DrawingAlgos.adjust_hsv(cel.image, hue_slider.value, sat_slider.value, val_slider.value, pixels)
|
||||||
|
Global.canvas.handle_redo("Draw", project, -1, -1)
|
||||||
reset()
|
reset()
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ margin_right = 263.0
|
||||||
margin_bottom = 24.0
|
margin_bottom = 24.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
text = "Current cel"
|
text = "Current cel"
|
||||||
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, true, 3, null ]
|
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ]
|
||||||
selected = 0
|
selected = 0
|
||||||
|
|
||||||
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||||
|
|
Loading…
Reference in a new issue