Removed left and right brush arrows

- Removed left and right brush arrow indicators completely.
- Fixed bug when removing custom project brushes.
This commit is contained in:
OverloadedOrama 2019-11-30 02:45:45 +02:00
parent 4721a01f2e
commit 3312b8064f
10 changed files with 32 additions and 117 deletions

View file

@ -4,12 +4,11 @@ var brush_type = Global.BRUSH_TYPES.PIXEL
var custom_brush_index := -1
func _on_BrushButton_pressed() -> void:
#Change left brush
if Global.brushes_popup.rect_global_position == Global.left_brush_type_button.rect_global_position:
Global.current_left_brush_type = brush_type
Global.left_brush_indicator.get_parent().remove_child(Global.left_brush_indicator)
add_child(Global.left_brush_indicator)
Global.custom_left_brush_index = custom_brush_index
if custom_brush_index > -1: #Custom brush
Global.custom_left_brush_index = custom_brush_index
if hint_tooltip == "":
Global.left_brush_type_label.text = "Custom brush"
else:
@ -19,12 +18,10 @@ func _on_BrushButton_pressed() -> void:
Global.update_left_custom_brush()
else:
else: #Change right brush
Global.current_right_brush_type = brush_type
Global.right_brush_indicator.get_parent().remove_child(Global.right_brush_indicator)
add_child(Global.right_brush_indicator)
Global.custom_right_brush_index = custom_brush_index
if custom_brush_index > -1:
Global.custom_right_brush_index = custom_brush_index
if hint_tooltip == "":
Global.right_brush_type_label.text = "Custom brush"
else:
@ -39,17 +36,18 @@ func _on_DeleteButton_pressed() -> void:
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)
Global.file_brush_container.get_child(0).add_child(Global.left_brush_indicator)
Global.left_brush_type_label.text = "Brush: Pixel"
Global.update_left_custom_brush()
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)
Global.file_brush_container.get_child(0).add_child(Global.right_brush_indicator)
Global.right_brush_type_label.text = "Brush: Pixel"
Global.update_right_custom_brush()
var project_brush_index = custom_brush_index - Global.brushes_from_files
Global.undos += 1
Global.undo_redo.create_action("Delete Custom Brush")
for i in range(custom_brush_index - 1, Global.project_brush_container.get_child_count()):
for i in range(project_brush_index, Global.project_brush_container.get_child_count()):
var bb = Global.project_brush_container.get_child(i)
if Global.custom_left_brush_index == bb.custom_brush_index:
Global.custom_left_brush_index -= 1

View file

@ -641,7 +641,7 @@ func flood_fill(pos : Vector2, target_color : Color, replace_color : Color) -> v
q.append(north)
if south.y < south_limit && layers[current_layer_index][0].get_pixelv(south) == target_color:
q.append(south)
sprite_changed_this_frame = true
sprite_changed_this_frame = true
#I wish GDScript supported function overloading, I could add more versions of these scripts...
#...but with a Rect2() parameter instead of 2 Vector2()s

View file

@ -53,8 +53,6 @@ var left_brush_size_edit : SpinBox
var right_brush_size_edit : SpinBox
var left_interpolate_slider : HSlider
var right_interpolate_slider : HSlider
var left_brush_indicator : Sprite
var right_brush_indicator : Sprite
var loop_animation_button : BaseButton
var play_forward : BaseButton
@ -143,8 +141,6 @@ func _ready() -> void:
right_brush_size_edit = find_node_by_name(root, "RightBrushSizeEdit")
left_interpolate_slider = find_node_by_name(root, "LeftInterpolateFactor")
right_interpolate_slider = find_node_by_name(root, "RightInterpolateFactor")
left_brush_indicator = find_node_by_name(root, "LeftBrushIndicator")
right_brush_indicator = find_node_by_name(root, "RightBrushIndicator")
loop_animation_button = find_node_by_name(root, "LoopAnim")
play_forward = find_node_by_name(root, "PlayForward")