From da61234b135562a0d64f55a64e51ffc5ae786893 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Fri, 6 Dec 2019 00:27:47 +0200 Subject: [PATCH] Added custom cursor images for bucket & color picker - Custom cursor images for bucket & color picker, only when mapped to the left button - Cursor is now invisible when the left chosen tool is anything but bucket, color picker and rectangle select. - Improved and added more hint tooltips. --- Assets/Graphics/Tools/Bucket_Cursor.png | Bin 0 -> 900 bytes .../Graphics/Tools/Bucket_Cursor.png.import | 34 ++++++++++++++++++ Assets/Graphics/Tools/ColorPicker_Cursor.png | Bin 0 -> 746 bytes .../Tools/ColorPicker_Cursor.png.import | 34 ++++++++++++++++++ Main.tscn | 34 ++++++++++++++---- Scripts/Canvas.gd | 24 ++++++++----- Scripts/SelectionRectangle.gd | 1 + 7 files changed, 113 insertions(+), 14 deletions(-) create mode 100644 Assets/Graphics/Tools/Bucket_Cursor.png create mode 100644 Assets/Graphics/Tools/Bucket_Cursor.png.import create mode 100644 Assets/Graphics/Tools/ColorPicker_Cursor.png create mode 100644 Assets/Graphics/Tools/ColorPicker_Cursor.png.import diff --git a/Assets/Graphics/Tools/Bucket_Cursor.png b/Assets/Graphics/Tools/Bucket_Cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..559450e7c5e9aa902ce76715970364a7f1fa1124 GIT binary patch literal 900 zcmV-~1AF|5P)EX>4Tx04R}tkv&MmKpe$i(~2S$2aAX}WT+0sf~bh2RIvyaN?V~-2a`*`ph-iL z;^HW{799LotU9+0Yt2!bCVF0M|BE>hzEl0u6Z503ls?%w0>9UwF+Of>@&fT~$W zDjpNFxmB_I6+r|rhzKGQGxbDzF$2%>bq^n3@1i`*``n+SPsy7M@QK88OgAjz4dR(i zOXs{#9AYI&AwDM_H|T=Ik6f2se&bwpSm2ob`7 zkz)Z>sE`~#_#gc4)+|g-x=Fzp(Dh>5AEQ9`F3_yo_V=-EH%|cnGjOG~{nZ9A`$>Ae zt%Z+({%zpm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_xn+3e!CIL_QRQTW%SOLG>f*y_>`}UvG+w)&_ c3{P#X7hO7S$J!#d5&!@I07*qoM6N<$f~g`r0RR91 literal 0 HcmV?d00001 diff --git a/Assets/Graphics/Tools/ColorPicker_Cursor.png.import b/Assets/Graphics/Tools/ColorPicker_Cursor.png.import new file mode 100644 index 000000000..7aa9cf3b8 --- /dev/null +++ b/Assets/Graphics/Tools/ColorPicker_Cursor.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/ColorPicker_Cursor.png-85822710d85a1ad1331ab050f6c87cad.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Graphics/Tools/ColorPicker_Cursor.png" +dest_files=[ "res://.import/ColorPicker_Cursor.png-85822710d85a1ad1331ab050f6c87cad.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Main.tscn b/Main.tscn index a90f2b945..357e9dfd6 100644 --- a/Main.tscn +++ b/Main.tscn @@ -154,6 +154,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 @@ -186,6 +187,7 @@ margin_bottom = 127.0 custom_constants/separation = 17 [node name="UtilityTools" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/MenusAndTools"] +editor/display_folded = true margin_right = 208.0 margin_bottom = 55.0 @@ -214,7 +216,9 @@ margin_bottom = 55.0 [node name="RectSelect" type="TextureButton" parent="MenuAndUI/UI/ToolPanel/Tools/MenusAndTools/UtilityTools/SelectionToolsContainer2"] margin_right = 32.0 margin_bottom = 32.0 -hint_tooltip = "R for left mouse button +hint_tooltip = "Rectangular Selection + +R for left mouse button Alt + R for right mouse button Press Shift to move the content" mouse_default_cursor_shape = 2 @@ -225,7 +229,8 @@ texture_normal = ExtResource( 3 ) margin_left = 36.0 margin_right = 68.0 margin_bottom = 32.0 -hint_tooltip = "Select a color from the canvas +hint_tooltip = "Color Picker +Select a color from the canvas O for left mouse button Alt + O for right mouse button" @@ -264,7 +269,9 @@ margin_bottom = 55.0 [node name="Pencil" type="TextureButton" parent="MenuAndUI/UI/ToolPanel/Tools/MenusAndTools/DrawTools/PaintToolsContainer"] margin_right = 32.0 margin_bottom = 32.0 -hint_tooltip = "P for left mouse button +hint_tooltip = "Pencil + +P for left mouse button Alt + P for right mouse button Hold Shift to make a line" mouse_default_cursor_shape = 2 @@ -275,7 +282,9 @@ texture_normal = ExtResource( 5 ) margin_left = 36.0 margin_right = 68.0 margin_bottom = 32.0 -hint_tooltip = "E for left mouse button +hint_tooltip = "Eraser + +E for left mouse button Alt + E for right mouse button Hold Shift to make a line" mouse_default_cursor_shape = 2 @@ -286,7 +295,9 @@ texture_normal = ExtResource( 6 ) margin_left = 72.0 margin_right = 104.0 margin_bottom = 32.0 -hint_tooltip = "B for left mouse button +hint_tooltip = "Bucket + +B for left mouse button Alt + B for right mouse button" mouse_default_cursor_shape = 2 button_mask = 3 @@ -296,13 +307,16 @@ texture_normal = ExtResource( 7 ) margin_left = 108.0 margin_right = 140.0 margin_bottom = 32.0 -hint_tooltip = "U for left mouse button +hint_tooltip = "Lighten/Darken + +U for left mouse button Alt + U for right mouse button" mouse_default_cursor_shape = 2 button_mask = 3 texture_normal = ExtResource( 8 ) [node name="ToolOptions" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools"] +editor/display_folded = true margin_top = 159.0 margin_right = 208.0 margin_bottom = 612.0 @@ -754,6 +768,7 @@ mouse_default_cursor_shape = 2 text = "Vert. Mirror" [node name="CanvasAndTimeline" type="VBoxContainer" parent="MenuAndUI/UI"] +editor/display_folded = true margin_left = 224.0 margin_right = 928.0 margin_bottom = 620.0 @@ -761,12 +776,14 @@ size_flags_horizontal = 3 custom_constants/separation = 0 [node name="HViewportContainer" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline"] +editor/display_folded = true margin_right = 704.0 margin_bottom = 478.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="ViewportAndRulers" type="VBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer"] +editor/display_folded = true margin_right = 704.0 margin_bottom = 478.0 size_flags_horizontal = 3 @@ -1067,6 +1084,7 @@ margin_right = 689.0 margin_bottom = 138.0 [node name="LayerPanel" type="Panel" parent="MenuAndUI/UI"] +editor/display_folded = true margin_left = 928.0 margin_right = 1152.0 margin_bottom = 620.0 @@ -1237,6 +1255,10 @@ margin_left = -236.921 margin_top = 44.4745 margin_right = -223.921 margin_bottom = 57.4745 +hint_tooltip = "Split screen + +Show/hide second canvas" +mouse_default_cursor_shape = 2 size_flags_vertical = 0 toggle_mode = true texture_normal = ExtResource( 40 ) diff --git a/Scripts/Canvas.gd b/Scripts/Canvas.gd index 926c1358b..5cfc31ab9 100644 --- a/Scripts/Canvas.gd +++ b/Scripts/Canvas.gd @@ -103,13 +103,21 @@ func _process(delta) -> void: ld_amount = Global.right_ld_amount if Global.current_frame == frame: - if !mouse_in_canvas: + if mouse_in_canvas && Global.has_focus: + Global.cursor_position_label.text = "[%s×%s] %s, %s" % [size.x, size.y, mouse_pos_floored.x, mouse_pos_floored.y] + if Global.current_left_tool == "Bucket": + Input.set_custom_mouse_cursor(preload("res://Assets/Graphics/Tools/Bucket_Cursor.png"), 0, Vector2(6, 27)) + elif Global.current_left_tool == "ColorPicker": + Input.set_custom_mouse_cursor(preload("res://Assets/Graphics/Tools/ColorPicker_Cursor.png"), 0, Vector2(5, 28)) + elif Global.current_left_tool != "RectSelect": + Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) + else: if !Input.is_mouse_button_pressed(BUTTON_LEFT) && !Input.is_mouse_button_pressed(BUTTON_RIGHT): if mouse_inside_canvas: mouse_inside_canvas = false Global.cursor_position_label.text = "[%s×%s]" % [size.x, size.y] - else: - Global.cursor_position_label.text = "[%s×%s] %s, %s" % [size.x, size.y, mouse_pos_floored.x, mouse_pos_floored.y] + Input.set_custom_mouse_cursor(null) + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) #Handle Undo/Redo @@ -125,7 +133,7 @@ func _process(delta) -> void: if mouse_pressed: if can_handle && Global.current_frame == frame: - if current_action != "None": + if current_action != "None" && current_action != "ColorPicker": if current_action == "RectSelect": handle_undo("Rectangle Select") else: @@ -133,7 +141,7 @@ func _process(delta) -> void: elif (Input.is_action_just_released("left_mouse") && !Input.is_action_pressed("right_mouse")) || (Input.is_action_just_released("right_mouse") && !Input.is_action_pressed("left_mouse")): lighten_darken_pixels.clear() if (can_handle || Global.undos == Global.undo_redo.get_version()) && Global.current_frame == frame: - if previous_action != "None" && previous_action != "RectSelect": + if previous_action != "None" && previous_action != "RectSelect" && current_action != "ColorPicker": handle_redo("Draw") match current_action: #Handle current tool @@ -147,7 +155,7 @@ func _process(delta) -> void: "Eraser": pencil_and_eraser(mouse_pos, Color(0, 0, 0, 0), current_mouse_button) "Bucket": - if mouse_in_canvas && Global.can_draw && Global.has_focus && Global.current_frame == frame: + if can_handle && Global.current_frame == frame: if fill_area == 0: #Paint the specific area of the same color var current_color : Color var horizontal_mirror := false @@ -189,7 +197,7 @@ func _process(delta) -> void: layers[current_layer_index][0].set_pixel(xx, yy, current_color) sprite_changed_this_frame = true "LightenDarken": - if mouse_in_canvas && Global.can_draw && Global.has_focus && Global.current_frame == frame: + if can_handle && Global.current_frame == frame: var pixel_color : Color = layers[current_layer_index][0].get_pixelv(mouse_pos) var color_changed : Color if ld == 0: #Lighten @@ -222,7 +230,7 @@ func _process(delta) -> void: Global.selection_rectangle.polygon[2] = end_pos Global.selection_rectangle.polygon[3] = Vector2(start_pos.x, end_pos.y) "ColorPicker": - if mouse_in_canvas && Global.can_draw && Global.has_focus && Global.current_frame == frame: + if can_handle && Global.current_frame == frame: var pixel_color : Color = layers[current_layer_index][0].get_pixelv(mouse_pos) if current_mouse_button == "left_mouse": Global.left_color_picker.color = pixel_color diff --git a/Scripts/SelectionRectangle.gd b/Scripts/SelectionRectangle.gd index 9c8fb86c9..03858fb9c 100644 --- a/Scripts/SelectionRectangle.gd +++ b/Scripts/SelectionRectangle.gd @@ -28,6 +28,7 @@ func _process(delta) -> void: if point_in_rectangle(mouse_pos, polygon[0], polygon[2]) && Global.selected_pixels.size() > 0 && (Global.current_left_tool == "RectSelect" || Global.current_right_tool == "RectSelect"): get_parent().get_parent().mouse_default_cursor_shape = Input.CURSOR_MOVE + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) if (Global.current_left_tool == "RectSelect" && Input.is_action_just_pressed("left_mouse")) || (Global.current_right_tool == "RectSelect" && Input.is_action_just_pressed("right_mouse")): #Begin dragging is_dragging = true