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

Remove custom brushes

- The ability to remove custom "project" brushes have now been added. Note that you cannot remove file brushes, or the pixel brush.
- Added some UI labels for the two brush containers
This commit is contained in:
OverloadedOrama 2019-11-11 15:55:28 +02:00
parent b1e8bde3ac
commit 5896d1f06d
3 changed files with 73 additions and 13 deletions

View file

@ -35,8 +35,9 @@ size_flags_horizontal = 3
size_flags_vertical = 3
[node name="MenusAndTools" type="VBoxContainer" parent="UI/ToolPanel/Tools"]
editor/display_folded = true
margin_right = 230.0
margin_bottom = 242.0
margin_bottom = 224.0
size_flags_vertical = 3
[node name="MenuItems" type="HBoxContainer" parent="UI/ToolPanel/Tools/MenusAndTools"]
@ -162,21 +163,21 @@ button_mask = 3
text = "RectSelect"
[node name="HSeparator" type="HSeparator" parent="UI/ToolPanel/Tools"]
margin_top = 246.0
margin_top = 228.0
margin_right = 230.0
margin_bottom = 250.0
margin_bottom = 232.0
[node name="ToolOptions" type="HBoxContainer" parent="UI/ToolPanel/Tools"]
margin_top = 254.0
margin_top = 236.0
margin_right = 230.0
margin_bottom = 496.0
margin_bottom = 460.0
size_flags_vertical = 3
custom_constants/separation = 0
[node name="LeftToolOptions" type="VBoxContainer" parent="UI/ToolPanel/Tools/ToolOptions"]
editor/display_folded = true
margin_right = 113.0
margin_bottom = 242.0
margin_bottom = 224.0
size_flags_horizontal = 3
[node name="LeftLabel" type="Label" parent="UI/ToolPanel/Tools/ToolOptions/LeftToolOptions"]
@ -271,13 +272,13 @@ text = "Vert. Mirror"
[node name="VSeparator" type="VSeparator" parent="UI/ToolPanel/Tools/ToolOptions"]
margin_left = 113.0
margin_right = 117.0
margin_bottom = 242.0
margin_bottom = 224.0
[node name="RightToolOptions" type="VBoxContainer" parent="UI/ToolPanel/Tools/ToolOptions"]
editor/display_folded = true
margin_left = 117.0
margin_right = 230.0
margin_bottom = 242.0
margin_bottom = 224.0
size_flags_horizontal = 3
[node name="RightLabel" type="Label" parent="UI/ToolPanel/Tools/ToolOptions/RightToolOptions"]
@ -369,14 +370,20 @@ margin_bottom = 218.0
text = "Vert. Mirror"
[node name="HSeparator2" type="HSeparator" parent="UI/ToolPanel/Tools"]
margin_top = 500.0
margin_top = 464.0
margin_right = 230.0
margin_bottom = 504.0
margin_bottom = 468.0
[node name="FileBrushes" type="Label" parent="UI/ToolPanel/Tools"]
margin_top = 472.0
margin_right = 230.0
margin_bottom = 486.0
text = "Brushes From Files"
[node name="BrushesContainer" type="ScrollContainer" parent="UI/ToolPanel/Tools"]
margin_top = 508.0
margin_top = 490.0
margin_right = 230.0
margin_bottom = 544.0
margin_bottom = 526.0
size_flags_horizontal = 3
scroll_vertical_enabled = false
@ -400,9 +407,15 @@ centered = false
offset = Vector2( 28, 0 )
[node name="HSeparator3" type="HSeparator" parent="UI/ToolPanel/Tools"]
margin_top = 548.0
margin_top = 530.0
margin_right = 230.0
margin_bottom = 534.0
[node name="ProjectBrushes" type="Label" parent="UI/ToolPanel/Tools"]
margin_top = 538.0
margin_right = 230.0
margin_bottom = 552.0
text = "Custom Project Brushes"
[node name="CustomBrushesContainer" type="ScrollContainer" parent="UI/ToolPanel/Tools"]
margin_top = 556.0

View file

@ -19,4 +19,18 @@ rect_min_size = Vector2( 32, 32 )
texture = ExtResource( 2 )
expand = true
stretch_mode = 6
[node name="DeleteButton" type="Button" parent="."]
visible = false
modulate = Color( 1, 0.00392157, 0.00392157, 0.709804 )
margin_left = 22.0
margin_right = 42.0
margin_bottom = 20.0
rect_scale = Vector2( 0.7, 0.7 )
text = "X"
[connection signal="mouse_entered" from="." to="." method="_on_BrushButton_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_BrushButton_mouse_exited"]
[connection signal="pressed" from="." to="." method="_on_BrushButton_pressed"]
[connection signal="mouse_entered" from="DeleteButton" to="." method="_on_BrushButton_mouse_entered"]
[connection signal="mouse_exited" from="DeleteButton" to="." method="_on_BrushButton_mouse_exited"]
[connection signal="pressed" from="DeleteButton" to="." method="_on_DeleteButton_pressed"]

View file

@ -19,3 +19,36 @@ func _on_BrushButton_pressed() -> void:
if custom_brush_index > -1:
Global.custom_right_brush_index = custom_brush_index
Global.update_right_custom_brush()
func _on_DeleteButton_pressed() -> void:
var file_hbox_container := Global.find_node_by_name(get_tree().get_root(), "BrushHBoxContainer")
var custom_hbox_container := Global.find_node_by_name(get_tree().get_root(), "CustomBrushHBoxContainer")
if brush_type == Global.BRUSH_TYPES.CUSTOM:
if Global.custom_left_brush_index == custom_brush_index:
Global.custom_left_brush_index = -1
Global.current_left_brush_type = Global.BRUSH_TYPES.PIXEL
remove_child(Global.left_brush_indicator)
file_hbox_container.get_child(0).add_child(Global.left_brush_indicator)
if Global.custom_right_brush_index == custom_brush_index:
Global.custom_right_brush_index = -1
Global.current_right_brush_type = Global.BRUSH_TYPES.PIXEL
remove_child(Global.right_brush_indicator)
file_hbox_container.get_child(0).add_child(Global.right_brush_indicator)
for i in range(custom_brush_index - 1, custom_hbox_container.get_child_count()):
if Global.custom_left_brush_index == custom_hbox_container.get_child(i).custom_brush_index:
Global.custom_left_brush_index -= 1
if Global.custom_right_brush_index == custom_hbox_container.get_child(i).custom_brush_index:
Global.custom_right_brush_index -= 1
custom_hbox_container.get_child(i).custom_brush_index -= 1
Global.custom_brushes.remove(custom_brush_index)
queue_free()
func _on_BrushButton_mouse_entered() -> void:
if brush_type == Global.BRUSH_TYPES.CUSTOM:
$DeleteButton.visible = true
func _on_BrushButton_mouse_exited() -> void:
if brush_type == Global.BRUSH_TYPES.CUSTOM:
$DeleteButton.visible = false