mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-13 17:23:08 +00:00
Compare commits
8 commits
4dc55e538e
...
2cb29ab274
Author | SHA1 | Date | |
---|---|---|---|
|
2cb29ab274 | ||
|
a64f5f3429 | ||
|
203340b3a1 | ||
|
fd714d04df | ||
|
91f0b26245 | ||
|
120bd9a7df | ||
|
c83680183b | ||
|
263e19f17a |
|
@ -220,6 +220,10 @@ msgstr ""
|
||||||
msgid "Preferences"
|
msgid "Preferences"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. An option in the View menu. When selected, the canvas is being placed on the center of the screen.
|
||||||
|
msgid "Center Canvas"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Tile Mode"
|
msgid "Tile Mode"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -902,6 +906,11 @@ msgstr ""
|
||||||
msgid "Share options between the left and the right tools"
|
msgid "Share options between the left and the right tools"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. Found in the preferences, under the Tools category. Tooltip of the "Share options between the left and the right tools" preference.
|
||||||
|
msgid "If this is enabled, options will be synced between the left and the right tool.\n"
|
||||||
|
"For example, both tools will share the same brush size, and changing it on one tool will instantly change on the other."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Left tool color:"
|
msgid "Left tool color:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ boot_splash/use_filter=false
|
||||||
config/icon="res://assets/graphics/icons/icon.png"
|
config/icon="res://assets/graphics/icons/icon.png"
|
||||||
config/macos_native_icon="res://assets/graphics/icons/icon.icns"
|
config/macos_native_icon="res://assets/graphics/icons/icon.icns"
|
||||||
config/windows_native_icon="res://assets/graphics/icons/icon.ico"
|
config/windows_native_icon="res://assets/graphics/icons/icon.ico"
|
||||||
config/ExtensionsAPI_Version=4
|
config/ExtensionsAPI_Version=5
|
||||||
config/Pxo_Version=3
|
config/Pxo_Version=3
|
||||||
|
|
||||||
[audio]
|
[audio]
|
||||||
|
@ -903,7 +903,7 @@ 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={
|
center_canvas={
|
||||||
"deadzone": 0.5,
|
"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)
|
"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)
|
||||||
]
|
]
|
||||||
|
|
|
@ -409,6 +409,29 @@ class ThemeAPI:
|
||||||
Themes.remove_theme(theme)
|
Themes.remove_theme(theme)
|
||||||
ExtensionsApi.remove_action("ThemeAPI", "add_theme")
|
ExtensionsApi.remove_action("ThemeAPI", "add_theme")
|
||||||
|
|
||||||
|
## Adds a new font.
|
||||||
|
func add_font(font: Font) -> void:
|
||||||
|
Global.loaded_fonts.append(font)
|
||||||
|
Global.font_loaded.emit()
|
||||||
|
|
||||||
|
## Removes a loaded font.
|
||||||
|
## If that font is the current one of the interface, set it back to Roboto.
|
||||||
|
func remove_font(font: Font) -> void:
|
||||||
|
var font_index := Global.loaded_fonts.find(font)
|
||||||
|
if font_index == -1:
|
||||||
|
return
|
||||||
|
if Global.theme_font_index == font_index:
|
||||||
|
Global.theme_font_index = 1
|
||||||
|
Global.loaded_fonts.remove_at(font_index)
|
||||||
|
Global.font_loaded.emit()
|
||||||
|
|
||||||
|
## Sets a font as the current one for the interface. The font must have been
|
||||||
|
## added beforehand by [method add_font].
|
||||||
|
func set_font(font: Font) -> void:
|
||||||
|
var font_index := Global.loaded_fonts.find(font)
|
||||||
|
if font_index > -1:
|
||||||
|
Global.theme_font_index = font_index
|
||||||
|
|
||||||
|
|
||||||
## Gives ability to add/remove tools.
|
## Gives ability to add/remove tools.
|
||||||
class ToolAPI:
|
class ToolAPI:
|
||||||
|
|
|
@ -12,6 +12,7 @@ signal project_about_to_switch ## Emitted before a project is about to be switc
|
||||||
signal project_switched ## Emitted whenever you switch to some other project tab.
|
signal project_switched ## Emitted whenever you switch to some other project tab.
|
||||||
signal cel_switched ## Emitted whenever you select a different cel.
|
signal cel_switched ## Emitted whenever you select a different cel.
|
||||||
signal project_data_changed(project: Project) ## Emitted when project data is modified.
|
signal project_data_changed(project: Project) ## Emitted when project data is modified.
|
||||||
|
signal font_loaded ## Emitted when a new font has been loaded, or an old one gets unloaded.
|
||||||
|
|
||||||
enum LayerTypes { PIXEL, GROUP, THREE_D }
|
enum LayerTypes { PIXEL, GROUP, THREE_D }
|
||||||
enum GridTypes { CARTESIAN, ISOMETRIC, ALL }
|
enum GridTypes { CARTESIAN, ISOMETRIC, ALL }
|
||||||
|
@ -27,7 +28,7 @@ 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,
|
CENTER_CANVAS,
|
||||||
TILE_MODE,
|
TILE_MODE,
|
||||||
TILE_MODE_OFFSETS,
|
TILE_MODE_OFFSETS,
|
||||||
GREYSCALE_VIEW,
|
GREYSCALE_VIEW,
|
||||||
|
@ -210,6 +211,24 @@ var integer_zoom := false:
|
||||||
|
|
||||||
## Found in Preferences. The scale of the interface.
|
## Found in Preferences. The scale of the interface.
|
||||||
var shrink := 1.0
|
var shrink := 1.0
|
||||||
|
var theme_font := loaded_fonts[theme_font_index]:
|
||||||
|
set(value):
|
||||||
|
theme_font = value
|
||||||
|
if is_instance_valid(control) and is_instance_valid(control.theme):
|
||||||
|
control.theme.default_font = theme_font
|
||||||
|
## Found in Preferences. The index of the font used by the interface.
|
||||||
|
var theme_font_index := 1:
|
||||||
|
set(value):
|
||||||
|
theme_font_index = value
|
||||||
|
if theme_font_index < loaded_fonts.size():
|
||||||
|
theme_font = loaded_fonts[theme_font_index]
|
||||||
|
else:
|
||||||
|
var available_font_names := get_available_font_names()
|
||||||
|
if theme_font_index < available_font_names.size():
|
||||||
|
var font_name := available_font_names[theme_font_index]
|
||||||
|
theme_font = find_font_from_name(font_name)
|
||||||
|
else:
|
||||||
|
theme_font = loaded_fonts[1] # Fall back to Roboto if out of bounds
|
||||||
## Found in Preferences. The font size used by the interface.
|
## Found in Preferences. The font size used by the interface.
|
||||||
var font_size := 16
|
var font_size := 16
|
||||||
## Found in Preferences. If [code]true[/code], the interface dims on popups.
|
## Found in Preferences. If [code]true[/code], the interface dims on popups.
|
||||||
|
@ -277,6 +296,7 @@ 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)
|
||||||
|
## Found in Preferences.
|
||||||
var share_options_between_tools := false:
|
var share_options_between_tools := false:
|
||||||
set(value):
|
set(value):
|
||||||
share_options_between_tools = value
|
share_options_between_tools = value
|
||||||
|
@ -751,7 +771,7 @@ 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),
|
&"center_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),
|
||||||
|
|
|
@ -43,6 +43,8 @@ func remove_theme(theme: Theme) -> void:
|
||||||
func change_theme(id: int) -> void:
|
func change_theme(id: int) -> void:
|
||||||
theme_index = id
|
theme_index = id
|
||||||
var theme := themes[id]
|
var theme := themes[id]
|
||||||
|
if theme.default_font != Global.theme_font:
|
||||||
|
theme.default_font = Global.theme_font
|
||||||
theme.default_font_size = Global.font_size
|
theme.default_font_size = Global.font_size
|
||||||
theme.set_font_size("font_size", "HeaderSmall", Global.font_size + 2)
|
theme.set_font_size("font_size", "HeaderSmall", Global.font_size + 2)
|
||||||
var icon_color := theme.get_color("modulate_color", "Icons")
|
var icon_color := theme.get_color("modulate_color", "Icons")
|
||||||
|
|
|
@ -159,6 +159,12 @@ func _load_extension(extension_file_or_folder_name: StringName, internal := fals
|
||||||
var supported_api_versions = extension_json["supported_api_versions"]
|
var supported_api_versions = extension_json["supported_api_versions"]
|
||||||
if typeof(supported_api_versions) == TYPE_ARRAY:
|
if typeof(supported_api_versions) == TYPE_ARRAY:
|
||||||
supported_api_versions = PackedInt32Array(supported_api_versions)
|
supported_api_versions = PackedInt32Array(supported_api_versions)
|
||||||
|
# Extensions that support API version 4 are backwards compatible with version 5.
|
||||||
|
# Version 5 only adds new methods and does not break compatibility.
|
||||||
|
# TODO: Find a better way to determine which API versions
|
||||||
|
# have backwards compatibility with each other.
|
||||||
|
if 4 in supported_api_versions and not 5 in supported_api_versions:
|
||||||
|
supported_api_versions.append(5)
|
||||||
if not ExtensionsApi.get_api_version() in supported_api_versions:
|
if not ExtensionsApi.get_api_version() in supported_api_versions:
|
||||||
var err_text := (
|
var err_text := (
|
||||||
"The extension %s will not work on this version of Pixelorama \n"
|
"The extension %s will not work on this version of Pixelorama \n"
|
||||||
|
|
|
@ -9,6 +9,7 @@ var preferences: Array[Preference] = [
|
||||||
),
|
),
|
||||||
Preference.new("ffmpeg_path", "Startup/StartupContainer/FFMPEGPath", "text", ""),
|
Preference.new("ffmpeg_path", "Startup/StartupContainer/FFMPEGPath", "text", ""),
|
||||||
Preference.new("shrink", "%ShrinkSlider", "value", 1.0),
|
Preference.new("shrink", "%ShrinkSlider", "value", 1.0),
|
||||||
|
Preference.new("theme_font_index", "%FontOptionButton", "selected", 1),
|
||||||
Preference.new("font_size", "%FontSizeSlider", "value", 16),
|
Preference.new("font_size", "%FontSizeSlider", "value", 16),
|
||||||
Preference.new(
|
Preference.new(
|
||||||
"dim_on_popup", "Interface/InterfaceOptions/DimCheckBox", "button_pressed", true
|
"dim_on_popup", "Interface/InterfaceOptions/DimCheckBox", "button_pressed", true
|
||||||
|
@ -240,6 +241,7 @@ class Preference:
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
Global.font_loaded.connect(_add_fonts)
|
||||||
# Replace OK since preference changes are being applied immediately, not after OK confirmation
|
# Replace OK since preference changes are being applied immediately, not after OK confirmation
|
||||||
get_ok_button().text = "Close"
|
get_ok_button().text = "Close"
|
||||||
get_ok_button().size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
get_ok_button().size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
@ -292,6 +294,8 @@ func _ready() -> void:
|
||||||
language.add_child(button)
|
language.add_child(button)
|
||||||
button.pressed.connect(_on_language_pressed.bind(button.get_index()))
|
button.pressed.connect(_on_language_pressed.bind(button.get_index()))
|
||||||
|
|
||||||
|
_add_fonts()
|
||||||
|
|
||||||
for pref in preferences:
|
for pref in preferences:
|
||||||
if not right_side.has_node(pref.node_path):
|
if not right_side.has_node(pref.node_path):
|
||||||
continue
|
continue
|
||||||
|
@ -358,6 +362,14 @@ func _on_Preference_value_changed(value, pref: Preference, button: RestoreDefaul
|
||||||
disable_restore_default_button(button, disable)
|
disable_restore_default_button(button, disable)
|
||||||
|
|
||||||
|
|
||||||
|
## Add fonts to the font option button.
|
||||||
|
func _add_fonts() -> void:
|
||||||
|
%FontOptionButton.clear()
|
||||||
|
for font_name in Global.get_available_font_names():
|
||||||
|
%FontOptionButton.add_item(font_name)
|
||||||
|
%FontOptionButton.select(Global.theme_font_index)
|
||||||
|
|
||||||
|
|
||||||
func preference_update(require_restart := false) -> void:
|
func preference_update(require_restart := false) -> void:
|
||||||
if require_restart:
|
if require_restart:
|
||||||
must_restart.visible = true
|
must_restart.visible = true
|
||||||
|
|
|
@ -205,6 +205,15 @@ layout_mode = 2
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
text = "Apply"
|
text = "Apply"
|
||||||
|
|
||||||
|
[node name="FontLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Font:"
|
||||||
|
|
||||||
|
[node name="FontOptionButton" type="OptionButton" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="DimLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"]
|
[node name="DimLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
@ -866,11 +875,16 @@ columns = 3
|
||||||
[node name="ShareOptionsLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools/ToolOptions"]
|
[node name="ShareOptionsLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools/ToolOptions"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
tooltip_text = "If this is enabled, options will be synced between the left and the right tool.
|
||||||
|
For example, both tools will share the same brush size, and changing it on one tool will instantly change on the other."
|
||||||
|
mouse_filter = 1
|
||||||
text = "Share options between the left and the right tools"
|
text = "Share options between the left and the right tools"
|
||||||
|
|
||||||
[node name="ShareOptionsCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools/ToolOptions"]
|
[node name="ShareOptionsCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Tools/ToolOptions"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
tooltip_text = "If this is enabled, options will be synced between the left and the right tool.
|
||||||
|
For example, both tools will share the same brush size, and changing it on one tool will instantly change on the other."
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
text = "On"
|
text = "On"
|
||||||
|
|
||||||
|
|
|
@ -4,21 +4,21 @@
|
||||||
[ext_resource type="Script" path="res://src/Tools/DesignTools/Shading.gd" id="2"]
|
[ext_resource type="Script" path="res://src/Tools/DesignTools/Shading.gd" id="2"]
|
||||||
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]
|
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]
|
||||||
|
|
||||||
[sub_resource type="ButtonGroup" id="ButtonGroup_se02m"]
|
[sub_resource type="ButtonGroup" id="ButtonGroup_lvcwb"]
|
||||||
resource_name = "rotate"
|
resource_name = "rotate"
|
||||||
allow_unpress = true
|
allow_unpress = true
|
||||||
|
|
||||||
[node name="ToolOptions" instance=ExtResource("1")]
|
[node name="ToolOptions" instance=ExtResource("1")]
|
||||||
script = ExtResource("2")
|
script = ExtResource("2")
|
||||||
|
|
||||||
[node name="Rotate90" parent="RotationOptions/Rotate" index="0"]
|
[node name="Rotate90" parent="RotationOptions/GridContainer/Rotate" index="0"]
|
||||||
button_group = SubResource("ButtonGroup_se02m")
|
button_group = SubResource("ButtonGroup_lvcwb")
|
||||||
|
|
||||||
[node name="Rotate180" parent="RotationOptions/Rotate" index="1"]
|
[node name="Rotate180" parent="RotationOptions/GridContainer/Rotate" index="1"]
|
||||||
button_group = SubResource("ButtonGroup_se02m")
|
button_group = SubResource("ButtonGroup_lvcwb")
|
||||||
|
|
||||||
[node name="Rotate270" parent="RotationOptions/Rotate" index="2"]
|
[node name="Rotate270" parent="RotationOptions/GridContainer/Rotate" index="2"]
|
||||||
button_group = SubResource("ButtonGroup_se02m")
|
button_group = SubResource("ButtonGroup_lvcwb")
|
||||||
|
|
||||||
[node name="LightenDarken" type="OptionButton" parent="." index="5"]
|
[node name="LightenDarken" type="OptionButton" parent="." index="5"]
|
||||||
custom_minimum_size = Vector2(92, 0)
|
custom_minimum_size = Vector2(92, 0)
|
||||||
|
@ -83,7 +83,7 @@ layout_mode = 2
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
max_value = 10.0
|
max_value = 10.0
|
||||||
allow_greater = true
|
allow_greater = true
|
||||||
prefix = "Colors Right"
|
prefix = "Colors right"
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="ColorReplaceOptions/Settings" index="1"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="ColorReplaceOptions/Settings" index="1"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
@ -107,7 +107,7 @@ layout_mode = 2
|
||||||
[node name="Label" type="Label" parent="ColorReplaceOptions" index="1"]
|
[node name="Label" type="Label" parent="ColorReplaceOptions" index="1"]
|
||||||
custom_minimum_size = Vector2(0, 75)
|
custom_minimum_size = Vector2(0, 75)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Please Select a color from the palette."
|
text = "Please select a color from the palette."
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
autowrap_mode = 3
|
autowrap_mode = 3
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
extends AcceptDialog
|
extends AcceptDialog
|
||||||
|
|
||||||
|
var main_canvas := Global.control.find_child("Main Canvas", true, false)
|
||||||
|
|
||||||
@onready var slider := $VBoxContainer/ValueSlider as ValueSlider
|
@onready var slider := $VBoxContainer/ValueSlider as ValueSlider
|
||||||
@onready var fullscreen_warning := $VBoxContainer/FullscreenWarning as Label
|
@onready var fullscreen_warning := $VBoxContainer/FullscreenWarning as Label
|
||||||
@onready var main_canvas := Global.control.find_child("Main Canvas") as Control
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
if main_canvas is FloatingWindow: ## If it's shifted to a window then get the content
|
||||||
|
main_canvas = main_canvas.window_content
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
Global.control.main_ui.sort_children.connect(_recalculate_opacity)
|
Global.control.main_ui.sort_children.connect(_recalculate_opacity)
|
||||||
|
|
||||||
|
|
||||||
func _on_WindowOpacityDialog_about_to_show() -> void:
|
func _on_WindowOpacityDialog_about_to_show() -> void:
|
||||||
get_tree().root.transparent = true
|
var canvas_window = main_canvas.get_window()
|
||||||
get_tree().root.transparent_bg = true
|
canvas_window.transparent = true
|
||||||
|
canvas_window.transparent_bg = true
|
||||||
slider.editable = not is_fullscreen()
|
slider.editable = not is_fullscreen()
|
||||||
fullscreen_warning.visible = not slider.editable
|
fullscreen_warning.visible = not slider.editable
|
||||||
|
|
||||||
|
@ -31,7 +35,11 @@ func set_window_opacity(value: float) -> void:
|
||||||
if container is TabContainer:
|
if container is TabContainer:
|
||||||
var center := container.get_rect().get_center()
|
var center := container.get_rect().get_center()
|
||||||
if main_canvas.get_rect().has_point(center):
|
if main_canvas.get_rect().has_point(center):
|
||||||
container.self_modulate.a = value
|
if main_canvas.get_window() != get_tree().root:
|
||||||
|
## In case we converted to window while trransparency was active
|
||||||
|
container.self_modulate.a = 1.0
|
||||||
|
else:
|
||||||
|
container.self_modulate.a = value
|
||||||
Global.transparent_checker.update_transparency(value)
|
Global.transparent_checker.update_transparency(value)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ 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",
|
"Center Canvas": "center_canvas",
|
||||||
"Tile Mode": "",
|
"Tile Mode": "",
|
||||||
"Tile Mode Offsets": "",
|
"Tile Mode Offsets": "",
|
||||||
"Grayscale View": "",
|
"Grayscale View": "",
|
||||||
|
@ -227,7 +227,7 @@ 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":
|
elif item == "Center Canvas":
|
||||||
_set_menu_shortcut(view_menu_items[item], view_menu, i, item)
|
_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)
|
||||||
|
@ -602,7 +602,7 @@ 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.ViewMenu.CENTER_CANVAS:
|
||||||
Global.camera.offset = Global.current_project.size / 2
|
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)
|
||||||
|
|
22
src/UI/UI.gd
22
src/UI/UI.gd
|
@ -1,12 +1,28 @@
|
||||||
extends Panel
|
extends Panel
|
||||||
|
|
||||||
|
var shader_disabled := false
|
||||||
|
var transparency_material: ShaderMaterial
|
||||||
|
|
||||||
@onready var main_canvas_container := find_child("Main Canvas") as Container
|
@onready var main_canvas_container := find_child("Main Canvas") as Container
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
transparency_material = material
|
||||||
|
main_canvas_container.property_list_changed.connect(_re_configure_shader)
|
||||||
update_transparent_shader()
|
update_transparent_shader()
|
||||||
|
|
||||||
|
|
||||||
|
func _re_configure_shader():
|
||||||
|
await get_tree().process_frame
|
||||||
|
if get_window() != main_canvas_container.get_window():
|
||||||
|
material = null
|
||||||
|
shader_disabled = true
|
||||||
|
else:
|
||||||
|
if shader_disabled:
|
||||||
|
material = transparency_material
|
||||||
|
shader_disabled = false
|
||||||
|
|
||||||
|
|
||||||
func _on_main_canvas_item_rect_changed() -> void:
|
func _on_main_canvas_item_rect_changed() -> void:
|
||||||
update_transparent_shader()
|
update_transparent_shader()
|
||||||
|
|
||||||
|
@ -20,6 +36,6 @@ func update_transparent_shader() -> void:
|
||||||
return
|
return
|
||||||
# Works independently of the transparency feature
|
# Works independently of the transparency feature
|
||||||
var canvas_size: Vector2 = (main_canvas_container.size - Vector2.DOWN * 2) * Global.shrink
|
var canvas_size: Vector2 = (main_canvas_container.size - Vector2.DOWN * 2) * Global.shrink
|
||||||
material.set_shader_parameter("screen_resolution", get_viewport().size)
|
transparency_material.set_shader_parameter("screen_resolution", get_viewport().size)
|
||||||
material.set_shader_parameter("position", main_canvas_container.global_position * Global.shrink)
|
transparency_material.set_shader_parameter("position", main_canvas_container.global_position * Global.shrink)
|
||||||
material.set_shader_parameter("size", canvas_size)
|
transparency_material.set_shader_parameter("size", canvas_size)
|
||||||
|
|
Loading…
Reference in a new issue