1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Fix bug when selecting multiple layers and their opacity changes immediately by the opacity slider

This commit is contained in:
Emmanouil Papadeas 2024-07-30 21:25:15 +03:00
parent b2bdfbeb06
commit c2fc70e436
2 changed files with 7 additions and 4 deletions

View file

@ -1046,7 +1046,7 @@ func _on_MergeDownLayer_pressed() -> void:
bottom_layer.visible = true
func _on_OpacitySlider_value_changed(value: float) -> void:
func _on_opacity_slider_value_changed(value: float) -> void:
var new_opacity := value / 100.0
for idx_pair in Global.current_project.selected_cels:
var layer := Global.current_project.layers[idx_pair[1]]
@ -1068,13 +1068,16 @@ func _on_timeline_settings_visibility_changed() -> void:
func _cel_switched() -> void:
_toggle_frame_buttons()
_toggle_layer_buttons()
# Temporarily disconnect it in order to prevent layer opacity changing
# in the rest of the selected layers, if there are any.
opacity_slider.value_changed.disconnect(_on_opacity_slider_value_changed)
_update_layer_ui()
opacity_slider.value_changed.connect(_on_opacity_slider_value_changed)
func _update_layer_ui() -> void:
var project := Global.current_project
var layer_opacity := project.layers[project.current_layer].opacity
opacity_slider.value = layer_opacity * 100
opacity_slider.value = project.layers[project.current_layer].opacity * 100
var blend_mode_index := blend_modes_button.get_item_index(
project.layers[project.current_layer].blend_mode
)

View file

@ -1034,7 +1034,7 @@ color = Color(0, 0.741176, 1, 0.501961)
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/LoopAnim" to="." method="_on_LoopAnim_pressed"]
[connection signal="value_changed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/FPSValue" to="." method="_on_FPSValue_value_changed"]
[connection signal="gui_input" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit" to="." method="_on_LayerFrameSplitContainer_gui_input"]
[connection signal="value_changed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/MarginContainer/OpacitySlider" to="." method="_on_OpacitySlider_value_changed"]
[connection signal="value_changed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/MarginContainer/OpacitySlider" to="." method="_on_opacity_slider_value_changed"]
[connection signal="resized" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/LayerVBox" to="." method="_on_LayerVBox_resized"]
[connection signal="timeout" from="AnimationTimer" to="." method="_on_AnimationTimer_timeout"]
[connection signal="close_requested" from="TimelineSettings" to="." method="_on_timeline_settings_close_requested"]