diff --git a/Main.tscn b/Main.tscn index acb5fe7a7..2829edfc6 100644 --- a/Main.tscn +++ b/Main.tscn @@ -151,6 +151,7 @@ text = "[64×64]" align = 2 [node name="UI" type="HBoxContainer" parent="MenuAndUI"] +editor/display_folded = true margin_top = 28.0 margin_right = 1152.0 margin_bottom = 648.0 @@ -159,12 +160,14 @@ size_flags_vertical = 3 custom_constants/separation = 0 [node name="ToolPanel" type="Panel" parent="MenuAndUI/UI"] +editor/display_folded = true margin_right = 242.0 margin_bottom = 620.0 rect_min_size = Vector2( 242, 0 ) size_flags_vertical = 3 [node name="Tools" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel"] +editor/display_folded = true anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 8.0 @@ -175,12 +178,12 @@ size_flags_vertical = 3 custom_constants/separation = 32 [node name="MenusAndTools" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools"] -editor/display_folded = true margin_right = 244.0 margin_bottom = 125.0 custom_constants/separation = 17 [node name="SelectionTools" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/MenusAndTools"] +editor/display_folded = true margin_right = 244.0 margin_bottom = 54.0 @@ -215,11 +218,13 @@ button_mask = 3 texture_normal = ExtResource( 2 ) [node name="DrawTools" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/MenusAndTools"] +editor/display_folded = true margin_top = 71.0 margin_right = 244.0 margin_bottom = 125.0 [node name="VBoxContainer" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/MenusAndTools/DrawTools"] +editor/display_folded = true margin_right = 244.0 margin_bottom = 18.0 custom_constants/separation = 0 @@ -235,6 +240,7 @@ margin_right = 244.0 margin_bottom = 18.0 [node name="PaintToolsContainer" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/MenusAndTools/DrawTools"] +editor/display_folded = true margin_top = 22.0 margin_right = 244.0 margin_bottom = 54.0 @@ -275,8 +281,7 @@ margin_left = 108.0 margin_right = 140.0 margin_bottom = 32.0 hint_tooltip = "U for left mouse button -Alt + U for right mouse button -Ctrl to Darken" +Alt + U for right mouse button" mouse_default_cursor_shape = 2 button_mask = 3 texture_normal = ExtResource( 6 ) @@ -466,6 +471,7 @@ rect_pivot_offset = Vector2( -90, -47 ) text = "C" [node name="LeftFillArea" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions"] +editor/display_folded = true visible = false margin_top = 110.0 margin_right = 244.0 @@ -484,6 +490,39 @@ text = "Area of the same color" items = [ "Area of the same color", null, false, 0, null, "All pixels of the same color", null, false, 1, null ] selected = 0 +[node name="LeftLDOptions" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions"] +editor/display_folded = true +visible = false +margin_top = 110.0 +margin_right = 244.0 +margin_bottom = 158.0 + +[node name="LeftLightenDarken" type="OptionButton" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftLDOptions"] +margin_right = 244.0 +margin_bottom = 20.0 +text = "Lighten" +items = [ "Lighten", null, false, 0, null, "Darken", null, false, 1, null ] +selected = 0 + +[node name="LeftLDAmount" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftLDOptions"] +margin_top = 24.0 +margin_right = 244.0 +margin_bottom = 48.0 + +[node name="LDAmountLabel" type="Label" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftLDOptions/LeftLDAmount"] +margin_top = 5.0 +margin_right = 55.0 +margin_bottom = 19.0 +text = "Amount:" + +[node name="LeftLDAmountSpinbox" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftLDOptions/LeftLDAmount"] +margin_left = 59.0 +margin_right = 133.0 +margin_bottom = 24.0 +max_value = 1.0 +step = 0.01 +value = 0.1 + [node name="LeftMirroring" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions"] editor/display_folded = true margin_top = 110.0 @@ -532,6 +571,7 @@ mouse_default_cursor_shape = 2 text = "Right cursor" [node name="RightBrushType" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions"] +editor/display_folded = true margin_top = 46.0 margin_right = 244.0 margin_bottom = 78.0 @@ -558,6 +598,7 @@ margin_bottom = 23.0 text = "Brush: Pixel" [node name="RightBrushSize" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions"] +editor/display_folded = true margin_top = 82.0 margin_right = 244.0 margin_bottom = 106.0 @@ -621,6 +662,7 @@ rect_pivot_offset = Vector2( -90, -47 ) text = "C" [node name="RightFillArea" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions"] +editor/display_folded = true visible = false margin_top = 110.0 margin_right = 244.0 @@ -639,6 +681,39 @@ text = "Area of the same color" items = [ "Area of the same color", null, false, 0, null, "All pixels of the same color", null, false, 1, null ] selected = 0 +[node name="RightLDOptions" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions"] +editor/display_folded = true +visible = false +margin_top = 110.0 +margin_right = 244.0 +margin_bottom = 158.0 + +[node name="RightLightenDarken" type="OptionButton" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightLDOptions"] +margin_right = 244.0 +margin_bottom = 20.0 +text = "Lighten" +items = [ "Lighten", null, false, 0, null, "Darken", null, false, 1, null ] +selected = 0 + +[node name="RightLDAmount" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightLDOptions"] +margin_top = 24.0 +margin_right = 244.0 +margin_bottom = 48.0 + +[node name="LDAmountLabel" type="Label" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightLDOptions/RightLDAmount"] +margin_top = 5.0 +margin_right = 55.0 +margin_bottom = 19.0 +text = "Amount:" + +[node name="RightLDAmountSpinbox" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightLDOptions/RightLDAmount"] +margin_left = 59.0 +margin_right = 133.0 +margin_bottom = 24.0 +max_value = 1.0 +step = 0.01 +value = 0.1 + [node name="RightMirroring" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions"] editor/display_folded = true margin_top = 110.0 @@ -1426,6 +1501,8 @@ align = 1 [connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftBrushSize/LeftBrushSizeEdit" to="." method="_on_LeftBrushSizeEdit_value_changed"] [connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftColorInterpolation/InterpolateColor/LeftInterpolateFactor" to="." method="_on_LeftInterpolateFactor_value_changed"] [connection signal="item_selected" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftFillArea/LeftFillAreaOptions" to="." method="_on_LeftFillAreaOptions_item_selected"] +[connection signal="item_selected" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftLDOptions/LeftLightenDarken" to="." method="_on_LeftLightenDarken_item_selected"] +[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftLDOptions/LeftLDAmount/LeftLDAmountSpinbox" to="." method="_on_LeftLDAmountSpinbox_value_changed"] [connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftMirroring/LeftHorizontalMirroring" to="." method="_on_LeftHorizontalMirroring_toggled"] [connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions/LeftMirroring/LeftVerticalMirroring" to="." method="_on_LeftVerticalMirroring_toggled"] [connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightIndicatorCheckbox" to="." method="_on_RightIndicatorCheckbox_toggled"] @@ -1433,6 +1510,8 @@ align = 1 [connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightBrushSize/RightBrushSizeEdit" to="." method="_on_RightBrushSizeEdit_value_changed"] [connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightColorInterpolation/InterpolateColor/RightInterpolateFactor" to="." method="_on_RightInterpolateFactor_value_changed"] [connection signal="item_selected" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightFillArea/RightFillAreaOptions" to="." method="_on_RightFillAreaOptions_item_selected"] +[connection signal="item_selected" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightLDOptions/RightLightenDarken" to="." method="_on_RightLightenDarken_item_selected"] +[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightLDOptions/RightLDAmount/RightLDAmountSpinbox" to="." method="_on_RightLDAmountSpinbox_value_changed"] [connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightMirroring/RightHorizontalMirroring" to="." method="_on_RightHorizontalMirroring_toggled"] [connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightMirroring/RightVerticalMirroring" to="." method="_on_RightVerticalMirroring_toggled"] [connection signal="pressed" from="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HorizontalRuler" to="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HorizontalRuler" method="_on_HorizontalRuler_pressed"] diff --git a/Scripts/Canvas.gd b/Scripts/Canvas.gd index 33799aa63..e68508dec 100644 --- a/Scripts/Canvas.gd +++ b/Scripts/Canvas.gd @@ -84,14 +84,21 @@ func _process(delta) -> void: var current_mouse_button := "None" var current_action := "None" var fill_area := 0 #For the bucket tool + #For the LightenDarken tool + var ld := 0 + var ld_amount := 0.1 if Input.is_mouse_button_pressed(BUTTON_LEFT): current_mouse_button = "left_mouse" current_action = Global.current_left_tool fill_area = Global.left_fill_area + ld = Global.left_ld + ld_amount = Global.left_ld_amount elif Input.is_mouse_button_pressed(BUTTON_RIGHT): current_mouse_button = "right_mouse" current_action = Global.current_right_tool fill_area = Global.right_fill_area + ld = Global.right_ld + ld_amount = Global.right_ld_amount if Global.current_frame == frame: if !mouse_in_canvas: @@ -182,10 +189,11 @@ func _process(delta) -> void: "LightenDarken": if mouse_in_canvas && Global.can_draw && Global.has_focus && Global.current_frame == frame: var pixel_color : Color = layers[current_layer_index][0].get_pixelv(mouse_pos) - var amount := 0.1 - var color_changed := pixel_color.lightened(amount) - if Input.is_key_pressed(KEY_CONTROL): - color_changed = pixel_color.darkened(amount) + var color_changed : Color + if ld == 0: #Lighten + color_changed = pixel_color.lightened(ld_amount) + else: #Darken + color_changed = pixel_color.darkened(ld_amount) pencil_and_eraser(mouse_pos, color_changed, current_mouse_button, current_action) "RectSelect": #Check SelectionRectangle.gd for more code on Rectangle Selection diff --git a/Scripts/Global.gd b/Scripts/Global.gd index 4d19a7b15..fe6e1ee76 100644 --- a/Scripts/Global.gd +++ b/Scripts/Global.gd @@ -75,6 +75,9 @@ var right_interpolate_slider : HSlider var left_fill_area_container : Container var right_fill_area_container : Container +var left_ld_container : Container +var right_ld_container : Container + var left_mirror_container : Container var right_mirror_container : Container @@ -110,9 +113,16 @@ var brushes_popup : Popup var file_brush_container : GridContainer var project_brush_container : GridContainer +#0 for area of same color, 1 for all pixels of the same color var left_fill_area := 0 var right_fill_area := 0 +#0 for lighten, 1 for darken +var left_ld := 0 +var right_ld := 0 +var left_ld_amount := 0.1 +var right_ld_amount := 0.1 + # warning-ignore:unused_class_variable var left_horizontal_mirror := false # warning-ignore:unused_class_variable @@ -187,6 +197,9 @@ func _ready() -> void: left_fill_area_container = find_node_by_name(left_tool_options_container, "LeftFillArea") right_fill_area_container = find_node_by_name(right_tool_options_container, "RightFillArea") + left_ld_container = find_node_by_name(left_tool_options_container, "LeftLDOptions") + right_ld_container = find_node_by_name(right_tool_options_container, "RightLDOptions") + left_mirror_container = find_node_by_name(left_tool_options_container, "LeftMirroring") right_mirror_container = find_node_by_name(right_tool_options_container, "RightMirroring") diff --git a/Scripts/Main.gd b/Scripts/Main.gd index 5f49aa84a..b9d6cb6f0 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -618,6 +618,7 @@ func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_le Global.left_mirror_container.visible = true elif current_action == "LightenDarken": Global.left_brush_size_container.visible = true + Global.left_ld_container.visible = true Global.left_mirror_container.visible = true elif (mouse_press && Input.is_action_just_released("right_mouse")) || (!mouse_press && !key_for_left): @@ -642,6 +643,7 @@ func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_le Global.right_mirror_container.visible = true elif current_action == "LightenDarken": Global.right_brush_size_container.visible = true + Global.right_ld_container.visible = true Global.right_mirror_container.visible = true for t in tools: @@ -930,6 +932,16 @@ func _on_LeftFillAreaOptions_item_selected(ID : int) -> void: func _on_RightFillAreaOptions_item_selected(ID : int) -> void: Global.right_fill_area = ID +func _on_LeftLightenDarken_item_selected(ID : int) -> void: + Global.left_ld = ID +func _on_LeftLDAmountSpinbox_value_changed(value : float) -> void: + Global.left_ld_amount = value + +func _on_RightLightenDarken_item_selected(ID : int) -> void: + Global.right_ld = ID +func _on_RightLDAmountSpinbox_value_changed(value : float) -> void: + Global.right_ld_amount = value + func _on_LeftHorizontalMirroring_toggled(button_pressed) -> void: Global.left_horizontal_mirror = button_pressed func _on_LeftVerticalMirroring_toggled(button_pressed) -> void: