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

Merge branch 'master' into palette_updates

This commit is contained in:
CheetoHead 2019-12-14 22:19:17 -05:00
commit 4c3b43d350
3 changed files with 50 additions and 46 deletions

View file

@ -770,6 +770,7 @@ mouse_default_cursor_shape = 2
text = "Vertical" text = "Vertical"
[node name="CanvasAndTimeline" type="VBoxContainer" parent="MenuAndUI/UI"] [node name="CanvasAndTimeline" type="VBoxContainer" parent="MenuAndUI/UI"]
editor/display_folded = true
margin_left = 224.0 margin_left = 224.0
margin_right = 928.0 margin_right = 928.0
margin_bottom = 620.0 margin_bottom = 620.0
@ -803,6 +804,7 @@ enabled_focus_mode = 0
script = ExtResource( 13 ) script = ExtResource( 13 )
[node name="ViewportandVerticalRuler" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers"] [node name="ViewportandVerticalRuler" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers"]
editor/display_folded = true
margin_top = 16.0 margin_top = 16.0
margin_right = 704.0 margin_right = 704.0
margin_bottom = 478.0 margin_bottom = 478.0
@ -1434,8 +1436,8 @@ resizable = true
mode = 0 mode = 0
access = 2 access = 2
filters = PoolStringArray( "*.pxo ; Pixelorama Project" ) filters = PoolStringArray( "*.pxo ; Pixelorama Project" )
current_dir = "D:/GitHub/Pixelorama" current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
current_path = "D:/GitHub/Pixelorama/" current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
[node name="SaveSprite" type="FileDialog" parent="."] [node name="SaveSprite" type="FileDialog" parent="."]
anchor_left = 0.5 anchor_left = 0.5
@ -1450,8 +1452,8 @@ window_title = "Save Sprite as .pxo"
resizable = true resizable = true
access = 2 access = 2
filters = PoolStringArray( "*.pxo ; Pixelorama Project" ) filters = PoolStringArray( "*.pxo ; Pixelorama Project" )
current_dir = "D:/GitHub/Pixelorama" current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
current_path = "D:/GitHub/Pixelorama/" current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
[node name="ImportSprites" type="FileDialog" parent="."] [node name="ImportSprites" type="FileDialog" parent="."]
margin_right = 515.0 margin_right = 515.0
@ -1461,8 +1463,8 @@ resizable = true
mode = 1 mode = 1
access = 2 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" ) 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 = "D:/GitHub/Pixelorama" current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
current_path = "D:/GitHub/Pixelorama/" current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
[node name="ExportSprites" type="FileDialog" parent="."] [node name="ExportSprites" type="FileDialog" parent="."]
anchor_left = 0.5 anchor_left = 0.5
@ -1477,8 +1479,8 @@ window_title = "Export Sprite"
resizable = true resizable = true
access = 2 access = 2
filters = PoolStringArray( "*.png ; PNG Image" ) filters = PoolStringArray( "*.png ; PNG Image" )
current_dir = "D:/GitHub/Pixelorama" current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
current_path = "D:/GitHub/Pixelorama/" current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
[node name="ScaleImage" type="ConfirmationDialog" parent="."] [node name="ScaleImage" type="ConfirmationDialog" parent="."]
editor/display_folded = true editor/display_folded = true
@ -1559,13 +1561,13 @@ resizable = true
[node name="VBoxContainer" type="VBoxContainer" parent="PreferencesDialog"] [node name="VBoxContainer" type="VBoxContainer" parent="PreferencesDialog"]
anchor_left = 0.5 anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
margin_left = -92.0 margin_left = -97.5
margin_top = 8.0 margin_top = 8.0
margin_right = 92.0 margin_right = 97.5
margin_bottom = 33.0 margin_bottom = 123.0
[node name="OptionsContainer" type="GridContainer" parent="PreferencesDialog/VBoxContainer"] [node name="OptionsContainer" type="GridContainer" parent="PreferencesDialog/VBoxContainer"]
margin_right = 184.0 margin_right = 195.0
margin_bottom = 21.0 margin_bottom = 21.0
columns = 2 columns = 2
@ -1576,23 +1578,23 @@ margin_bottom = 18.0
text = "Language:" text = "Language:"
[node name="LanguageOption" type="OptionButton" parent="PreferencesDialog/VBoxContainer/OptionsContainer"] [node name="LanguageOption" type="OptionButton" parent="PreferencesDialog/VBoxContainer/OptionsContainer"]
margin_left = 61.0 margin_left = 57.0
margin_right = 142.0 margin_right = 195.0
margin_bottom = 21.0 margin_bottom = 21.0
text = "System Language" text = "System Language"
items = [ "System Language", null, false, 0, null, "Greek [el]", null, false, 1, null, "English [en]", null, false, 2, null ] items = [ "System Language", null, false, 0, null, "Greek [el]", null, false, 1, null, "English [en]", null, false, 2, null, "French [fr]", null, false, 3, null ]
selected = 0 selected = 0
[node name="GridOptionsLabel" type="Label" parent="PreferencesDialog/VBoxContainer"] [node name="GridOptionsLabel" type="Label" parent="PreferencesDialog/VBoxContainer"]
margin_top = 25.0 margin_top = 25.0
margin_right = 184.0 margin_right = 195.0
margin_bottom = 40.0 margin_bottom = 40.0
text = "Grid options" text = "Grid options"
[node name="GridOptions" type="GridContainer" parent="PreferencesDialog/VBoxContainer"] [node name="GridOptions" type="GridContainer" parent="PreferencesDialog/VBoxContainer"]
margin_top = 44.0 margin_top = 44.0
margin_right = 184.0 margin_right = 195.0
margin_bottom = 123.0 margin_bottom = 115.0
columns = 2 columns = 2
[node name="WidthLabel" type="Label" parent="PreferencesDialog/VBoxContainer/GridOptions"] [node name="WidthLabel" type="Label" parent="PreferencesDialog/VBoxContainer/GridOptions"]
@ -1602,8 +1604,8 @@ margin_bottom = 20.0
text = "Width:" text = "Width:"
[node name="GridWidthValue" type="SpinBox" parent="PreferencesDialog/VBoxContainer/GridOptions"] [node name="GridWidthValue" type="SpinBox" parent="PreferencesDialog/VBoxContainer/GridOptions"]
margin_left = 43.0 margin_left = 39.0
margin_right = 107.0 margin_right = 103.0
margin_bottom = 25.0 margin_bottom = 25.0
min_value = 1.0 min_value = 1.0
max_value = 16384.0 max_value = 16384.0
@ -1611,32 +1613,32 @@ value = 1.0
suffix = "px" suffix = "px"
[node name="Height" type="Label" parent="PreferencesDialog/VBoxContainer/GridOptions"] [node name="Height" type="Label" parent="PreferencesDialog/VBoxContainer/GridOptions"]
margin_top = 34.0 margin_top = 30.0
margin_right = 39.0 margin_right = 39.0
margin_bottom = 49.0 margin_bottom = 45.0
text = "Height:" text = "Height:"
[node name="GridHeightValue" type="SpinBox" parent="PreferencesDialog/VBoxContainer/GridOptions"] [node name="GridHeightValue" type="SpinBox" parent="PreferencesDialog/VBoxContainer/GridOptions"]
margin_left = 43.0 margin_left = 39.0
margin_top = 29.0 margin_top = 25.0
margin_right = 107.0 margin_right = 103.0
margin_bottom = 54.0 margin_bottom = 50.0
min_value = 1.0 min_value = 1.0
max_value = 16384.0 max_value = 16384.0
value = 1.0 value = 1.0
suffix = "px" suffix = "px"
[node name="GridColorLabel" type="Label" parent="PreferencesDialog/VBoxContainer/GridOptions"] [node name="GridColorLabel" type="Label" parent="PreferencesDialog/VBoxContainer/GridOptions"]
margin_top = 61.0 margin_top = 53.0
margin_right = 39.0 margin_right = 39.0
margin_bottom = 76.0 margin_bottom = 68.0
text = "Color:" text = "Color:"
[node name="GridColor" type="ColorPickerButton" parent="PreferencesDialog/VBoxContainer/GridOptions"] [node name="GridColor" type="ColorPickerButton" parent="PreferencesDialog/VBoxContainer/GridOptions"]
margin_left = 43.0 margin_left = 39.0
margin_top = 58.0 margin_top = 50.0
margin_right = 107.0 margin_right = 103.0
margin_bottom = 79.0 margin_bottom = 71.0
rect_min_size = Vector2( 64, 20 ) rect_min_size = Vector2( 64, 20 )
[node name="AboutDialog" type="AcceptDialog" parent="."] [node name="AboutDialog" type="AcceptDialog" parent="."]

