mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-13 17:23:08 +00:00
Compare commits
No commits in common. "d894e9db860ddad9f82011baa9babcb2d8e3e267" and "1ae34bf57abd1688eb46d43ee027266585c91cf5" have entirely different histories.
d894e9db86
...
1ae34bf57a
|
@ -898,10 +898,6 @@ msgstr ""
|
||||||
msgid "Background color:"
|
msgid "Background color:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. Found in the preferences, under the Tools category.
|
|
||||||
msgid "Share options between the left and the right tools"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Left tool color:"
|
msgid "Left tool color:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -903,11 +903,6 @@ previous_project={
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
centre_canvas={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":67,"physical_keycode":0,"key_label":0,"unicode":67,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
[input_devices]
|
[input_devices]
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ enum FileMenu { NEW, OPEN, OPEN_LAST_PROJECT, RECENT, SAVE, SAVE_AS, EXPORT, EXP
|
||||||
enum EditMenu { UNDO, REDO, COPY, CUT, PASTE, PASTE_IN_PLACE, DELETE, NEW_BRUSH, PREFERENCES }
|
enum EditMenu { UNDO, REDO, COPY, CUT, PASTE, PASTE_IN_PLACE, DELETE, NEW_BRUSH, PREFERENCES }
|
||||||
## Enumeration of items present in the View Menu.
|
## Enumeration of items present in the View Menu.
|
||||||
enum ViewMenu {
|
enum ViewMenu {
|
||||||
CENTRE_CANVAS,
|
|
||||||
TILE_MODE,
|
TILE_MODE,
|
||||||
TILE_MODE_OFFSETS,
|
TILE_MODE_OFFSETS,
|
||||||
GREYSCALE_VIEW,
|
GREYSCALE_VIEW,
|
||||||
|
@ -277,10 +276,6 @@ var tool_button_size := ButtonSize.SMALL:
|
||||||
return
|
return
|
||||||
tool_button_size = value
|
tool_button_size = value
|
||||||
Tools.set_button_size(tool_button_size)
|
Tools.set_button_size(tool_button_size)
|
||||||
var share_options_between_tools := false:
|
|
||||||
set(value):
|
|
||||||
share_options_between_tools = value
|
|
||||||
Tools.attempt_config_share(MOUSE_BUTTON_LEFT)
|
|
||||||
## Found in Preferences. The left tool color.
|
## Found in Preferences. The left tool color.
|
||||||
var left_tool_color := Color("0086cf"):
|
var left_tool_color := Color("0086cf"):
|
||||||
set(value):
|
set(value):
|
||||||
|
@ -751,7 +746,6 @@ func _initialize_keychain() -> void:
|
||||||
&"palettize": Keychain.InputAction.new("", "Effects menu", true),
|
&"palettize": Keychain.InputAction.new("", "Effects menu", true),
|
||||||
&"pixelize": Keychain.InputAction.new("", "Effects menu", true),
|
&"pixelize": Keychain.InputAction.new("", "Effects menu", true),
|
||||||
&"posterize": Keychain.InputAction.new("", "Effects menu", true),
|
&"posterize": Keychain.InputAction.new("", "Effects menu", true),
|
||||||
&"centre_canvas": Keychain.InputAction.new("", "View menu", true),
|
|
||||||
&"mirror_view": Keychain.InputAction.new("", "View menu", true),
|
&"mirror_view": Keychain.InputAction.new("", "View menu", true),
|
||||||
&"show_grid": Keychain.InputAction.new("", "View menu", true),
|
&"show_grid": Keychain.InputAction.new("", "View menu", true),
|
||||||
&"show_pixel_grid": Keychain.InputAction.new("", "View menu", true),
|
&"show_pixel_grid": Keychain.InputAction.new("", "View menu", true),
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
signal color_changed(color: Color, button: int)
|
signal color_changed(color: Color, button: int)
|
||||||
signal config_changed(slot_idx: int, config: Dictionary)
|
|
||||||
@warning_ignore("unused_signal")
|
|
||||||
signal flip_rotated(flip_x, flip_y, rotate_90, rotate_180, rotate_270)
|
signal flip_rotated(flip_x, flip_y, rotate_90, rotate_180, rotate_270)
|
||||||
signal options_reset
|
signal options_reset
|
||||||
|
|
||||||
|
@ -375,34 +373,6 @@ func _ready() -> void:
|
||||||
_show_relevant_tools(layer_type)
|
_show_relevant_tools(layer_type)
|
||||||
|
|
||||||
|
|
||||||
## Syncs the other tool using the config of tool located at [param from_idx].[br]
|
|
||||||
## NOTE: For optimization, if there is already a ready made config available, then we will use that
|
|
||||||
## instead of re-calculating the config, else we have no choice but to re-generate it
|
|
||||||
func attempt_config_share(from_idx: int, config: Dictionary = {}) -> void:
|
|
||||||
if not Global.share_options_between_tools:
|
|
||||||
return
|
|
||||||
if _slots.is_empty():
|
|
||||||
return
|
|
||||||
if config.is_empty() and _slots[from_idx]:
|
|
||||||
var from_slot: Slot = _slots.get(from_idx, null)
|
|
||||||
if from_slot:
|
|
||||||
var from_tool = from_slot.tool_node
|
|
||||||
if from_tool.has_method("get_config"):
|
|
||||||
config = from_tool.get_config()
|
|
||||||
var target_slot: Slot = _slots.get(MOUSE_BUTTON_LEFT, null)
|
|
||||||
if from_idx == MOUSE_BUTTON_LEFT:
|
|
||||||
target_slot = _slots.get(MOUSE_BUTTON_RIGHT, null)
|
|
||||||
if is_instance_valid(target_slot):
|
|
||||||
if (
|
|
||||||
target_slot.tool_node.has_method("set_config")
|
|
||||||
and target_slot.tool_node.has_method("update_config")
|
|
||||||
):
|
|
||||||
target_slot.tool_node.set("is_syncing", true)
|
|
||||||
target_slot.tool_node.set_config(config)
|
|
||||||
target_slot.tool_node.update_config()
|
|
||||||
target_slot.tool_node.set("is_syncing", false)
|
|
||||||
|
|
||||||
|
|
||||||
func reset_options() -> void:
|
func reset_options() -> void:
|
||||||
default_color()
|
default_color()
|
||||||
assign_tool(get_tool(MOUSE_BUTTON_LEFT).tool_node.name, MOUSE_BUTTON_LEFT, true)
|
assign_tool(get_tool(MOUSE_BUTTON_LEFT).tool_node.name, MOUSE_BUTTON_LEFT, true)
|
||||||
|
@ -431,13 +401,9 @@ func remove_tool(t: Tool) -> void:
|
||||||
|
|
||||||
|
|
||||||
func set_tool(tool_name: String, button: int) -> void:
|
func set_tool(tool_name: String, button: int) -> void:
|
||||||
# To prevent any unintentional syncing, we will temporarily disconnect the signal
|
|
||||||
if config_changed.is_connected(attempt_config_share):
|
|
||||||
config_changed.disconnect(attempt_config_share)
|
|
||||||
var slot: Slot = _slots[button]
|
var slot: Slot = _slots[button]
|
||||||
var panel: Node = _panels[button]
|
var panel: Node = _panels[button]
|
||||||
var node: Node = tools[tool_name].instantiate_scene()
|
var node: Node = tools[tool_name].instantiate_scene()
|
||||||
var config_slot := MOUSE_BUTTON_LEFT if button == MOUSE_BUTTON_RIGHT else MOUSE_BUTTON_RIGHT
|
|
||||||
if button == MOUSE_BUTTON_LEFT: # As guides are only moved with left mouse
|
if button == MOUSE_BUTTON_LEFT: # As guides are only moved with left mouse
|
||||||
if tool_name == "Pan": # tool you want to give more access at guides
|
if tool_name == "Pan": # tool you want to give more access at guides
|
||||||
Global.move_guides_on_canvas = true
|
Global.move_guides_on_canvas = true
|
||||||
|
@ -456,12 +422,6 @@ func set_tool(tool_name: String, button: int) -> void:
|
||||||
elif button == MOUSE_BUTTON_RIGHT:
|
elif button == MOUSE_BUTTON_RIGHT:
|
||||||
_right_tools_per_layer_type[_curr_layer_type] = tool_name
|
_right_tools_per_layer_type[_curr_layer_type] = tool_name
|
||||||
|
|
||||||
# Wait for config to get loaded, then re-connect and sync
|
|
||||||
await get_tree().process_frame
|
|
||||||
if not config_changed.is_connected(attempt_config_share):
|
|
||||||
config_changed.connect(attempt_config_share)
|
|
||||||
attempt_config_share(config_slot) # Sync it with the other tool
|
|
||||||
|
|
||||||
|
|
||||||
func get_tool(button: int) -> Slot:
|
func get_tool(button: int) -> Slot:
|
||||||
return _slots[button]
|
return _slots[button]
|
||||||
|
|
|
@ -36,16 +36,10 @@ var preferences: Array[Preference] = [
|
||||||
"custom_icon_color", "Interface/ButtonOptions/IconColorButton", "color", Color.GRAY
|
"custom_icon_color", "Interface/ButtonOptions/IconColorButton", "color", Color.GRAY
|
||||||
),
|
),
|
||||||
Preference.new(
|
Preference.new(
|
||||||
"share_options_between_tools",
|
"left_tool_color", "Interface/ButtonOptions/LeftToolColorButton", "color", Color("0086cf")
|
||||||
"Tools/ToolOptions/ShareOptionsCheckBox",
|
|
||||||
"button_pressed",
|
|
||||||
false
|
|
||||||
),
|
),
|
||||||
Preference.new(
|
Preference.new(
|
||||||
"left_tool_color", "Tools/ToolOptions/LeftToolColorButton", "color", Color("0086cf")
|
"right_tool_color", "Interface/ButtonOptions/RightToolColorButton", "color", Color("fd6d14")
|
||||||
),
|
|
||||||
Preference.new(
|
|
||||||
"right_tool_color", "Tools/ToolOptions/RightToolColorButton", "color", Color("fd6d14")
|
|
||||||
),
|
),
|
||||||
Preference.new(
|
Preference.new(
|
||||||
"tool_button_size",
|
"tool_button_size",
|
||||||
|
|
|
@ -324,6 +324,26 @@ layout_mode = 2
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
color = Color(0.75, 0.75, 0.75, 1)
|
color = Color(0.75, 0.75, 0.75, 1)
|
||||||
|
|
||||||
|
[node name="Label4" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/ButtonOptions"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Left tool color:"
|
||||||
|
|
||||||
|
[node name="LeftToolColorButton" type="ColorPickerButton" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/ButtonOptions"]
|
||||||
|
custom_minimum_size = Vector2(64, 20)
|
||||||
|
layout_mode = 2
|
||||||
|
mouse_default_cursor_shape = 2
|
||||||
|
color = Color(0, 0.52549, 0.811765, 1)
|
||||||
|
|
||||||
|
[node name="Label5" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/ButtonOptions"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Right tool color:"
|
||||||
|
|
||||||
|
[node name="RightToolColorButton" type="ColorPickerButton" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/ButtonOptions"]
|
||||||
|
custom_minimum_size = Vector2(64, 20)
|
||||||
|
layout_mode = 2
|
||||||
|
mouse_default_cursor_shape = 2
|
||||||
|
color = Color(0.992157, 0.427451, 0.0784314, 1)
|
||||||
|
|
||||||
[node name="Canvas" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide"]
|
[node name="Canvas" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
@ -855,49 +875,6 @@ layout_mode = 2
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
color = Color(0, 0, 1, 1)
|
color = Color(0, 0, 1, 1)
|
||||||
|
|
||||||
[node name="Tools" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide"]
|
|
||||||
visible = false
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="ToolOptions" type="GridContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools"]
|
|
||||||
layout_mode = 2
|
|
||||||
columns = 3
|
|
||||||
|
|
||||||
[node name="ShareOptionsLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools/ToolOptions"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
text = "Share options between the left and the right tools"
|
|
||||||
|
|
||||||
[node name="ShareOptionsCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools/ToolOptions"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
mouse_default_cursor_shape = 2
|
|
||||||
text = "On"
|
|
||||||
|
|
||||||
[node name="LeftToolColorLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools/ToolOptions"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
text = "Left tool color:"
|
|
||||||
|
|
||||||
[node name="LeftToolColorButton" type="ColorPickerButton" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools/ToolOptions"]
|
|
||||||
custom_minimum_size = Vector2(64, 20)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
mouse_default_cursor_shape = 2
|
|
||||||
color = Color(0, 0.52549, 0.811765, 1)
|
|
||||||
|
|
||||||
[node name="RightToolColorLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools/ToolOptions"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
text = "Right tool color:"
|
|
||||||
|
|
||||||
[node name="RightToolColorButton" type="ColorPickerButton" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools/ToolOptions"]
|
|
||||||
custom_minimum_size = Vector2(64, 20)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
mouse_default_cursor_shape = 2
|
|
||||||
color = Color(0.992157, 0.427451, 0.0784314, 1)
|
|
||||||
|
|
||||||
[node name="Selection" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide"]
|
[node name="Selection" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
|
@ -71,13 +71,14 @@ func _on_Brush_selected(brush: Brushes.Brush) -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_BrushSize_value_changed(value: float) -> void:
|
func _on_BrushSize_value_changed(value: float) -> void:
|
||||||
_brush_size = int(value)
|
if _brush_size != int(value):
|
||||||
_brush_size_dynamics = _brush_size
|
_brush_size = int(value)
|
||||||
if Tools.dynamics_size != Tools.Dynamics.NONE:
|
_brush_size_dynamics = _brush_size
|
||||||
_brush_size_dynamics = Tools.brush_size_min
|
if Tools.dynamics_size != Tools.Dynamics.NONE:
|
||||||
_cache_limit = (_brush_size * _brush_size) * 3 # This equation seems the best match
|
_brush_size_dynamics = Tools.brush_size_min
|
||||||
update_config()
|
_cache_limit = (_brush_size * _brush_size) * 3 # This equation seems the best match
|
||||||
save_config()
|
update_config()
|
||||||
|
save_config()
|
||||||
|
|
||||||
|
|
||||||
func _reset_dynamics() -> void:
|
func _reset_dynamics() -> void:
|
||||||
|
@ -112,11 +113,6 @@ func get_config() -> Dictionary:
|
||||||
"brush_index": _brush.index,
|
"brush_index": _brush.index,
|
||||||
"brush_size": _brush_size,
|
"brush_size": _brush_size,
|
||||||
"brush_interpolate": _brush_interpolate,
|
"brush_interpolate": _brush_interpolate,
|
||||||
"brush_flip_x": _brush_flip_x,
|
|
||||||
"brush_flip_y": _brush_flip_y,
|
|
||||||
"brush_rotate_90": _brush_rotate_90,
|
|
||||||
"brush_rotate_180": _brush_rotate_180,
|
|
||||||
"brush_rotate_270": _brush_rotate_270,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,11 +125,6 @@ func set_config(config: Dictionary) -> void:
|
||||||
if Tools.dynamics_size != Tools.Dynamics.NONE:
|
if Tools.dynamics_size != Tools.Dynamics.NONE:
|
||||||
_brush_size_dynamics = Tools.brush_size_min
|
_brush_size_dynamics = Tools.brush_size_min
|
||||||
_brush_interpolate = config.get("brush_interpolate", _brush_interpolate)
|
_brush_interpolate = config.get("brush_interpolate", _brush_interpolate)
|
||||||
_brush_flip_x = config.get("brush_flip_x", _brush_flip_x)
|
|
||||||
_brush_flip_y = config.get("brush_flip_y", _brush_flip_y)
|
|
||||||
_brush_rotate_90 = config.get("brush_rotate_90", _brush_rotate_90)
|
|
||||||
_brush_rotate_180 = config.get("brush_rotate_180", _brush_rotate_180)
|
|
||||||
_brush_rotate_270 = config.get("brush_rotate_270", _brush_rotate_270)
|
|
||||||
|
|
||||||
|
|
||||||
func update_config() -> void:
|
func update_config() -> void:
|
||||||
|
@ -752,28 +743,23 @@ func _pick_color(pos: Vector2i) -> void:
|
||||||
func _on_flip_x_toggled(button_pressed: bool) -> void:
|
func _on_flip_x_toggled(button_pressed: bool) -> void:
|
||||||
_brush_flip_x = button_pressed
|
_brush_flip_x = button_pressed
|
||||||
update_brush()
|
update_brush()
|
||||||
save_config()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_flip_y_toggled(button_pressed: bool) -> void:
|
func _on_flip_y_toggled(button_pressed: bool) -> void:
|
||||||
_brush_flip_y = button_pressed
|
_brush_flip_y = button_pressed
|
||||||
update_brush()
|
update_brush()
|
||||||
save_config()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_rotate_90_toggled(button_pressed: bool) -> void:
|
func _on_rotate_90_toggled(button_pressed: bool) -> void:
|
||||||
_brush_rotate_90 = button_pressed
|
_brush_rotate_90 = button_pressed
|
||||||
update_brush()
|
update_brush()
|
||||||
save_config()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_rotate_180_toggled(button_pressed: bool) -> void:
|
func _on_rotate_180_toggled(button_pressed: bool) -> void:
|
||||||
_brush_rotate_180 = button_pressed
|
_brush_rotate_180 = button_pressed
|
||||||
update_brush()
|
update_brush()
|
||||||
save_config()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_rotate_270_toggled(button_pressed: bool) -> void:
|
func _on_rotate_270_toggled(button_pressed: bool) -> void:
|
||||||
_brush_rotate_270 = button_pressed
|
_brush_rotate_270 = button_pressed
|
||||||
update_brush()
|
update_brush()
|
||||||
save_config()
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ extends "res://src/Tools/BaseDraw.gd"
|
||||||
var _start := Vector2i.ZERO
|
var _start := Vector2i.ZERO
|
||||||
var _offset := Vector2i.ZERO
|
var _offset := Vector2i.ZERO
|
||||||
var _dest := Vector2i.ZERO
|
var _dest := Vector2i.ZERO
|
||||||
var _fill_inside := false
|
var _fill := false
|
||||||
var _drawing := false
|
var _drawing := false
|
||||||
var _displace_origin := false
|
var _displace_origin := false
|
||||||
var _thickness := 1
|
var _thickness := 1
|
||||||
|
@ -41,27 +41,27 @@ func update_indicator() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_FillCheckbox_toggled(button_pressed: bool) -> void:
|
func _on_FillCheckbox_toggled(button_pressed: bool) -> void:
|
||||||
_fill_inside = button_pressed
|
_fill = button_pressed
|
||||||
update_config()
|
update_config()
|
||||||
save_config()
|
save_config()
|
||||||
|
|
||||||
|
|
||||||
func get_config() -> Dictionary:
|
func get_config() -> Dictionary:
|
||||||
var config := super.get_config()
|
var config := super.get_config()
|
||||||
config["fill_inside"] = _fill_inside
|
config["fill"] = _fill
|
||||||
config["thickness"] = _thickness
|
config["thickness"] = _thickness
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
func set_config(config: Dictionary) -> void:
|
func set_config(config: Dictionary) -> void:
|
||||||
super.set_config(config)
|
super.set_config(config)
|
||||||
_fill_inside = config.get("fill_inside", _fill_inside)
|
_fill = config.get("fill", _fill)
|
||||||
_thickness = config.get("thickness", _thickness)
|
_thickness = config.get("thickness", _thickness)
|
||||||
|
|
||||||
|
|
||||||
func update_config() -> void:
|
func update_config() -> void:
|
||||||
super.update_config()
|
super.update_config()
|
||||||
$FillCheckbox.button_pressed = _fill_inside
|
$FillCheckbox.button_pressed = _fill
|
||||||
$ThicknessSlider.value = _thickness
|
$ThicknessSlider.value = _thickness
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ func _get_result_rect(origin: Vector2i, dest: Vector2i) -> Rect2i:
|
||||||
|
|
||||||
|
|
||||||
func _get_points(shape_size: Vector2i) -> Array[Vector2i]:
|
func _get_points(shape_size: Vector2i) -> Array[Vector2i]:
|
||||||
return _get_shape_points_filled(shape_size) if _fill_inside else _get_shape_points(shape_size)
|
return _get_shape_points_filled(shape_size) if _fill else _get_shape_points(shape_size)
|
||||||
|
|
||||||
|
|
||||||
func _set_cursor_text(rect: Rect2i) -> void:
|
func _set_cursor_text(rect: Rect2i) -> void:
|
||||||
|
|
|
@ -2,7 +2,6 @@ class_name BaseTool
|
||||||
extends VBoxContainer
|
extends VBoxContainer
|
||||||
|
|
||||||
var is_moving := false
|
var is_moving := false
|
||||||
var is_syncing := false
|
|
||||||
var kname: String
|
var kname: String
|
||||||
var tool_slot: Tools.Slot = null
|
var tool_slot: Tools.Slot = null
|
||||||
var cursor_text := ""
|
var cursor_text := ""
|
||||||
|
@ -35,8 +34,6 @@ func _ready() -> void:
|
||||||
func save_config() -> void:
|
func save_config() -> void:
|
||||||
var config := get_config()
|
var config := get_config()
|
||||||
Global.config_cache.set_value(tool_slot.kname, kname, config)
|
Global.config_cache.set_value(tool_slot.kname, kname, config)
|
||||||
if not is_syncing: # If the tool isn't busy syncing with another tool.
|
|
||||||
Tools.config_changed.emit(tool_slot.button, config)
|
|
||||||
|
|
||||||
|
|
||||||
func load_config() -> void:
|
func load_config() -> void:
|
||||||
|
|
|
@ -2,7 +2,7 @@ extends "res://src/Tools/BaseDraw.gd"
|
||||||
|
|
||||||
var _curve := Curve2D.new() ## The [Curve2D] responsible for the shape of the curve being drawn.
|
var _curve := Curve2D.new() ## The [Curve2D] responsible for the shape of the curve being drawn.
|
||||||
var _drawing := false ## Set to true when a curve is being drawn.
|
var _drawing := false ## Set to true when a curve is being drawn.
|
||||||
var _fill_inside := false ## When true, the inside area of the curve gets filled.
|
var _fill := false ## When true, the inside area of the curve gets filled.
|
||||||
var _fill_inside_rect := Rect2i() ## The bounding box that surrounds the area that gets filled.
|
var _fill_inside_rect := Rect2i() ## The bounding box that surrounds the area that gets filled.
|
||||||
var _editing_bezier := false ## Needed to determine when to show the control points preview line.
|
var _editing_bezier := false ## Needed to determine when to show the control points preview line.
|
||||||
var _editing_out_control_point := false ## True when controlling the out control point only.
|
var _editing_out_control_point := false ## True when controlling the out control point only.
|
||||||
|
@ -29,7 +29,7 @@ func _on_thickness_value_changed(value: int) -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_fill_checkbox_toggled(toggled_on: bool) -> void:
|
func _on_fill_checkbox_toggled(toggled_on: bool) -> void:
|
||||||
_fill_inside = toggled_on
|
_fill = toggled_on
|
||||||
update_config()
|
update_config()
|
||||||
save_config()
|
save_config()
|
||||||
|
|
||||||
|
@ -44,20 +44,17 @@ func update_indicator() -> void:
|
||||||
|
|
||||||
func get_config() -> Dictionary:
|
func get_config() -> Dictionary:
|
||||||
var config := super.get_config()
|
var config := super.get_config()
|
||||||
config["fill_inside"] = _fill_inside
|
|
||||||
config["thickness"] = _thickness
|
config["thickness"] = _thickness
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
func set_config(config: Dictionary) -> void:
|
func set_config(config: Dictionary) -> void:
|
||||||
super.set_config(config)
|
super.set_config(config)
|
||||||
_fill_inside = config.get("fill_inside", _fill_inside)
|
|
||||||
_thickness = config.get("thickness", _thickness)
|
_thickness = config.get("thickness", _thickness)
|
||||||
|
|
||||||
|
|
||||||
func update_config() -> void:
|
func update_config() -> void:
|
||||||
super.update_config()
|
super.update_config()
|
||||||
$FillCheckbox.button_pressed = _fill_inside
|
|
||||||
$ThicknessSlider.value = _thickness
|
$ThicknessSlider.value = _thickness
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,7 +188,7 @@ func _draw_shape() -> void:
|
||||||
_fill_inside_rect = _fill_inside_rect.expand(point)
|
_fill_inside_rect = _fill_inside_rect.expand(point)
|
||||||
# Draw each point offsetted based on the shape's thickness
|
# Draw each point offsetted based on the shape's thickness
|
||||||
_draw_pixel(point, images)
|
_draw_pixel(point, images)
|
||||||
if _fill_inside:
|
if _fill:
|
||||||
var v := Vector2i()
|
var v := Vector2i()
|
||||||
for x in _fill_inside_rect.size.x:
|
for x in _fill_inside_rect.size.x:
|
||||||
v.x = x + _fill_inside_rect.position.x
|
v.x = x + _fill_inside_rect.position.x
|
||||||
|
|
|
@ -50,7 +50,6 @@ func _on_SpacingMode_toggled(button_pressed: bool) -> void:
|
||||||
|
|
||||||
func _on_Spacing_value_changed(value: Vector2) -> void:
|
func _on_Spacing_value_changed(value: Vector2) -> void:
|
||||||
_spacing = value
|
_spacing = value
|
||||||
save_config()
|
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
|
@ -59,10 +58,10 @@ func _input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed("change_tool_mode"):
|
if event.is_action_pressed("change_tool_mode"):
|
||||||
_prev_mode = overwrite_button.button_pressed
|
_prev_mode = overwrite_button.button_pressed
|
||||||
if event.is_action("change_tool_mode"):
|
if event.is_action("change_tool_mode"):
|
||||||
overwrite_button.set_pressed_no_signal(!_prev_mode)
|
overwrite_button.button_pressed = !_prev_mode
|
||||||
_overwrite = overwrite_button.button_pressed
|
_overwrite = overwrite_button.button_pressed
|
||||||
if event.is_action_released("change_tool_mode"):
|
if event.is_action_released("change_tool_mode"):
|
||||||
overwrite_button.set_pressed_no_signal(_prev_mode)
|
overwrite_button.button_pressed = _prev_mode
|
||||||
_overwrite = overwrite_button.button_pressed
|
_overwrite = overwrite_button.button_pressed
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,6 @@ anchor_bottom = 0.5
|
||||||
offset_left = -22.0
|
offset_left = -22.0
|
||||||
offset_top = -10.0
|
offset_top = -10.0
|
||||||
offset_bottom = 10.0
|
offset_bottom = 10.0
|
||||||
grow_horizontal = 0
|
|
||||||
grow_vertical = 2
|
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
item_count = 2
|
item_count = 2
|
||||||
popup/item_0/text = "Move to canvas center"
|
popup/item_0/text = "Move to canvas center"
|
||||||
|
|
|
@ -206,7 +206,6 @@ func _setup_edit_menu() -> void:
|
||||||
func _setup_view_menu() -> void:
|
func _setup_view_menu() -> void:
|
||||||
# Order as in Global.ViewMenu enum
|
# Order as in Global.ViewMenu enum
|
||||||
var view_menu_items := {
|
var view_menu_items := {
|
||||||
"Centre Canvas": "centre_canvas",
|
|
||||||
"Tile Mode": "",
|
"Tile Mode": "",
|
||||||
"Tile Mode Offsets": "",
|
"Tile Mode Offsets": "",
|
||||||
"Grayscale View": "",
|
"Grayscale View": "",
|
||||||
|
@ -227,8 +226,6 @@ func _setup_view_menu() -> void:
|
||||||
_setup_snap_to_submenu(item)
|
_setup_snap_to_submenu(item)
|
||||||
elif item == "Tile Mode Offsets":
|
elif item == "Tile Mode Offsets":
|
||||||
view_menu.add_item(item, i)
|
view_menu.add_item(item, i)
|
||||||
elif item == "Centre Canvas":
|
|
||||||
_set_menu_shortcut(view_menu_items[item], view_menu, i, item)
|
|
||||||
else:
|
else:
|
||||||
_set_menu_shortcut(view_menu_items[item], view_menu, i, item, true)
|
_set_menu_shortcut(view_menu_items[item], view_menu, i, item, true)
|
||||||
view_menu.set_item_checked(Global.ViewMenu.SHOW_RULERS, true)
|
view_menu.set_item_checked(Global.ViewMenu.SHOW_RULERS, true)
|
||||||
|
@ -602,8 +599,6 @@ func edit_menu_id_pressed(id: int) -> void:
|
||||||
|
|
||||||
func view_menu_id_pressed(id: int) -> void:
|
func view_menu_id_pressed(id: int) -> void:
|
||||||
match id:
|
match id:
|
||||||
Global.ViewMenu.CENTRE_CANVAS:
|
|
||||||
Global.camera.offset = Global.current_project.size / 2
|
|
||||||
Global.ViewMenu.TILE_MODE_OFFSETS:
|
Global.ViewMenu.TILE_MODE_OFFSETS:
|
||||||
_popup_dialog(get_tree().current_scene.tile_mode_offsets_dialog)
|
_popup_dialog(get_tree().current_scene.tile_mode_offsets_dialog)
|
||||||
Global.ViewMenu.GREYSCALE_VIEW:
|
Global.ViewMenu.GREYSCALE_VIEW:
|
||||||
|
|
Loading…
Reference in a new issue