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 #12 from danielnaoexiste/master

[Feature] Added flip horizontal/vertical
This commit is contained in:
Overloaded 2019-10-24 00:27:22 +03:00 committed by GitHub
commit f05fbc89f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 18 deletions

View file

@ -22,6 +22,7 @@ size_flags_horizontal = 3
custom_constants/separation = 0
[node name="ToolPanel" type="Panel" parent="UI"]
editor/display_folded = true
margin_right = 230.0
margin_bottom = 600.0
rect_min_size = Vector2( 230, 0 )
@ -71,11 +72,13 @@ mouse_default_cursor_shape = 2
text = "Help"
[node name="PaintToolsContainer" type="HBoxContainer" parent="UI/ToolPanel/Tools/MenusAndTools"]
editor/display_folded = true
margin_top = 24.0
margin_right = 230.0
margin_bottom = 44.0
[node name="Pencil" type="Button" parent="UI/ToolPanel/Tools/MenusAndTools/PaintToolsContainer"]
editor/display_folded = true
margin_right = 51.0
margin_bottom = 20.0
hint_tooltip = "P for left mouse button
@ -91,6 +94,7 @@ centered = false
offset = Vector2( 0, -10 )
[node name="Eraser" type="Button" parent="UI/ToolPanel/Tools/MenusAndTools/PaintToolsContainer"]
editor/display_folded = true
margin_left = 55.0
margin_right = 106.0
margin_bottom = 20.0
@ -117,6 +121,7 @@ button_mask = 3
text = "Bucket"
[node name="ColorToolsContainer" type="HBoxContainer" parent="UI/ToolPanel/Tools/MenusAndTools"]
editor/display_folded = true
margin_top = 48.0
margin_right = 230.0
margin_bottom = 68.0
@ -143,6 +148,7 @@ button_mask = 3
text = "Lighten/Darken"
[node name="SelectionToolsContainer2" type="HBoxContainer" parent="UI/ToolPanel/Tools/MenusAndTools"]
editor/display_folded = true
margin_top = 72.0
margin_right = 230.0
margin_bottom = 92.0
@ -163,6 +169,7 @@ margin_right = 230.0
margin_bottom = 274.0
[node name="ToolOptions" type="HBoxContainer" parent="UI/ToolPanel/Tools"]
editor/display_folded = true
margin_top = 278.0
margin_right = 230.0
margin_bottom = 544.0
@ -342,6 +349,7 @@ margin_right = 230.0
margin_bottom = 552.0
[node name="BrushesContainer" type="ScrollContainer" parent="UI/ToolPanel/Tools"]
editor/display_folded = true
margin_top = 556.0
margin_right = 230.0
margin_bottom = 592.0
@ -378,7 +386,6 @@ margin_bottom = 600.0
size_flags_horizontal = 3
[node name="HBoxContainer" type="HBoxContainer" parent="UI/CanvasAndTimeline"]
editor/display_folded = true
margin_right = 634.0
margin_bottom = 464.0
size_flags_horizontal = 3
@ -439,6 +446,7 @@ zoom = Vector2( 0.15, 0.15 )
script = ExtResource( 6 )
[node name="AnimationTimeline" type="Panel" parent="UI/CanvasAndTimeline"]
editor/display_folded = true
margin_top = 468.0
margin_right = 634.0
margin_bottom = 600.0
@ -834,8 +842,8 @@ resizable = true
mode = 0
access = 2
filters = PoolStringArray( "*.pxo ; Pixelorama Project" )
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 = "/home/danielnaoexiste/Documents/Prog/Pixelorama"
current_path = "/home/danielnaoexiste/Documents/Prog/Pixelorama/"
[node name="SaveSprite" type="FileDialog" parent="."]
anchor_left = 0.5
@ -849,8 +857,8 @@ margin_bottom = 48.0
resizable = true
access = 2
filters = PoolStringArray( "*.pxo ; Pixelorama Project" )
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 = "/home/danielnaoexiste/Documents/Prog/Pixelorama"
current_path = "/home/danielnaoexiste/Documents/Prog/Pixelorama/"
[node name="ImportSprites" type="FileDialog" parent="."]
margin_right = 515.0
@ -860,8 +868,8 @@ resizable = true
mode = 1
access = 2
filters = PoolStringArray( "*jpg, *.png ; JPG, PNG Images" )
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 = "/home/danielnaoexiste/Documents/Prog/Pixelorama"
current_path = "/home/danielnaoexiste/Documents/Prog/Pixelorama/"
[node name="ExportSprites" type="FileDialog" parent="."]
anchor_left = 0.5
@ -876,8 +884,8 @@ window_title = "Export sprite"
resizable = true
access = 2
filters = PoolStringArray( "*.png ; PNG 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 = "/home/danielnaoexiste/Documents/Prog/Pixelorama"
current_path = "/home/danielnaoexiste/Documents/Prog/Pixelorama/"
[node name="ScaleImage" type="ConfirmationDialog" parent="."]
editor/display_folded = true

View file

@ -193,6 +193,7 @@ func _process(delta) -> void:
if sprite_changed_this_frame:
update_texture(current_layer_index)
func update_texture(layer_index : int) -> void:
layers[layer_index][1].create_from_image(layers[layer_index][0], 0)
get_layer_container(layer_index).get_child(0).get_child(1).texture = layers[layer_index][1]
@ -508,3 +509,4 @@ func rectangle_center(pos : Vector2, size : Vector2) -> Vector2:
func _on_Timer_timeout() -> void:
Global.can_draw = true

View file

@ -33,7 +33,9 @@ func _ready() -> void:
var edit_menu_items := {
"Scale Image" : 0,
"Crop Image" : 0,
"Clear Selection" : 0
"Clear Selection" : 0,
"Flip Horizontal": KEY_MASK_SHIFT + KEY_H,
"Flip Vertical": KEY_MASK_SHIFT + KEY_V
#"Undo" : KEY_MASK_CTRL + KEY_Z,
#"Redo" : KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_Z,
}
@ -182,6 +184,18 @@ func edit_menu_id_pressed(id : int) -> void:
Global.selection_rectangle.polygon[2] = Vector2.ZERO
Global.selection_rectangle.polygon[3] = Vector2.ZERO
Global.selected_pixels.clear()
3: # Flip Horizontal
var canvas = Global.canvas
canvas.layers[canvas.current_layer_index][0].unlock()
canvas.layers[canvas.current_layer_index][0].flip_x()
canvas.layers[canvas.current_layer_index][0].lock()
canvas.update_texture(canvas.current_layer_index)
4: # Flip Vertical
var canvas = Global.canvas
canvas.layers[canvas.current_layer_index][0].unlock()
canvas.layers[canvas.current_layer_index][0].flip_y()
canvas.layers[canvas.current_layer_index][0].lock()
canvas.update_texture(canvas.current_layer_index)
func view_menu_id_pressed(id : int) -> void:
match id:

View file

@ -13,15 +13,9 @@ _global_script_classes=[ {
"class": "Canvas",
"language": "GDScript",
"path": "res://Scripts/Canvas.gd"
}, {
"base": "Node2D",
"class": "CanvasOLD",
"language": "GDScript",
"path": "res://Scripts/Old/Canvas.gd"
} ]
_global_script_class_icons={
"Canvas": "",
"CanvasOLD": ""
"Canvas": ""
}
[application]
@ -137,6 +131,16 @@ right_lightdark_tool={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":true,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":85,"unicode":0,"echo":false,"script":null)
]
}
flip_h={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":72,"unicode":0,"echo":false,"script":null)
]
}
flip_v={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":86,"unicode":0,"echo":false,"script":null)
]
}
[rendering]