View file

@ -15,6 +15,7 @@ hint_tooltip = "Color Name"
custom_styles/hover = ExtResource( 1 ) custom_styles/hover = ExtResource( 1 )
custom_styles/pressed = ExtResource( 2 ) custom_styles/pressed = ExtResource( 2 )
custom_styles/normal = ExtResource( 3 ) custom_styles/normal = ExtResource( 3 )
button_mask = 3
icon = SubResource( 1 ) icon = SubResource( 1 )
[node name="NinePatchRect" type="NinePatchRect" parent="."] [node name="NinePatchRect" type="NinePatchRect" parent="."]

View file

@ -1,10 +1,6 @@
extends GridContainer extends GridContainer
# Declare member variables here. Examples: var palette_button = preload("res://Prefabs/PaletteButton.tscn");
# var a = 2
# var b = "text"
var palette_button = load("res://Prefabs/PaletteButton.tscn");
var current_palette = "Default" var current_palette = "Default"
@ -44,7 +40,7 @@ var default_palette = [
] ]
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready() -> void:
#Global.palettes["Default"] = default_palette #Global.palettes["Default"] = default_palette
_load_palettes() _load_palettes()
@ -52,14 +48,14 @@ func _ready():
on_palette_select(current_palette) on_palette_select(current_palette)
pass # Replace with function body. pass # Replace with function body.
func _clear_swatches(): func _clear_swatches() -> void:
for child in get_children(): for child in get_children():
if child is BaseButton: if child is BaseButton:
child.disconnect("pressed", self, "on_color_select") child.disconnect("pressed", self, "on_color_select")
child.queue_free() child.queue_free()
pass pass
func on_palette_select(palette_name): func on_palette_select(palette_name) -> void:
_clear_swatches() _clear_swatches()
if Global.palettes.has(palette_name): if Global.palettes.has(palette_name):
_display_palette(Global.palettes[palette_name]) _display_palette(Global.palettes[palette_name])
@ -67,8 +63,8 @@ func on_palette_select(palette_name):
_display_palette(Global.palettes["Default"]) _display_palette(Global.palettes["Default"])
pass pass
func _display_palette(palette): func _display_palette(palette) -> void:
var index = 0 var index := 0
for color_data in palette: for color_data in palette:
var color = Color(color_data.data) var color = Color(color_data.data)
var new_button = palette_button.instance() var new_button = palette_button.instance()
@ -79,11 +75,16 @@ func _display_palette(palette):
index += 1 index += 1
pass pass
func on_color_select(index): func on_color_select(index : int) -> void:
Global.left_color_picker.color = default_palette[index] if Input.is_action_just_released("left_mouse"):
Global.left_color_picker.color = default_palette[index]
Global.update_left_custom_brush()
elif Input.is_action_just_released("right_mouse"):
Global.right_color_picker.color = default_palette[index]
Global.update_right_custom_brush()
pass pass
func _load_palettes(): func _load_palettes() -> void:
var files := [] var files := []
var dir := Directory.new() var dir := Directory.new()
@ -110,7 +111,7 @@ func _load_palettes():
Global.palette_option_button.add_item(success) Global.palette_option_button.add_item(success)
pass pass
func _load_palette(path): func _load_palette(path) -> String:
var file := File.new() var file := File.new()
file.open(path, File.READ) file.open(path, File.READ)