mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Added sliders for brush size & 2 new custom brushes
Also, in Canvas.gd's _draw() method, draw_set_transform() is called again after the circle brush drawings, to reset the transform to its default state.
This commit is contained in:
parent
06e0d74c14
commit
d4b42534bb
BIN
Brushes/hline_3x3.png
Normal file
BIN
Brushes/hline_3x3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 B |
BIN
Brushes/vline_3x3.png
Normal file
BIN
Brushes/vline_3x3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 79 B |
33
Main.tscn
33
Main.tscn
|
@ -250,7 +250,6 @@ 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
|
||||
|
@ -399,7 +398,6 @@ button_mask = 3
|
|||
texture_normal = ExtResource( 9 )
|
||||
|
||||
[node name="ColorAndToolOptions" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools"]
|
||||
editor/display_folded = true
|
||||
margin_top = 159.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 612.0
|
||||
|
@ -541,9 +539,19 @@ margin_right = 58.0
|
|||
margin_bottom = 16.0
|
||||
text = "Brush size:"
|
||||
|
||||
[node name="LeftBrushSizeEdit" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushSize"]
|
||||
[node name="LeftBrushSizeSlider" type="HSlider" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushSize"]
|
||||
margin_left = 62.0
|
||||
margin_right = 116.0
|
||||
margin_right = 150.0
|
||||
margin_bottom = 17.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
min_value = 1.0
|
||||
value = 1.0
|
||||
allow_greater = true
|
||||
|
||||
[node name="LeftBrushSizeEdit" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushSize"]
|
||||
margin_left = 154.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 17.0
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = 1.0
|
||||
|
@ -626,6 +634,7 @@ hint_tooltip = "LDAMOUNT_HT"
|
|||
value = 10.0
|
||||
|
||||
[node name="LeftMirroring" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions"]
|
||||
editor/display_folded = true
|
||||
margin_top = 96.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 131.0
|
||||
|
@ -719,9 +728,19 @@ margin_right = 58.0
|
|||
margin_bottom = 16.0
|
||||
text = "Brush size:"
|
||||
|
||||
[node name="RightBrushSizeEdit" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightBrushSize"]
|
||||
[node name="RightBrushSizeSlider" type="HSlider" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightBrushSize"]
|
||||
margin_left = 62.0
|
||||
margin_right = 116.0
|
||||
margin_right = 150.0
|
||||
margin_bottom = 17.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
min_value = 1.0
|
||||
value = 1.0
|
||||
allow_greater = true
|
||||
|
||||
[node name="RightBrushSizeEdit" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightBrushSize"]
|
||||
margin_left = 154.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 17.0
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = 1.0
|
||||
|
@ -1891,6 +1910,7 @@ visible = false
|
|||
[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorDefaultsCenter/ColorDefaults" to="." method="_on_ColorDefaults_pressed"]
|
||||
[connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftIndicatorCheckbox" to="." method="_on_LeftIndicatorCheckbox_toggled"]
|
||||
[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushType/LeftBrushTypeButton" to="." method="_on_LeftBrushTypeButton_pressed"]
|
||||
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushSize/LeftBrushSizeSlider" to="." method="_on_LeftBrushSizeEdit_value_changed"]
|
||||
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushSize/LeftBrushSizeEdit" to="." method="_on_LeftBrushSizeEdit_value_changed"]
|
||||
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftColorInterpolation/LeftInterpolateFactor" to="." method="_on_LeftInterpolateFactor_value_changed"]
|
||||
[connection signal="item_selected" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftFillArea/LeftFillAreaOptions" to="." method="_on_LeftFillAreaOptions_item_selected"]
|
||||
|
@ -1900,6 +1920,7 @@ visible = false
|
|||
[connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftMirroring/LeftMirrorButtons/LeftVerticalMirroring" to="." method="_on_LeftVerticalMirroring_toggled"]
|
||||
[connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightIndicatorCheckbox" to="." method="_on_RightIndicatorCheckbox_toggled"]
|
||||
[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightBrushType/RightBrushTypeButton" to="." method="_on_RightBrushTypeButton_pressed"]
|
||||
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightBrushSize/RightBrushSizeSlider" to="." method="_on_RightBrushSizeEdit_value_changed"]
|
||||
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightBrushSize/RightBrushSizeEdit" to="." method="_on_RightBrushSizeEdit_value_changed"]
|
||||
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightColorInterpolation/RightInterpolateFactor" to="." method="_on_RightInterpolateFactor_value_changed"]
|
||||
[connection signal="item_selected" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightFillArea/RightFillAreaOptions" to="." method="_on_RightFillAreaOptions_item_selected"]
|
||||
|
|
|
@ -450,9 +450,10 @@ func _draw() -> void:
|
|||
draw_rect(Rect2(start_pos_x, start_pos_y, Global.left_brush_size, Global.left_brush_size), Color.blue, false)
|
||||
elif Global.current_left_brush_type == Global.BRUSH_TYPES.CIRCLE:
|
||||
if Global.current_left_tool == "Pencil" || Global.current_left_tool == "Eraser":
|
||||
draw_set_transform(mouse_pos, 0, Vector2.ONE)
|
||||
draw_set_transform(mouse_pos, rotation, scale)
|
||||
for rect in Global.left_circle_points:
|
||||
draw_rect(Rect2(rect, Vector2.ONE), Color.blue, false)
|
||||
draw_set_transform(position, rotation, scale)
|
||||
else:
|
||||
if Global.current_left_tool == "Pencil" || Global.current_left_tool == "Eraser":
|
||||
var custom_brush_size = Global.custom_left_brush_image.get_size() - Vector2.ONE
|
||||
|
@ -467,9 +468,10 @@ func _draw() -> void:
|
|||
draw_rect(Rect2(start_pos_x, start_pos_y, Global.right_brush_size, Global.right_brush_size), Color.red, false)
|
||||
elif Global.current_right_brush_type == Global.BRUSH_TYPES.CIRCLE:
|
||||
if Global.current_right_tool == "Pencil" || Global.current_right_tool == "Eraser":
|
||||
draw_set_transform(mouse_pos, 0, Vector2.ONE)
|
||||
draw_set_transform(mouse_pos, rotation, scale)
|
||||
for rect in Global.right_circle_points:
|
||||
draw_rect(Rect2(rect, Vector2.ONE), Color.red, false)
|
||||
draw_set_transform(position, rotation, scale)
|
||||
else:
|
||||
if Global.current_right_tool == "Pencil" || Global.current_right_tool == "Eraser":
|
||||
var custom_brush_size = Global.custom_right_brush_image.get_size() - Vector2.ONE
|
||||
|
|
|
@ -162,7 +162,9 @@ var project_brush_container : GridContainer
|
|||
var left_brush_size_container : Container
|
||||
var right_brush_size_container : Container
|
||||
var left_brush_size_edit : SpinBox
|
||||
var left_brush_size_slider : HSlider
|
||||
var right_brush_size_edit : SpinBox
|
||||
var right_brush_size_slider : HSlider
|
||||
|
||||
var left_color_interpolation_container : Container
|
||||
var right_color_interpolation_container : Container
|
||||
|
@ -265,7 +267,9 @@ func _ready() -> void:
|
|||
left_brush_size_container = find_node_by_name(left_tool_options_container, "LeftBrushSize")
|
||||
right_brush_size_container = find_node_by_name(right_tool_options_container, "RightBrushSize")
|
||||
left_brush_size_edit = find_node_by_name(left_brush_size_container, "LeftBrushSizeEdit")
|
||||
left_brush_size_slider = find_node_by_name(left_brush_size_container, "LeftBrushSizeSlider")
|
||||
right_brush_size_edit = find_node_by_name(right_brush_size_container, "RightBrushSizeEdit")
|
||||
right_brush_size_slider = find_node_by_name(right_brush_size_container, "RightBrushSizeSlider")
|
||||
|
||||
left_color_interpolation_container = find_node_by_name(left_tool_options_container, "LeftColorInterpolation")
|
||||
right_color_interpolation_container = find_node_by_name(right_tool_options_container, "RightColorInterpolation")
|
||||
|
|
|
@ -875,11 +875,15 @@ func _on_RightBrushTypeButton_pressed() -> void:
|
|||
Global.brush_type_window_position = "right"
|
||||
|
||||
func _on_LeftBrushSizeEdit_value_changed(value) -> void:
|
||||
Global.left_brush_size_edit.value = value
|
||||
Global.left_brush_size_slider.value = value
|
||||
var new_size = int(value)
|
||||
Global.left_brush_size = new_size
|
||||
update_left_custom_brush()
|
||||
|
||||
func _on_RightBrushSizeEdit_value_changed(value) -> void:
|
||||
Global.right_brush_size_edit.value = value
|
||||
Global.right_brush_size_slider.value = value
|
||||
var new_size = int(value)
|
||||
Global.right_brush_size = new_size
|
||||
update_right_custom_brush()
|
||||
|
|
Loading…
Reference in a new issue