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

Merge pull request #242 from Orama-Interactive/refactoring

Bring Main.tscn changes to master
This commit is contained in:
Manolis Papadeas 2020-05-22 01:45:53 +03:00 committed by GitHub
commit 02045ec60c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 2164 additions and 2224 deletions

1
.gitignore vendored
View file

@ -15,5 +15,4 @@ mono_crash.*.json
.directory
*~
Translations/Update Translations.bat
Scripts/Old/

View file

@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). All the dates are in YYYY-MM-DD format.
<br><br>
## [v0.7.1] - Unreleased
This update has been brought to you by the contributions of:
Igor Santarek (jegor377)
### Added
- Ability to remove the current palette
<br><br>
## [v0.7] - 2020-05-16
This update has been brought to you by the contributions of:

View file

@ -29,6 +29,7 @@ If you want to add new features or fix bugs, please make sure that:
- If your PR is closing an issue, make sure to let us know.
- If you're making visual changes, it's a good idea to include screenshots in your PR. It's an easy way to let others know of the changes you made.
- If you are adding new UI elements with text, please include the new strings in the `Translations.pot` file. Do not include them in the other `*.po` files. Please make sure to group similar elements together (like element names and their tooltips) by placing them close to each other.
- If you want to make changes to UI elements that are PackedScenes, please edit them in their own scene files (open their scenes in the editor) instead of Main.tscn, or their parent scene in general.
- If you are making changes to popup (and as an extension, dialog) nodes as different scenes, please don't forget to turn off their visibility.
- When you're creating a new script, Godot will place some comments and methods for you. If you're not using them, please remove them. They're taking unnecessary space.
- Avoid using the "pass" keyword. It has no actual usage, besides being used as a placeholder for temporarily empty methods and empty cases. Make sure you don't include empty methods and cases in the code of your PR.
@ -36,6 +37,7 @@ If you want to add new features or fix bugs, please make sure that:
- If you are adding new scripts and/or scenes, please put them somewhere inside the `src/` directory, and make sure to use PascalCase for your file and folder names. [Read this guide for more information.](https://www.gdquest.com/docs/guidelines/best-practices/godot-gdscript/)
- If you are adding images or any type of asset, please put them somewhere inside the `assets/` directory, and make sure to use snake_case for your file and folder names.
- Do **NOT** use the `l10n_master` branch for development. Do not base your work from it, and do not open Pull Requests targeted at it. It's used specifically by Crowdin for translation handling.
- If you want to add an error dialog, use the existing ErrorDialog, change its text and pop it up, instead of making a new one.
Please create different pull requests for each feature you'd like to implement, or each bug you'd like to fix. Make sure your pull request only handles one specific topic, and not multiple. If you want to make multiple changes, make a pull request for each of them. For this reason, it's recommended you create new branches in your forked repository, instead of using your fork's master branch.
This [Git style guide](https://github.com/agis-/git-style-guide) has some good practices to have in mind.

View file

@ -856,7 +856,6 @@ func create_brush_button(brush_img : Image, brush_type := Brush_Types.CUSTOM, hi
brush_button.get_child(0).texture = brush_tex
brush_button.hint_tooltip = hint_tooltip
brush_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
brush_button.connect("brush_selected",control,"_on_Brush_Selected")
if brush_type == Brush_Types.RANDOM_FILE:
brush_button.random_brushes.append(brush_img)
brush_container.add_child(brush_button)

View file

@ -2,6 +2,5 @@
[ext_resource path="res://src/Canvas.gd" type="Script" id=1]
[node name="Canvas" type="Node2D"]
script = ExtResource( 1 )

View file

@ -3,12 +3,9 @@ extends Control
var opensprite_file_selected := false
var file_menu : PopupMenu
var view_menu : PopupMenu
var tools := []
var redone := false
var unsaved_canvas_state := 0
var is_quitting_on_save := false
var previous_left_color := Color.black
var previous_right_color := Color.white
# Called when the node enters the scene tree for the first time.
@ -134,21 +131,6 @@ func _ready() -> void:
image_menu.connect("id_pressed", self, "image_menu_id_pressed")
help_menu.connect("id_pressed", self, "help_menu_id_pressed")
var root = get_tree().get_root()
# Node, left mouse shortcut, right mouse shortcut
tools.append([Global.find_node_by_name(root, "Pencil"), "left_pencil_tool", "right_pencil_tool"])
tools.append([Global.find_node_by_name(root, "Eraser"), "left_eraser_tool", "right_eraser_tool"])
tools.append([Global.find_node_by_name(root, "Bucket"), "left_fill_tool", "right_fill_tool"])
tools.append([Global.find_node_by_name(root, "LightenDarken"), "left_lightdark_tool", "right_lightdark_tool"])
tools.append([Global.find_node_by_name(root, "RectSelect"), "left_rectangle_select_tool", "right_rectangle_select_tool"])
tools.append([Global.find_node_by_name(root, "ColorPicker"), "left_colorpicker_tool", "right_colorpicker_tool"])
tools.append([Global.find_node_by_name(root, "Zoom"), "left_zoom_tool", "right_zoom_tool"])
for t in tools:
t[0].connect("pressed", self, "_on_Tool_pressed", [t[0]])
Global.update_hint_tooltips()
# Checks to see if it's 3.1.x
if Engine.get_version_info().major == 3 and Engine.get_version_info().minor < 2:
Global.left_color_picker.get_picker().move_child(Global.left_color_picker.get_picker().get_child(0), 1)
@ -231,15 +213,6 @@ func _input(event : InputEvent) -> void:
Global.undo_redo.redo()
redone = false
if Global.has_focus:
if event.is_action_pressed("undo") or event.is_action_pressed("redo") or event.is_action_pressed("redo_secondary"):
return
for t in tools: # Handle tool shortcuts
if event.is_action_pressed(t[2]): # Shortcut for right button (with Alt)
_on_Tool_pressed(t[0], false, false)
elif event.is_action_pressed(t[1]): # Shortcut for left button
_on_Tool_pressed(t[0], false, true)
func _notification(what : int) -> void:
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: # Handle exit
@ -269,7 +242,8 @@ func file_menu_id_pressed(id : int) -> void:
else:
load_last_project()
else: # if not then warn user that he didn't edit any project yet
$NoProjectEditedOrCreatedAlertDialog.popup_centered()
Global.error_dialog.set_text("You haven't saved or opened any project in Pixelorama yet!")
Global.error_dialog.popup_centered()
Global.dialog_open(true)
3: # Save
is_quitting_on_save = false
@ -476,7 +450,8 @@ func load_last_project() -> void:
_on_OpenSprite_file_selected(file_path)
else:
# If file doesn't exist on disk then warn user about this
$OpenLastProjectAlertDialog.popup_centered()
Global.error_dialog.set_text("Cannot find last project file.")
Global.error_dialog.popup_centered()
Global.dialog_open(true)
@ -522,309 +497,10 @@ func _on_ImportSprites_popup_hide() -> void:
_can_draw_true()
func _on_ViewportContainer_mouse_entered() -> void:
Global.has_focus = true
func _on_ViewportContainer_mouse_exited() -> void:
Global.has_focus = false
func _can_draw_true() -> void:
Global.dialog_open(false)
func _can_draw_false() -> void:
Global.can_draw = false
func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_left := true) -> void:
var current_action := tool_pressed.name
if (mouse_press and Input.is_action_just_released("left_mouse")) or (!mouse_press and key_for_left):
Global.current_left_tool = current_action
# Start from 1, so the label won't get invisible
for i in range(1, Global.left_tool_options_container.get_child_count()):
Global.left_tool_options_container.get_child(i).visible = false
Global.left_tool_options_container.get_node("EmptySpacer").visible = true
# Tool options visible depending on the selected tool
if current_action == "Pencil":
Global.left_brush_type_container.visible = true
Global.left_brush_size_slider.visible = true
Global.left_pixel_perfect_container.visible = true
Global.left_mirror_container.visible = true
if Global.current_left_brush_type == Global.Brush_Types.FILE or Global.current_left_brush_type == Global.Brush_Types.CUSTOM or Global.current_left_brush_type == Global.Brush_Types.RANDOM_FILE:
Global.left_color_interpolation_container.visible = true
elif current_action == "Eraser":
Global.left_brush_type_container.visible = true
Global.left_brush_size_slider.visible = true
Global.left_pixel_perfect_container.visible = true
Global.left_mirror_container.visible = true
elif current_action == "Bucket":
Global.left_fill_area_container.visible = true
Global.left_mirror_container.visible = true
elif current_action == "LightenDarken":
Global.left_brush_type_container.visible = true
Global.left_brush_size_slider.visible = true
Global.left_pixel_perfect_container.visible = true
Global.left_ld_container.visible = true
Global.left_mirror_container.visible = true
elif current_action == "ColorPicker":
Global.left_colorpicker_container.visible = true
elif current_action == "Zoom":
Global.left_zoom_container.visible = true
elif (mouse_press and Input.is_action_just_released("right_mouse")) or (!mouse_press and !key_for_left):
Global.current_right_tool = current_action
# Start from 1, so the label won't get invisible
for i in range(1, Global.right_tool_options_container.get_child_count()):
Global.right_tool_options_container.get_child(i).visible = false
Global.right_tool_options_container.get_node("EmptySpacer").visible = true
# Tool options visible depending on the selected tool
if current_action == "Pencil":
Global.right_brush_type_container.visible = true
Global.right_brush_size_slider.visible = true
Global.right_pixel_perfect_container.visible = true
Global.right_mirror_container.visible = true
if Global.current_right_brush_type == Global.Brush_Types.FILE or Global.current_right_brush_type == Global.Brush_Types.CUSTOM or Global.current_right_brush_type == Global.Brush_Types.RANDOM_FILE:
Global.right_color_interpolation_container.visible = true
elif current_action == "Eraser":
Global.right_brush_type_container.visible = true
Global.right_brush_size_slider.visible = true
Global.right_pixel_perfect_container.visible = true
Global.right_mirror_container.visible = true
elif current_action == "Bucket":
Global.right_fill_area_container.visible = true
Global.right_mirror_container.visible = true
elif current_action == "LightenDarken":
Global.right_brush_type_container.visible = true
Global.right_brush_size_slider.visible = true
Global.right_pixel_perfect_container.visible = true
Global.right_ld_container.visible = true
Global.right_mirror_container.visible = true
elif current_action == "ColorPicker":
Global.right_colorpicker_container.visible = true
elif current_action == "Zoom":
Global.right_zoom_container.visible = true
for t in tools:
var tool_name : String = t[0].name
var texture_button : TextureRect = t[0].get_child(0)
if tool_name == Global.current_left_tool and tool_name == Global.current_right_tool:
Global.change_button_texturerect(texture_button, "%s_l_r.png" % tool_name.to_lower())
elif tool_name == Global.current_left_tool:
Global.change_button_texturerect(texture_button, "%s_l.png" % tool_name.to_lower())
elif tool_name == Global.current_right_tool:
Global.change_button_texturerect(texture_button, "%s_r.png" % tool_name.to_lower())
else:
Global.change_button_texturerect(texture_button, "%s.png" % tool_name.to_lower())
Global.left_cursor_tool_texture.create_from_image(load("res://assets/graphics/cursor_icons/%s_cursor.png" % Global.current_left_tool.to_lower()), 0)
Global.right_cursor_tool_texture.create_from_image(load("res://assets/graphics/cursor_icons/%s_cursor.png" % Global.current_right_tool.to_lower()), 0)
func _on_LeftBrushTypeButton_pressed() -> void:
Global.brushes_popup.popup(Rect2(Global.left_brush_type_button.rect_global_position, Vector2(226, 72)))
Global.brush_type_window_position = "left"
func _on_RightBrushTypeButton_pressed() -> void:
Global.brushes_popup.popup(Rect2(Global.right_brush_type_button.rect_global_position, Vector2(226, 72)))
Global.brush_type_window_position = "right"
func _on_LeftBrushSizeEdit_value_changed(value) -> void:
Global.left_brush_size_edit.value = value
Global.left_brush_size_slider.value = value
var new_size = int(value)
Global.left_brush_size = new_size
update_left_custom_brush()
func _on_RightBrushSizeEdit_value_changed(value) -> void:
Global.right_brush_size_edit.value = value
Global.right_brush_size_slider.value = value
var new_size = int(value)
Global.right_brush_size = new_size
update_right_custom_brush()
func _on_Brush_Selected() -> void:
$BrushesPopup.hide()
func _on_ColorSwitch_pressed() -> void:
var temp: Color = Global.left_color_picker.color
Global.left_color_picker.color = Global.right_color_picker.color
Global.right_color_picker.color = temp
update_left_custom_brush()
update_right_custom_brush()
func _on_ColorDefaults_pressed() -> void:
Global.left_color_picker.color = Color.black
Global.right_color_picker.color = Color.white
update_left_custom_brush()
update_right_custom_brush()
func _on_LeftColorPickerButton_color_changed(color : Color) -> void:
# If the color changed while it's on full transparency, make it opaque (GH issue #54)
if color.a == 0:
if previous_left_color.r != color.r or previous_left_color.g != color.g or previous_left_color.b != color.b:
Global.left_color_picker.color.a = 1
update_left_custom_brush()
previous_left_color = color
func _on_RightColorPickerButton_color_changed(color : Color) -> void:
# If the color changed while it's on full transparency, make it opaque (GH issue #54)
if color.a == 0:
if previous_right_color.r != color.r or previous_right_color.g != color.g or previous_right_color.b != color.b:
Global.right_color_picker.color.a = 1
update_right_custom_brush()
previous_right_color = color
func _on_LeftInterpolateFactor_value_changed(value : float) -> void:
Global.left_interpolate_spinbox.value = value
Global.left_interpolate_slider.value = value
update_left_custom_brush()
func _on_RightInterpolateFactor_value_changed(value : float) -> void:
Global.right_interpolate_spinbox.value = value
Global.right_interpolate_slider.value = value
update_right_custom_brush()
func update_left_custom_brush() -> void:
Global.update_left_custom_brush()
func update_right_custom_brush() -> void:
Global.update_right_custom_brush()
func _on_LeftFillAreaOptions_item_selected(ID : int) -> void:
Global.left_fill_area = ID
func _on_LeftFillWithOptions_item_selected(ID : int) -> void:
Global.left_fill_with = ID
if ID == 1:
Global.left_fill_pattern_container.visible = true
else:
Global.left_fill_pattern_container.visible = false
func _on_LeftPatternTypeButton_pressed() -> void:
Global.pattern_window_position = "left"
Global.patterns_popup.popup(Rect2(Global.left_brush_type_button.rect_global_position, Vector2(226, 72)))
func _on_LeftPatternOffsetX_value_changed(value : float) -> void:
Global.left_fill_pattern_offset.x = value
func _on_LeftPatternOffsetY_value_changed(value : float) -> void:
Global.left_fill_pattern_offset.y = value
func _on_RightPatternOffsetX_value_changed(value : float) -> void:
Global.right_fill_pattern_offset.x = value
func _on_RightPatternOffsetY_value_changed(value : float) -> void:
Global.right_fill_pattern_offset.y = value
func _on_RightFillAreaOptions_item_selected(ID : int) -> void:
Global.right_fill_area = ID
func _on_RightFillWithOptions_item_selected(ID : int) -> void:
Global.right_fill_with = ID
if ID == 1:
Global.right_fill_pattern_container.visible = true
else:
Global.right_fill_pattern_container.visible = false
func _on_RightPatternTypeButton_pressed() -> void:
Global.pattern_window_position = "right"
Global.patterns_popup.popup(Rect2(Global.right_brush_type_button.rect_global_position, Vector2(226, 72)))
func _on_LeftLightenDarken_item_selected(ID : int) -> void:
Global.left_ld = ID
func _on_LeftLDAmountSpinbox_value_changed(value : float) -> void:
Global.left_ld_amount = value / 100
Global.left_ld_amount_slider.value = value
Global.left_ld_amount_spinbox.value = value
func _on_RightLightenDarken_item_selected(ID : int) -> void:
Global.right_ld = ID
func _on_RightLDAmountSpinbox_value_changed(value : float) -> void:
Global.right_ld_amount = value / 100
Global.right_ld_amount_slider.value = value
Global.right_ld_amount_spinbox.value = value
func _on_LeftForColorOptions_item_selected(ID : int) -> void:
Global.left_color_picker_for = ID
func _on_RightForColorOptions_item_selected(ID : int) -> void:
Global.right_color_picker_for = ID
func _on_LeftZoomModeOptions_item_selected(ID : int) -> void:
Global.left_zoom_mode = ID
func _on_RightZoomModeOptions_item_selected(ID : int) -> void:
Global.right_zoom_mode = ID
func _on_FitToFrameButton_pressed() -> void:
Global.camera.fit_to_frame(Global.canvas.size)
func _on_100ZoomButton_pressed() -> void:
Global.camera.zoom = Vector2.ONE
Global.camera.offset = Global.canvas.size / 2
Global.zoom_level_label.text = str(round(100 / Global.camera.zoom.x)) + " %"
Global.horizontal_ruler.update()
Global.vertical_ruler.update()
func _on_LeftHorizontalMirroring_toggled(button_pressed) -> void:
Global.left_horizontal_mirror = button_pressed
func _on_LeftVerticalMirroring_toggled(button_pressed) -> void:
Global.left_vertical_mirror = button_pressed
func _on_RightHorizontalMirroring_toggled(button_pressed) -> void:
Global.right_horizontal_mirror = button_pressed
func _on_RightVerticalMirroring_toggled(button_pressed) -> void:
Global.right_vertical_mirror = button_pressed
func show_quit_dialog() -> void:
if !$QuitDialog.visible:
if !Global.project_has_changed:
@ -868,11 +544,3 @@ func _on_BackupConfirmation_delete(project_path : String, backup_path : String)
# Reopen last project
if Global.open_last_project:
load_last_project()
func _on_LeftPixelPerfectMode_toggled(button_pressed : bool) -> void:
Global.left_pixel_perfect = button_pressed
func _on_RightPixelPerfectMode_toggled(button_pressed : bool) -> void:
Global.right_pixel_perfect = button_pressed

File diff suppressed because one or more lines are too long

View file

@ -273,19 +273,24 @@ func get_best_palette_file_location(looking_paths: Array, fname: String): # ->
func remove_palette(palette_name : String) -> void:
# Don't allow user to remove palette if there is no one left
if Global.palettes.size() < 2:
get_node('/root/Control/CantRemoveMorePalettesDialog').popup_centered()
Global.error_dialog.set_text("You can't remove more palettes!")
Global.error_dialog.popup_centered()
Global.dialog_open(true)
return
# Don't allow user to try to remove not existing palettes
if not palette_name in Global.palettes:
get_node('/root/Control/PaletteDoesntExistDialog').popup_centered()
Global.error_dialog.set_text("Cannot remove the palette, because it doesn't exist!")
Global.error_dialog.popup_centered()
Global.dialog_open(true)
return
Global.directory_module.ensure_xdg_user_dirs_exist()
var palette = Global.palettes[palette_name]
var result = palette.remove_file()
# Inform user if pallete hasn't been removed from disk because of an error
if result != OK:
get_node('/root/Control/PaletteRemoveErrorDialog').dialog_text %= str(result)
get_node('/root/Control/PaletteRemoveErrorDialog').popup_centered()
Global.error_dialog.set_text(tr("An error occured while removing the palette! Error code: %s") % str(result))
Global.error_dialog.popup_centered()
Global.dialog_open(true)
# Remove palette in the program anyway, because if you don't do it
# then Pixelorama will crash
Global.palettes.erase(palette_name)
@ -305,5 +310,5 @@ func _on_NewPaletteDialog_popup_hide() -> void:
Global.dialog_open(false)
func _on_RemovePalette_pressed():
func _on_RemovePalette_pressed() -> void:
remove_palette(current_palette)

View file

@ -10,6 +10,6 @@ window_title = "Open a File"
resizable = true
mode = 0
access = 2
filters = PoolStringArray( "*.json ; JavaScript Object Notation" )
current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
filters = PoolStringArray( "*.json ; JavaScript Object Notation", "*.gpl ; Gimp Palette Library", "*.png; Portable Network Graphics" )
current_dir = "C:/Users"
current_path = "C:/Users/"

View file

@ -0,0 +1,191 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://src/Palette/PaletteContainer.gd" type="Script" id=1]
[ext_resource path="res://assets/graphics/dark_themes/palette/edit_palette.png" type="Texture" id=2]
[ext_resource path="res://assets/graphics/dark_themes/palette/add_palette.png" type="Texture" id=3]
[ext_resource path="res://assets/graphics/dark_themes/palette/remove_palette.png" type="Texture" id=4]
[ext_resource path="res://src/Palette/PaletteImportFileDialog.tscn" type="PackedScene" id=5]
[ext_resource path="res://src/Palette/NewPaletteDialog.tscn" type="PackedScene" id=6]
[ext_resource path="res://src/Palette/EditPalettePopup.tscn" type="PackedScene" id=7]
[node name="PalettePanelContainer" type="PanelContainer"]
margin_left = 15.0
margin_top = 261.0
margin_right = 315.0
margin_bottom = 516.0
rect_min_size = Vector2( 300, 0 )
size_flags_horizontal = 4
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="PaletteVBoxContainer" type="VBoxContainer" parent="."]
margin_left = 7.0
margin_top = 7.0
margin_right = 293.0
margin_bottom = 248.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="PalettesLabel" type="Label" parent="PaletteVBoxContainer"]
margin_right = 286.0
margin_bottom = 14.0
size_flags_horizontal = 3
size_flags_vertical = 0
text = "Palettes"
align = 1
[node name="CenterContainer" type="CenterContainer" parent="PaletteVBoxContainer"]
margin_top = 18.0
margin_right = 286.0
margin_bottom = 50.0
[node name="PaletteButtons" type="HBoxContainer" parent="PaletteVBoxContainer/CenterContainer"]
margin_left = 37.0
margin_right = 248.0
margin_bottom = 32.0
[node name="AddPalette" type="Button" parent="PaletteVBoxContainer/CenterContainer/PaletteButtons" groups=[
"UIButtons",
]]
margin_right = 32.0
margin_bottom = 32.0
rect_min_size = Vector2( 32, 32 )
hint_tooltip = "Add a new palette"
mouse_default_cursor_shape = 2
[node name="PopupMenu" type="PopupMenu" parent="PaletteVBoxContainer/CenterContainer/PaletteButtons/AddPalette"]
margin_right = 115.0
margin_bottom = 54.0
items = [ "New Empty Palette", null, 0, false, false, 0, 0, null, "", false, "Import Palette", null, 0, false, false, 1, 0, null, "", false ]
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="PaletteVBoxContainer/CenterContainer/PaletteButtons/AddPalette"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -12.0
margin_top = -12.0
margin_right = 12.0
margin_bottom = 12.0
size_flags_horizontal = 0
size_flags_vertical = 0
texture = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="EditPalette" type="Button" parent="PaletteVBoxContainer/CenterContainer/PaletteButtons" groups=[
"UIButtons",
]]
margin_left = 36.0
margin_right = 68.0
margin_bottom = 32.0
rect_min_size = Vector2( 32, 32 )
hint_tooltip = "Edit currently selected palette"
mouse_default_cursor_shape = 2
[node name="TextureRect" type="TextureRect" parent="PaletteVBoxContainer/CenterContainer/PaletteButtons/EditPalette"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -12.0
margin_top = -12.0
margin_right = 12.0
margin_bottom = 12.0
size_flags_horizontal = 0
size_flags_vertical = 0
texture = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="RemovePalette" type="Button" parent="PaletteVBoxContainer/CenterContainer/PaletteButtons" groups=[
"UIButtons",
]]
margin_left = 72.0
margin_right = 104.0
margin_bottom = 32.0
rect_min_size = Vector2( 32, 32 )
hint_tooltip = "Remove currently selected palette"
mouse_default_cursor_shape = 2
[node name="TextureRect" type="TextureRect" parent="PaletteVBoxContainer/CenterContainer/PaletteButtons/RemovePalette"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -12.0
margin_top = -12.0
margin_right = 12.0
margin_bottom = 12.0
size_flags_horizontal = 0
size_flags_vertical = 0
texture = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="PaletteOptionButton" type="OptionButton" parent="PaletteVBoxContainer/CenterContainer/PaletteButtons"]
margin_left = 108.0
margin_right = 211.0
margin_bottom = 32.0
grow_horizontal = 0
rect_min_size = Vector2( 103, 0 )
hint_tooltip = "Choose a palette"
mouse_default_cursor_shape = 2
clip_text = true
[node name="ScrollPalette" type="ScrollContainer" parent="PaletteVBoxContainer"]
margin_top = 54.0
margin_right = 286.0
margin_bottom = 241.0
rect_min_size = Vector2( 0, 100 )
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="CenterPalette" type="CenterContainer" parent="PaletteVBoxContainer/ScrollPalette"]
margin_right = 286.0
size_flags_horizontal = 3
[node name="PaletteContainer" type="GridContainer" parent="PaletteVBoxContainer/ScrollPalette/CenterPalette"]
margin_left = 143.0
margin_right = 143.0
size_flags_horizontal = 3
columns = 10
script = ExtResource( 1 )
[node name="NewPaletteDialog" parent="." instance=ExtResource( 6 )]
margin_left = 7.0
margin_top = 7.0
margin_right = 380.0
margin_bottom = 77.0
size_flags_horizontal = 0
size_flags_vertical = 0
[node name="PaletteImportFileDialog" parent="." instance=ExtResource( 5 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 7.0
margin_top = 7.0
margin_right = 507.0
margin_bottom = 307.0
[node name="EditPalettePopup" parent="." instance=ExtResource( 7 )]
margin_left = 7.0
margin_top = 7.0
margin_right = 607.0
margin_bottom = 577.0
[connection signal="pressed" from="PaletteVBoxContainer/CenterContainer/PaletteButtons/AddPalette" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_AddPalette_pressed"]
[connection signal="pressed" from="PaletteVBoxContainer/CenterContainer/PaletteButtons/EditPalette" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="on_edit_palette"]
[connection signal="pressed" from="PaletteVBoxContainer/CenterContainer/PaletteButtons/RemovePalette" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_RemovePalette_pressed"]
[connection signal="item_selected" from="PaletteVBoxContainer/CenterContainer/PaletteButtons/PaletteOptionButton" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_PaletteOptionButton_item_selected"]
[connection signal="confirmed" from="NewPaletteDialog" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="on_new_palette_confirmed"]
[connection signal="popup_hide" from="NewPaletteDialog" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_NewPaletteDialog_popup_hide"]
[connection signal="file_selected" from="PaletteImportFileDialog" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="on_palette_import_file_selected"]
[connection signal="popup_hide" from="PaletteImportFileDialog" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_NewPaletteDialog_popup_hide"]

View file

@ -1,8 +1,6 @@
extends BaseButton
signal brush_selected
export var brush_type = 0 # Global.Brush_Types.PIXEL
export var custom_brush_index := -3
var random_brushes := []
@ -36,7 +34,7 @@ func _on_BrushButton_pressed() -> void:
# Global.left_brush_type_label.text = tr("Brush: Filled Circle")
Global.update_left_custom_brush()
emit_signal("brush_selected")
Global.brushes_popup.hide()
else: # Change right brush
Global.current_right_brush_type = brush_type
@ -59,7 +57,7 @@ func _on_BrushButton_pressed() -> void:
# Global.right_brush_type_label.text = tr("Brush: Filled Circle")
Global.update_right_custom_brush()
emit_signal("brush_selected")
Global.brushes_popup.hide()
func _on_DeleteButton_pressed() -> void:

File diff suppressed because one or more lines are too long

65
src/UI/BrushesPopup.tscn Normal file
View file

@ -0,0 +1,65 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/UI/BrushButton.tscn" type="PackedScene" id=2]
[node name="BrushesPopup" type="Popup"]
margin_right = 226.0
margin_bottom = 144.0
rect_min_size = Vector2( 0, 144 )
[node name="TabContainer" type="TabContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_vertical = 3
drag_to_rearrange_enabled = true
[node name="File" type="ScrollContainer" parent="TabContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
rect_min_size = Vector2( 0, 36 )
size_flags_horizontal = 3
scroll_horizontal_enabled = false
[node name="FileBrushContainer" type="GridContainer" parent="TabContainer/File"]
margin_right = 104.0
margin_bottom = 32.0
columns = 6
[node name="PixelBrushButton" parent="TabContainer/File/FileBrushContainer" instance=ExtResource( 2 )]
hint_tooltip = "Pixel brush"
mouse_default_cursor_shape = 2
[node name="CircleBrushButton" parent="TabContainer/File/FileBrushContainer" instance=ExtResource( 2 )]
margin_left = 35.0
margin_right = 67.0
hint_tooltip = "Filled circle brush"
mouse_default_cursor_shape = 2
brush_type = 1
custom_brush_index = -2
[node name="FilledCircleBrushButton" parent="TabContainer/File/FileBrushContainer" instance=ExtResource( 2 )]
margin_left = 70.0
margin_right = 102.0
hint_tooltip = "Circle brush"
mouse_default_cursor_shape = 2
brush_type = 2
custom_brush_index = -1
[node name="Project" type="ScrollContainer" parent="TabContainer"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
rect_min_size = Vector2( 0, 36 )
size_flags_horizontal = 3
scroll_horizontal_enabled = false
[node name="ProjectBrushContainer" type="GridContainer" parent="TabContainer/Project"]
columns = 5

View file

@ -0,0 +1,188 @@
extends VBoxContainer
var previous_left_color := Color.black
var previous_right_color := Color.white
func _on_ColorSwitch_pressed() -> void:
var temp: Color = Global.left_color_picker.color
Global.left_color_picker.color = Global.right_color_picker.color
Global.right_color_picker.color = temp
Global.update_left_custom_brush()
Global.update_right_custom_brush()
func _on_ColorPickerButton_color_changed(color : Color, right : bool):
# If the color changed while it's on full transparency, make it opaque (GH issue #54)
if right:
if color.a == 0:
if previous_right_color.r != color.r or previous_right_color.g != color.g or previous_right_color.b != color.b:
Global.right_color_picker.color.a = 1
Global.update_right_custom_brush()
previous_right_color = color
else:
if color.a == 0:
if previous_left_color.r != color.r or previous_left_color.g != color.g or previous_left_color.b != color.b:
Global.left_color_picker.color.a = 1
Global.update_left_custom_brush()
previous_left_color = color
func _on_ColorPickerButton_pressed() -> void:
Global.can_draw = false
func _on_ColorPickerButton_popup_closed() -> void:
Global.can_draw = true
func _on_ColorDefaults_pressed() -> void:
Global.left_color_picker.color = Color.black
Global.right_color_picker.color = Color.white
Global.update_left_custom_brush()
Global.update_right_custom_brush()
func _on_FitToFrameButton_pressed() -> void:
Global.camera.fit_to_frame(Global.canvas.size)
func _on_100ZoomButton_pressed() -> void:
Global.camera.zoom = Vector2.ONE
Global.camera.offset = Global.canvas.size / 2
Global.zoom_level_label.text = str(round(100 / Global.camera.zoom.x)) + " %"
Global.horizontal_ruler.update()
Global.vertical_ruler.update()
func _on_BrushTypeButton_pressed(right : bool) -> void:
if right:
Global.brushes_popup.popup(Rect2(Global.right_brush_type_button.rect_global_position, Vector2(226, 72)))
Global.brush_type_window_position = "right"
else:
Global.brushes_popup.popup(Rect2(Global.left_brush_type_button.rect_global_position, Vector2(226, 72)))
Global.brush_type_window_position = "left"
func _on_BrushSizeEdit_value_changed(value : float, right : bool) -> void:
var new_size = int(value)
if right:
Global.right_brush_size_edit.value = value
Global.right_brush_size_slider.value = value
Global.right_brush_size = new_size
Global.update_right_custom_brush()
else:
Global.left_brush_size_edit.value = value
Global.left_brush_size_slider.value = value
Global.left_brush_size = new_size
Global.update_left_custom_brush()
func _on_PixelPerfectMode_toggled(button_pressed : bool, right : bool) -> void:
if right:
Global.right_pixel_perfect = button_pressed
else:
Global.left_pixel_perfect = button_pressed
func _on_InterpolateFactor_value_changed(value : float, right : bool) -> void:
if right:
Global.right_interpolate_spinbox.value = value
Global.right_interpolate_slider.value = value
Global.update_right_custom_brush()
else:
Global.left_interpolate_spinbox.value = value
Global.left_interpolate_slider.value = value
Global.update_left_custom_brush()
func _on_FillAreaOptions_item_selected(ID : int, right : bool) -> void:
if right:
Global.right_fill_area = ID
else:
Global.left_fill_area = ID
func _on_FillWithOptions_item_selected(ID : int, right : bool) -> void:
if right:
Global.right_fill_with = ID
if ID == 1:
Global.right_fill_pattern_container.visible = true
else:
Global.right_fill_pattern_container.visible = false
else:
Global.left_fill_with = ID
if ID == 1:
Global.left_fill_pattern_container.visible = true
else:
Global.left_fill_pattern_container.visible = false
func _on_PatternTypeButton_pressed(right : bool) -> void:
if right:
Global.pattern_window_position = "right"
Global.patterns_popup.popup(Rect2(Global.right_brush_type_button.rect_global_position, Vector2(226, 72)))
else:
Global.pattern_window_position = "left"
Global.patterns_popup.popup(Rect2(Global.left_brush_type_button.rect_global_position, Vector2(226, 72)))
func _on_PatternOffsetX_value_changed(value : float, right : bool) -> void:
if right:
Global.right_fill_pattern_offset.x = value
else:
Global.left_fill_pattern_offset.x = value
func _on_PatternOffsetY_value_changed(value : float, right : bool) -> void:
if right:
Global.right_fill_pattern_offset.y = value
else:
Global.left_fill_pattern_offset.y = value
func _on_LightenDarken_item_selected(ID : int, right : bool) -> void:
if right:
Global.right_ld = ID
else:
Global.left_ld = ID
func _on_LDAmount_value_changed(value : float, right : bool) -> void:
if right:
Global.right_ld_amount = value / 100
Global.right_ld_amount_slider.value = value
Global.right_ld_amount_spinbox.value = value
else:
Global.left_ld_amount = value / 100
Global.left_ld_amount_slider.value = value
Global.left_ld_amount_spinbox.value = value
func _on_ForColorOptions_item_selected(ID : int, right : bool) -> void:
if right:
Global.right_color_picker_for = ID
else:
Global.left_color_picker_for = ID
func _on_ZoomModeOptions_item_selected(ID : int, right : bool) -> void:
if right:
Global.right_zoom_mode = ID
else:
Global.left_zoom_mode = ID
func _on_HorizontalMirroring_toggled(button_pressed : bool, right : bool) -> void:
if right:
Global.right_horizontal_mirror = button_pressed
else:
Global.left_horizontal_mirror = button_pressed
func _on_VerticalMirroring_toggled(button_pressed : bool, right : bool) -> void:
if right:
Global.right_vertical_mirror = button_pressed
else:
Global.left_vertical_mirror = button_pressed

File diff suppressed because one or more lines are too long

View file

@ -1,5 +0,0 @@
[gd_scene format=2]
[node name="CantRemoveMorePalettesDialog" type="AcceptDialog"]
window_title = "Alarm!"
dialog_text = "You can't remove more palettes!"

View file

@ -346,8 +346,8 @@ window_title = "Open a Directory"
resizable = true
mode = 2
access = 2
current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
current_dir = "C:/Users"
current_path = "C:/Users/"
[node name="PathValidationAlert" type="AcceptDialog" parent="Popups"]
margin_left = 8.0

View file

@ -2,8 +2,6 @@
[ext_resource path="res://src/UI/Dialogs/ImportSprites.gd" type="Script" id=1]
[node name="ImportSprites" type="FileDialog"]
margin_right = 515.0
margin_bottom = 348.0
@ -12,8 +10,8 @@ resizable = true
mode = 1
access = 2
filters = PoolStringArray( "*.bmp ; BMP Image", "*.hdr ; Radiance HDR Image", "*.jpg,*.jpeg ; JPEG Image", "*.png ; PNG Image", "*.svg ; SVG Image", "*.tga ; TGA Image", "*.webp ; WebP Image" )
current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
current_dir = "C:/Users"
current_path = "C:/Users/"
script = ExtResource( 1 )
[node name="HBoxContainer2" type="HBoxContainer" parent="."]

View file

@ -1,7 +0,0 @@
[gd_scene format=2]
[node name="NoProjectEditedOrCreatedAlertDialog" type="AcceptDialog"]
dialog_text = "You haven't saved or opened any project in Pixelorama yet!"
__meta__ = {
"_edit_use_anchors_": false
}

View file

@ -1,7 +0,0 @@
[gd_scene format=2]
[node name="OpenLastProjectAlertDialog" type="AcceptDialog"]
margin_right = 209.0
margin_bottom = 58.0
window_title = "Alarm!"
dialog_text = "Cannot find last project file."

View file

@ -0,0 +1,12 @@
[gd_scene format=2]
[node name="OpenSprite" type="FileDialog"]
margin_right = 515.0
margin_bottom = 348.0
window_title = "Open a File"
resizable = true
mode = 0
access = 2
filters = PoolStringArray( "*.pxo ; Pixelorama Project" )
current_dir = "C:/Users"
current_path = "C:/Users/"

View file

@ -1,5 +0,0 @@
[gd_scene format=2]
[node name="PaletteDoesntExistDialog" type="AcceptDialog"]
window_title = "Alarm!"
dialog_text = "Cannot remove the palette, because it doesn't exist!"

View file

@ -1,7 +0,0 @@
[gd_scene format=2]
[node name="PaletteRemoveErrorDialog" type="AcceptDialog"]
margin_right = 90.0
margin_bottom = 58.0
window_title = "Alarm!"
dialog_text = "An error occured while removing the palette! Error code: %s"

View file

@ -0,0 +1,16 @@
[gd_scene format=2]
[node name="SaveSprite" type="FileDialog"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -512.0
margin_top = -300.0
margin_right = 3.0
margin_bottom = 48.0
resizable = true
access = 2
filters = PoolStringArray( "*.pxo ; Pixelorama Project" )
current_dir = "C:/Users"
current_path = "C:/Users/"

22
src/UI/PatternsPopup.tscn Normal file
View file

@ -0,0 +1,22 @@
[gd_scene format=2]
[node name="PatternsPopup" type="PopupPanel"]
margin_right = 226.0
margin_bottom = 104.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ScrollContainer" type="ScrollContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 4.0
margin_right = -4.0
margin_bottom = -4.0
rect_min_size = Vector2( 0, 36 )
size_flags_horizontal = 3
scroll_horizontal_enabled = false
[node name="PatternContainer" type="GridContainer" parent="ScrollContainer"]
columns = 6

121
src/UI/ToolButtons.gd Normal file
View file

@ -0,0 +1,121 @@
extends VBoxContainer
var tools := []
func _ready() -> void:
# Node, left mouse shortcut, right mouse shortcut
tools.append([Global.find_node_by_name(self, "Pencil"), "left_pencil_tool", "right_pencil_tool"])
tools.append([Global.find_node_by_name(self, "Eraser"), "left_eraser_tool", "right_eraser_tool"])
tools.append([Global.find_node_by_name(self, "Bucket"), "left_fill_tool", "right_fill_tool"])
tools.append([Global.find_node_by_name(self, "LightenDarken"), "left_lightdark_tool", "right_lightdark_tool"])
tools.append([Global.find_node_by_name(self, "RectSelect"), "left_rectangle_select_tool", "right_rectangle_select_tool"])
tools.append([Global.find_node_by_name(self, "ColorPicker"), "left_colorpicker_tool", "right_colorpicker_tool"])
tools.append([Global.find_node_by_name(self, "Zoom"), "left_zoom_tool", "right_zoom_tool"])
for t in tools:
t[0].connect("pressed", self, "_on_Tool_pressed", [t[0]])
Global.update_hint_tooltips()
func _input(event : InputEvent) -> void:
if Global.has_focus:
if event.is_action_pressed("undo") or event.is_action_pressed("redo") or event.is_action_pressed("redo_secondary"):
return
for t in tools: # Handle tool shortcuts
if event.is_action_pressed(t[2]): # Shortcut for right button (with Alt)
_on_Tool_pressed(t[0], false, false)
elif event.is_action_pressed(t[1]): # Shortcut for left button
_on_Tool_pressed(t[0], false, true)
func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_left := true) -> void:
var current_action := tool_pressed.name
if (mouse_press and Input.is_action_just_released("left_mouse")) or (!mouse_press and key_for_left):
Global.current_left_tool = current_action
# Start from 1, so the label won't get invisible
for i in range(1, Global.left_tool_options_container.get_child_count()):
Global.left_tool_options_container.get_child(i).visible = false
Global.left_tool_options_container.get_node("EmptySpacer").visible = true
# Tool options visible depending on the selected tool
if current_action == "Pencil":
Global.left_brush_type_container.visible = true
Global.left_brush_size_slider.visible = true
Global.left_pixel_perfect_container.visible = true
Global.left_mirror_container.visible = true
if Global.current_left_brush_type == Global.Brush_Types.FILE or Global.current_left_brush_type == Global.Brush_Types.CUSTOM or Global.current_left_brush_type == Global.Brush_Types.RANDOM_FILE:
Global.left_color_interpolation_container.visible = true
elif current_action == "Eraser":
Global.left_brush_type_container.visible = true
Global.left_brush_size_slider.visible = true
Global.left_pixel_perfect_container.visible = true
Global.left_mirror_container.visible = true
elif current_action == "Bucket":
Global.left_fill_area_container.visible = true
Global.left_mirror_container.visible = true
elif current_action == "LightenDarken":
Global.left_brush_type_container.visible = true
Global.left_brush_size_slider.visible = true
Global.left_pixel_perfect_container.visible = true
Global.left_ld_container.visible = true
Global.left_mirror_container.visible = true
elif current_action == "ColorPicker":
Global.left_colorpicker_container.visible = true
elif current_action == "Zoom":
Global.left_zoom_container.visible = true
elif (mouse_press and Input.is_action_just_released("right_mouse")) or (!mouse_press and !key_for_left):
Global.current_right_tool = current_action
# Start from 1, so the label won't get invisible
for i in range(1, Global.right_tool_options_container.get_child_count()):
Global.right_tool_options_container.get_child(i).visible = false
Global.right_tool_options_container.get_node("EmptySpacer").visible = true
# Tool options visible depending on the selected tool
if current_action == "Pencil":
Global.right_brush_type_container.visible = true
Global.right_brush_size_slider.visible = true
Global.right_pixel_perfect_container.visible = true
Global.right_mirror_container.visible = true
if Global.current_right_brush_type == Global.Brush_Types.FILE or Global.current_right_brush_type == Global.Brush_Types.CUSTOM or Global.current_right_brush_type == Global.Brush_Types.RANDOM_FILE:
Global.right_color_interpolation_container.visible = true
elif current_action == "Eraser":
Global.right_brush_type_container.visible = true
Global.right_brush_size_slider.visible = true
Global.right_pixel_perfect_container.visible = true
Global.right_mirror_container.visible = true
elif current_action == "Bucket":
Global.right_fill_area_container.visible = true
Global.right_mirror_container.visible = true
elif current_action == "LightenDarken":
Global.right_brush_type_container.visible = true
Global.right_brush_size_slider.visible = true
Global.right_pixel_perfect_container.visible = true
Global.right_ld_container.visible = true
Global.right_mirror_container.visible = true
elif current_action == "ColorPicker":
Global.right_colorpicker_container.visible = true
elif current_action == "Zoom":
Global.right_zoom_container.visible = true
for t in tools:
var tool_name : String = t[0].name
var texture_button : TextureRect = t[0].get_child(0)
if tool_name == Global.current_left_tool and tool_name == Global.current_right_tool:
Global.change_button_texturerect(texture_button, "%s_l_r.png" % tool_name.to_lower())
elif tool_name == Global.current_left_tool:
Global.change_button_texturerect(texture_button, "%s_l.png" % tool_name.to_lower())
elif tool_name == Global.current_right_tool:
Global.change_button_texturerect(texture_button, "%s_r.png" % tool_name.to_lower())
else:
Global.change_button_texturerect(texture_button, "%s.png" % tool_name.to_lower())
Global.left_cursor_tool_texture.create_from_image(load("res://assets/graphics/cursor_icons/%s_cursor.png" % Global.current_left_tool.to_lower()), 0)
Global.right_cursor_tool_texture.create_from_image(load("res://assets/graphics/cursor_icons/%s_cursor.png" % Global.current_right_tool.to_lower()), 0)

View file

@ -0,0 +1,109 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/themes/dark/top_menu_style.tres" type="StyleBox" id=1]
[node name="TopMenuContainer" type="Panel"]
margin_right = 1280.0
margin_bottom = 28.0
rect_min_size = Vector2( 0, 28 )
custom_styles/panel = ExtResource( 1 )
[node name="MenuItems" type="HBoxContainer" parent="."]
margin_left = 2.0
margin_top = 4.0
margin_right = 1010.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="FileMenu" type="MenuButton" parent="MenuItems"]
margin_right = 29.0
margin_bottom = 21.0
mouse_default_cursor_shape = 2
text = "File"
switch_on_hover = true
[node name="EditMenu" type="MenuButton" parent="MenuItems"]
margin_left = 33.0
margin_right = 64.0
margin_bottom = 21.0
mouse_default_cursor_shape = 2
text = "Edit"
switch_on_hover = true
[node name="ViewMenu" type="MenuButton" parent="MenuItems"]
margin_left = 68.0
margin_right = 104.0
margin_bottom = 21.0
mouse_default_cursor_shape = 2
text = "View"
switch_on_hover = true
[node name="ImageMenu" type="MenuButton" parent="MenuItems"]
margin_left = 108.0
margin_right = 152.0
margin_bottom = 21.0
mouse_default_cursor_shape = 2
text = "Image"
switch_on_hover = true
[node name="HelpMenu" type="MenuButton" parent="MenuItems"]
margin_left = 156.0
margin_right = 191.0
margin_bottom = 21.0
mouse_default_cursor_shape = 2
text = "Help"
switch_on_hover = true
[node name="TopLabels" type="HBoxContainer" parent="."]
anchor_left = 0.5
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -65.5
margin_right = 65.5
custom_constants/separation = 20
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ZoomLevel" type="Label" parent="TopLabels"]
margin_top = 6.0
margin_right = 60.0
margin_bottom = 21.0
rect_min_size = Vector2( 60, 0 )
text = "781 %"
align = 2
[node name="CursorPosition" type="Label" parent="TopLabels"]
margin_left = 80.0
margin_top = 6.0
margin_right = 120.0
margin_bottom = 21.0
text = "[64×64]"
align = 2
[node name="HBoxContainer" type="HBoxContainer" parent="."]
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_left = -330.0
margin_top = -14.0
margin_bottom = 14.0
grow_horizontal = 2
size_flags_vertical = 0
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CurrentFrame" type="Label" parent="HBoxContainer"]
margin_left = 113.0
margin_top = 6.0
margin_right = 216.0
margin_bottom = 21.0
text = "Current Frame: 1/1"
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}

385
src/UI/UI.tscn Normal file
View file

@ -0,0 +1,385 @@
[gd_scene load_steps=24 format=2]
[ext_resource path="res://src/UI/ToolButtons.gd" type="Script" id=1]
[ext_resource path="res://src/UI/SecondViewport.gd" type="Script" id=2]
[ext_resource path="res://src/UI/Rulers/VerticalRuler.gd" type="Script" id=4]
[ext_resource path="res://src/UI/Rulers/HorizontalRuler.gd" type="Script" id=6]
[ext_resource path="res://src/CameraMovement.gd" type="Script" id=7]
[ext_resource path="res://src/SelectionRectangle.gd" type="Script" id=8]
[ext_resource path="res://assets/themes/dark/ruler_style.tres" type="StyleBox" id=9]
[ext_resource path="res://assets/graphics/dark_themes/tools/bucket.png" type="Texture" id=10]
[ext_resource path="res://assets/graphics/dark_themes/tools/colorpicker.png" type="Texture" id=11]
[ext_resource path="res://assets/graphics/dark_themes/tools/rectselect.png" type="Texture" id=12]
[ext_resource path="res://assets/graphics/dark_themes/tools/eraser_r.png" type="Texture" id=13]
[ext_resource path="res://assets/graphics/dark_themes/tools/pencil_l.png" type="Texture" id=14]
[ext_resource path="res://assets/graphics/dark_themes/tools/lightendarken.png" type="Texture" id=15]
[ext_resource path="res://src/Shaders/TransparentChecker.shader" type="Shader" id=16]
[ext_resource path="res://src/UI/ColorAndToolOptions.tscn" type="PackedScene" id=17]
[ext_resource path="res://src/UI/Timeline/AnimationTimeline.tscn" type="PackedScene" id=18]
[ext_resource path="res://src/Canvas.tscn" type="PackedScene" id=19]
[ext_resource path="res://src/Palette/PalettePanelContainer.tscn" type="PackedScene" id=20]
[ext_resource path="res://assets/graphics/dark_themes/tools/zoom.png" type="Texture" id=21]
[ext_resource path="res://src/UI/TransparentChecker.gd" type="Script" id=22]
[ext_resource path="res://src/UI/ViewportContainer.gd" type="Script" id=23]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 16 )
shader_param/size = 10.0
shader_param/color1 = Color( 0.7, 0.7, 0.7, 1 )
shader_param/color2 = Color( 1, 1, 1, 1 )
[sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 0.0627451, 0.0627451, 0.0627451, 1 )
expand_margin_top = 6.0
[node name="UI" type="HBoxContainer"]
margin_top = 28.0
margin_right = 1280.0
margin_bottom = 720.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ToolPanel" type="Panel" parent="."]
margin_right = 48.0
margin_bottom = 692.0
rect_min_size = Vector2( 48, 0 )
size_flags_vertical = 3
[node name="PanelContainer" type="PanelContainer" parent="ToolPanel"]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -20.5
margin_right = 20.5
margin_bottom = 254.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Tools" type="VBoxContainer" parent="ToolPanel/PanelContainer"]
margin_left = 7.0
margin_top = 7.0
margin_right = 39.0
margin_bottom = 255.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="RectSelect" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
"UIButtons",
]]
margin_right = 32.0
margin_bottom = 32.0
rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/RectSelect"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 12 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Zoom" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
"UIButtons",
]]
margin_top = 36.0
margin_right = 32.0
margin_bottom = 68.0
rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/Zoom"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 21 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorPicker" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
"UIButtons",
]]
margin_top = 72.0
margin_right = 32.0
margin_bottom = 104.0
rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/ColorPicker"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 11 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Pencil" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
"UIButtons",
]]
margin_top = 108.0
margin_right = 32.0
margin_bottom = 140.0
rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/Pencil"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 14 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Eraser" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
"UIButtons",
]]
margin_top = 144.0
margin_right = 32.0
margin_bottom = 176.0
rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/Eraser"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 13 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Bucket" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
"UIButtons",
]]
margin_top = 180.0
margin_right = 32.0
margin_bottom = 212.0
rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/Bucket"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 10 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="LightenDarken" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
"UIButtons",
]]
margin_top = 216.0
margin_right = 32.0
margin_bottom = 248.0
rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/LightenDarken"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 15 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CanvasAndTimeline" type="VSplitContainer" parent="."]
margin_left = 48.0
margin_right = 950.0
margin_bottom = 692.0
size_flags_horizontal = 3
custom_constants/autohide = 0
[node name="HViewportContainer" type="HBoxContainer" parent="CanvasAndTimeline"]
margin_right = 902.0
margin_bottom = 480.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="ViewportAndRulers" type="VBoxContainer" parent="CanvasAndTimeline/HViewportContainer"]
margin_right = 902.0
margin_bottom = 480.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 0
[node name="HorizontalRuler" type="Button" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers"]
margin_right = 902.0
margin_bottom = 16.0
rect_min_size = Vector2( 0, 16 )
focus_mode = 0
mouse_default_cursor_shape = 14
custom_styles/hover = ExtResource( 9 )
custom_styles/pressed = ExtResource( 9 )
custom_styles/focus = ExtResource( 9 )
custom_styles/normal = ExtResource( 9 )
action_mode = 0
enabled_focus_mode = 0
script = ExtResource( 6 )
[node name="HSplitContainer" type="HSplitContainer" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers"]
margin_top = 16.0
margin_right = 902.0
margin_bottom = 480.0
size_flags_vertical = 3
custom_constants/autohide = 0
[node name="ViewportandVerticalRuler" type="HBoxContainer" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer"]
margin_right = 890.0
margin_bottom = 464.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 0
[node name="VerticalRuler" type="Button" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler"]
margin_right = 16.0
margin_bottom = 464.0
rect_min_size = Vector2( 16, 0 )
focus_mode = 0
mouse_default_cursor_shape = 15
size_flags_horizontal = 0
size_flags_vertical = 3
custom_styles/hover = ExtResource( 9 )
custom_styles/pressed = ExtResource( 9 )
custom_styles/focus = ExtResource( 9 )
custom_styles/normal = ExtResource( 9 )
action_mode = 0
enabled_focus_mode = 0
script = ExtResource( 4 )
[node name="ViewportContainer" type="ViewportContainer" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler"]
margin_left = 16.0
margin_right = 890.0
margin_bottom = 464.0
focus_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
stretch = true
script = ExtResource( 23 )
[node name="Viewport" type="Viewport" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer"]
size = Vector2( 874, 464 )
handle_input_locally = false
usage = 0
render_target_update_mode = 3
[node name="TransparentChecker" type="ColorRect" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer/Viewport"]
material = SubResource( 1 )
margin_right = 40.0
margin_bottom = 40.0
mouse_filter = 2
script = ExtResource( 22 )
[node name="Canvas" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer/Viewport" instance=ExtResource( 19 )]
[node name="Camera2D" type="Camera2D" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer/Viewport"]
current = true
zoom = Vector2( 0.15, 0.15 )
script = ExtResource( 7 )
[node name="SelectionRectangle" type="Polygon2D" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer/Viewport"]
visible = false
z_index = 1
color = Color( 0.0823529, 0.694118, 0.623529, 0.592157 )
invert_enable = true
invert_border = 0.5
polygon = PoolVector2Array( 0, 0, 0, 0, 0, 0, 0, 0 )
script = ExtResource( 8 )
[node name="ViewportContainer2" type="ViewportContainer" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer"]
margin_left = 902.0
margin_right = 902.0
margin_bottom = 464.0
size_flags_vertical = 3
stretch = true
script = ExtResource( 23 )
[node name="Viewport" type="Viewport" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportContainer2"]
size = Vector2( 0, 464 )
handle_input_locally = false
render_target_update_mode = 3
script = ExtResource( 2 )
[node name="Camera2D2" type="Camera2D" parent="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportContainer2/Viewport"]
current = true
zoom = Vector2( 0.15, 0.15 )
script = ExtResource( 7 )
[node name="AnimationTimeline" parent="CanvasAndTimeline" instance=ExtResource( 18 )]
margin_top = 492.0
margin_bottom = 692.0
custom_styles/panel = SubResource( 2 )
[node name="RightPanel" type="Panel" parent="."]
margin_left = 950.0
margin_right = 1280.0
margin_bottom = 692.0
rect_min_size = Vector2( 330, 0 )
[node name="PreviewAndPalettes" type="VBoxContainer" parent="RightPanel"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = 16.0
margin_right = 3.05176e-05
margin_bottom = 6.10352e-05
__meta__ = {
"_edit_use_anchors_": false
}
[node name="PanelContainer" type="PanelContainer" parent="RightPanel/PreviewAndPalettes"]
margin_left = 8.0
margin_right = 322.0
margin_bottom = 164.0
size_flags_horizontal = 4
[node name="CanvasPreview" type="ViewportContainer" parent="RightPanel/PreviewAndPalettes/PanelContainer"]
margin_left = 7.0
margin_top = 7.0
margin_right = 307.0
margin_bottom = 157.0
rect_min_size = Vector2( 0, 150 )
[node name="Viewport" type="Viewport" parent="RightPanel/PreviewAndPalettes/PanelContainer/CanvasPreview"]
size = Vector2( 300, 150 )
transparent_bg = true
handle_input_locally = false
render_target_update_mode = 3
script = ExtResource( 2 )
[node name="CameraPreview" type="Camera2D" parent="RightPanel/PreviewAndPalettes/PanelContainer/CanvasPreview/Viewport"]
offset = Vector2( 32, 32 )
current = true
zoom = Vector2( 0.15, 0.15 )
script = ExtResource( 7 )
[node name="ToolAndPaletteVSplit" type="VSplitContainer" parent="RightPanel/PreviewAndPalettes"]
margin_top = 168.0
margin_right = 330.0
margin_bottom = 676.0
size_flags_vertical = 3
custom_constants/autohide = 0
[node name="ColorAndToolOptions" parent="RightPanel/PreviewAndPalettes/ToolAndPaletteVSplit" instance=ExtResource( 17 )]
margin_bottom = 248.0
[node name="PalettePanelContainer" parent="RightPanel/PreviewAndPalettes/ToolAndPaletteVSplit" instance=ExtResource( 20 )]
margin_top = 260.0
margin_bottom = 508.0
[connection signal="mouse_entered" from="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HorizontalRuler" to="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HorizontalRuler" method="_on_HorizontalRuler_mouse_entered"]
[connection signal="pressed" from="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HorizontalRuler" to="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HorizontalRuler" method="_on_HorizontalRuler_pressed"]
[connection signal="pressed" from="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/VerticalRuler" to="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/VerticalRuler" method="_on_VerticalRuler_pressed"]
[connection signal="mouse_entered" from="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer" to="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer" method="_on_ViewportContainer_mouse_entered"]
[connection signal="mouse_exited" from="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer" to="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer" method="_on_ViewportContainer_mouse_exited"]
[connection signal="mouse_entered" from="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportContainer2" to="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportContainer2" method="_on_ViewportContainer_mouse_entered"]
[connection signal="mouse_exited" from="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportContainer2" to="CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HSplitContainer/ViewportContainer2" method="_on_ViewportContainer_mouse_exited"]

View file

@ -0,0 +1,9 @@
extends ViewportContainer
func _on_ViewportContainer_mouse_entered() -> void:
Global.has_focus = true
func _on_ViewportContainer_mouse_exited() -> void:
Global.has_focus = false