mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-13 09:13:07 +00:00
Move the option to the preferences
This commit is contained in:
parent
a672bbccff
commit
b754fa1105
Binary file not shown.
Before Width: | Height: | Size: 194 B |
|
@ -1,34 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ce4xwgq2ewig8"
|
||||
path="res://.godot/imported/share_config_off.png-c0be93b81740c9bf1e8080491cc2ab97.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/misc/share_config_off.png"
|
||||
dest_files=["res://.godot/imported/share_config_off.png-c0be93b81740c9bf1e8080491cc2ab97.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
Binary file not shown.
Before Width: | Height: | Size: 195 B |
|
@ -1,34 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ctqpf1rtxr8p2"
|
||||
path="res://.godot/imported/share_config_on.png-4896bc6065b2e26d04ed13bcdb11770c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/misc/share_config_on.png"
|
||||
dest_files=["res://.godot/imported/share_config_on.png-4896bc6065b2e26d04ed13bcdb11770c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
|
@ -273,6 +273,10 @@ var tool_button_size := ButtonSize.SMALL:
|
|||
return
|
||||
tool_button_size = value
|
||||
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.
|
||||
var left_tool_color := Color("0086cf"):
|
||||
set(value):
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
extends Node
|
||||
|
||||
signal color_changed(color: Color, button: int)
|
||||
@warning_ignore("unused_signal")
|
||||
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)
|
||||
|
@ -15,10 +14,6 @@ var horizontal_mirror := false
|
|||
var vertical_mirror := false
|
||||
var pixel_perfect := false
|
||||
var alpha_locked := false
|
||||
var share_config := false:
|
||||
set(value):
|
||||
share_config = value
|
||||
attempt_config_share(MOUSE_BUTTON_LEFT)
|
||||
|
||||
# Dynamics
|
||||
var stabilizer_enabled := false
|
||||
|
@ -383,8 +378,11 @@ func _ready() -> void:
|
|||
## 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 = {}):
|
||||
if share_config:
|
||||
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:
|
||||
|
@ -394,16 +392,13 @@ func attempt_config_share(from_idx: int, config: Dictionary = {}):
|
|||
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 target_slot: # FailSafe Check
|
||||
# Using call() to avoid errors in case a tool doesn't contain the method
|
||||
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:
|
||||
|
@ -434,9 +429,9 @@ func remove_tool(t: Tool) -> void:
|
|||
|
||||
|
||||
func set_tool(tool_name: String, button: int) -> void:
|
||||
## To prevent any unintentional syncing, we will temporarily disconnect the signal
|
||||
if Tools.config_changed.is_connected(attempt_config_share):
|
||||
Tools.config_changed.disconnect(attempt_config_share)
|
||||
# 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 panel: Node = _panels[button]
|
||||
var node: Node = tools[tool_name].instantiate_scene()
|
||||
|
@ -461,8 +456,8 @@ func set_tool(tool_name: String, button: int) -> void:
|
|||
|
||||
# Wait for config to get loaded, then re-connect and sync
|
||||
await get_tree().process_frame
|
||||
if not Tools.config_changed.is_connected(attempt_config_share):
|
||||
Tools.config_changed.connect(attempt_config_share)
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -36,10 +36,16 @@ var preferences: Array[Preference] = [
|
|||
"custom_icon_color", "Interface/ButtonOptions/IconColorButton", "color", Color.GRAY
|
||||
),
|
||||
Preference.new(
|
||||
"left_tool_color", "Interface/ButtonOptions/LeftToolColorButton", "color", Color("0086cf")
|
||||
"share_options_between_tools",
|
||||
"Tools/ToolOptions/ShareOptionsCheckBox",
|
||||
"button_pressed",
|
||||
false
|
||||
),
|
||||
Preference.new(
|
||||
"right_tool_color", "Interface/ButtonOptions/RightToolColorButton", "color", Color("fd6d14")
|
||||
"left_tool_color", "Tools/ToolOptions/LeftToolColorButton", "color", Color("0086cf")
|
||||
),
|
||||
Preference.new(
|
||||
"right_tool_color", "Tools/ToolOptions/RightToolColorButton", "color", Color("fd6d14")
|
||||
),
|
||||
Preference.new(
|
||||
"tool_button_size",
|
||||
|
|
|
@ -324,26 +324,6 @@ layout_mode = 2
|
|||
mouse_default_cursor_shape = 2
|
||||
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"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
@ -875,6 +855,49 @@ layout_mode = 2
|
|||
mouse_default_cursor_shape = 2
|
||||
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"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
|
|
@ -71,7 +71,6 @@ func _on_Brush_selected(brush: Brushes.Brush) -> void:
|
|||
|
||||
|
||||
func _on_BrushSize_value_changed(value: float) -> void:
|
||||
if _brush_size != int(value):
|
||||
_brush_size = int(value)
|
||||
_brush_size_dynamics = _brush_size
|
||||
if Tools.dynamics_size != Tools.Dynamics.NONE:
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
class_name BaseTool
|
||||
extends VBoxContainer
|
||||
|
||||
signal config_changed(config: Dictionary)
|
||||
|
||||
var is_moving := false
|
||||
var is_syncing := false
|
||||
var kname: String
|
||||
var tool_slot: Tools.Slot = null
|
||||
var cursor_text := ""
|
||||
|
@ -37,7 +34,6 @@ func _ready() -> void:
|
|||
func save_config() -> void:
|
||||
var config := get_config()
|
||||
Global.config_cache.set_value(tool_slot.kname, kname, config)
|
||||
if not is_syncing: # If the tool isn't buzy syncing with another tool
|
||||
Tools.config_changed.emit(tool_slot.button, config)
|
||||
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ func _input(event: InputEvent) -> void:
|
|||
if event.is_action_pressed("change_tool_mode"):
|
||||
_prev_mode = overwrite_button.button_pressed
|
||||
if event.is_action("change_tool_mode"):
|
||||
overwrite_button.button_pressed = !_prev_mode
|
||||
overwrite_button.set_pressed_no_signal(!_prev_mode)
|
||||
_overwrite = overwrite_button.button_pressed
|
||||
if event.is_action_released("change_tool_mode"):
|
||||
overwrite_button.button_pressed = _prev_mode
|
||||
overwrite_button.set_pressed_no_signal(_prev_mode)
|
||||
_overwrite = overwrite_button.button_pressed
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ extends PanelContainer
|
|||
@onready var pixel_perfect: BaseButton = grid_container.get_node("PixelPerfect")
|
||||
@onready var alpha_lock: BaseButton = grid_container.get_node("AlphaLock")
|
||||
@onready var dynamics: Button = $"%Dynamics"
|
||||
@onready var share_config: BaseButton = grid_container.get_node("ShareConfig")
|
||||
@onready var dynamics_panel: PopupPanel = $DynamicsPanel
|
||||
|
||||
|
||||
|
@ -114,13 +113,3 @@ func _on_vertical_mirror_options_id_pressed(id: int) -> void:
|
|||
project.y_symmetry_point = Global.camera.camera_screen_center.y * 2
|
||||
project.x_symmetry_axis.points[0].y = project.y_symmetry_point / 2 + 0.5
|
||||
project.x_symmetry_axis.points[1].y = project.y_symmetry_point / 2 + 0.5
|
||||
|
||||
|
||||
func _on_share_config_toggled(toggled_on: bool) -> void:
|
||||
Tools.share_config = toggled_on
|
||||
Global.config_cache.set_value("tools", "share_config", toggled_on)
|
||||
var texture_button: TextureRect = share_config.get_node("TextureRect")
|
||||
var file_name := "share_config_on.png"
|
||||
if not toggled_on:
|
||||
file_name = "share_config_off.png"
|
||||
Global.change_button_texturerect(texture_button, file_name)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=26 format=3 uid="uid://wo0hqxkst808"]
|
||||
[gd_scene load_steps=25 format=3 uid="uid://wo0hqxkst808"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cjrokejjsp5dm" path="res://assets/graphics/misc/horizontal_mirror_off.png" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://hiduvaa73fr6" path="res://assets/graphics/misc/vertical_mirror_off.png" id="2"]
|
||||
|
@ -11,7 +11,6 @@
|
|||
[ext_resource type="Texture2D" uid="uid://di8au2u87jgv5" path="res://assets/graphics/misc/uncheck.png" id="7"]
|
||||
[ext_resource type="Script" path="res://src/UI/GlobalToolOptions/DynamicsPanel.gd" id="7_iqcw1"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmsc0s03pwji4" path="res://src/UI/Nodes/MaxMinEdit.tscn" id="8"]
|
||||
[ext_resource type="Texture2D" uid="uid://ce4xwgq2ewig8" path="res://assets/graphics/misc/share_config_off.png" id="8_7jpan"]
|
||||
|
||||
[sub_resource type="InputEventAction" id="InputEventAction_4k08w"]
|
||||
action = &"horizontal_mirror"
|
||||
|
@ -238,26 +237,6 @@ offset_right = 11.0
|
|||
offset_bottom = 10.0
|
||||
texture = ExtResource("6")
|
||||
|
||||
[node name="ShareConfig" type="Button" parent="ScrollContainer/CenterContainer/GridContainer"]
|
||||
custom_minimum_size = Vector2(32, 32)
|
||||
layout_mode = 2
|
||||
tooltip_text = "Share config between tools."
|
||||
mouse_default_cursor_shape = 2
|
||||
toggle_mode = true
|
||||
shortcut = SubResource("Shortcut_vcyug")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/ShareConfig"]
|
||||
layout_mode = 0
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -11.0
|
||||
offset_top = -10.0
|
||||
offset_right = 11.0
|
||||
offset_bottom = 10.0
|
||||
texture = ExtResource("8_7jpan")
|
||||
|
||||
[node name="DynamicsPanel" type="PopupPanel" parent="."]
|
||||
canvas_item_default_texture_filter = 0
|
||||
size = Vector2i(300, 334)
|
||||
|
@ -568,7 +547,6 @@ offset_bottom = 23.0
|
|||
[connection signal="toggled" from="ScrollContainer/CenterContainer/GridContainer/PixelPerfect" to="." method="_on_PixelPerfect_toggled"]
|
||||
[connection signal="toggled" from="ScrollContainer/CenterContainer/GridContainer/AlphaLock" to="." method="_on_alpha_lock_toggled"]
|
||||
[connection signal="pressed" from="ScrollContainer/CenterContainer/GridContainer/Dynamics" to="." method="_on_Dynamics_pressed"]
|
||||
[connection signal="toggled" from="ScrollContainer/CenterContainer/GridContainer/ShareConfig" to="." method="_on_share_config_toggled"]
|
||||
[connection signal="toggled" from="DynamicsPanel/VBoxContainer/StabilizerContainer/EnableStabilizer" to="DynamicsPanel" method="_on_enable_stabilizer_toggled"]
|
||||
[connection signal="value_changed" from="DynamicsPanel/VBoxContainer/StabilizerContainer/StabilizerValue" to="DynamicsPanel" method="_on_stabilizer_value_value_changed"]
|
||||
[connection signal="value_changed" from="DynamicsPanel/VBoxContainer/LimitContainer/AlphaMin" to="DynamicsPanel" method="_on_alpha_min_value_changed"]
|
||||
|
|
Loading…
Reference in a new issue