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

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.
This commit is contained in:
OverloadedOrama 2019-12-06 00:27:47 +02:00
parent 340af88eb4
commit da61234b13
7 changed files with 113 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Bucket_Cursor.png-8abbae452d9f96bd83cd2d0982f01047.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Tools/Bucket_Cursor.png"
dest_files=[ "res://.import/Bucket_Cursor.png-8abbae452d9f96bd83cd2d0982f01047.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

View file

@ -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

View file

@ -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 )

View file

@ -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

View file

@ -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