mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Added a "Mirror View" option in the View menu
Which is used to flip the canvas horizontally and non-destructively. Closes #227
This commit is contained in:
parent
f1eb6bb569
commit
d7008362b5
|
@ -17,6 +17,7 @@ PinyaColada, Rémi Verschelde (akien-mga), dasimonde, gschwind, AbhinavKDev
|
||||||
- Added a "Recent Projects" option in the File menu, to contain the most recently opened projects. ([#370](https://github.com/Orama-Interactive/Pixelorama/pull/370))
|
- Added a "Recent Projects" option in the File menu, to contain the most recently opened projects. ([#370](https://github.com/Orama-Interactive/Pixelorama/pull/370))
|
||||||
- HiDPI support - Pixelorama's UI can now be scaled in the Preferences. ([#140](https://github.com/Orama-Interactive/Pixelorama/issues/140))
|
- HiDPI support - Pixelorama's UI can now be scaled in the Preferences. ([#140](https://github.com/Orama-Interactive/Pixelorama/issues/140))
|
||||||
- More options have been added to Tile mode, Tile only in X Axis, Y Axis or both Axis. ([#378](https://github.com/Orama-Interactive/Pixelorama/pull/378))
|
- More options have been added to Tile mode, Tile only in X Axis, Y Axis or both Axis. ([#378](https://github.com/Orama-Interactive/Pixelorama/pull/378))
|
||||||
|
- Added a "Mirror View" option in the View menu, which is used to flip the canvas horizontally and non-destructively. ([#227](https://github.com/Orama-Interactive/Pixelorama/issues/227))
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- `~` is now used as a random brush prefix instead of `%`. ([#362](https://github.com/Orama-Interactive/Pixelorama/pull/362))
|
- `~` is now used as a random brush prefix instead of `%`. ([#362](https://github.com/Orama-Interactive/Pixelorama/pull/362))
|
||||||
|
|
|
@ -142,6 +142,9 @@ msgstr ""
|
||||||
msgid "Tile Mode"
|
msgid "Tile Mode"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Mirror View"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Show Grid"
|
msgid "Show Grid"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -414,6 +414,11 @@ cut={
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":88,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":88,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
mirror_view={
|
||||||
|
"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":77,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[locale]
|
[locale]
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,7 @@ var right_square_indicator_visible := false
|
||||||
|
|
||||||
# View menu options
|
# View menu options
|
||||||
var tile_mode : int = Tile_Mode.NONE
|
var tile_mode : int = Tile_Mode.NONE
|
||||||
|
var mirror_view := false
|
||||||
var draw_grid := false
|
var draw_grid := false
|
||||||
var show_rulers := true
|
var show_rulers := true
|
||||||
var show_guides := true
|
var show_guides := true
|
||||||
|
|
|
@ -257,6 +257,9 @@ func draw_tool_circle(position : Vector2, fill := false) -> void:
|
||||||
|
|
||||||
|
|
||||||
func draw_tool_brush(position : Vector2) -> void:
|
func draw_tool_brush(position : Vector2) -> void:
|
||||||
|
if Global.mirror_view:
|
||||||
|
position.x = Global.current_project.size.x - position.x
|
||||||
|
|
||||||
if Global.tile_mode and _get_tile_mode_rect().has_point(position):
|
if Global.tile_mode and _get_tile_mode_rect().has_point(position):
|
||||||
position = position.posmodv(Global.current_project.size)
|
position = position.posmodv(Global.current_project.size)
|
||||||
|
|
||||||
|
@ -331,6 +334,9 @@ func draw_indicator_at(position : Vector2, offset : Vector2, color : Color) -> v
|
||||||
|
|
||||||
func _set_pixel(position : Vector2) -> void:
|
func _set_pixel(position : Vector2) -> void:
|
||||||
var project : Project = Global.current_project
|
var project : Project = Global.current_project
|
||||||
|
if Global.mirror_view:
|
||||||
|
position.x = project.size.x - position.x - 1
|
||||||
|
|
||||||
if Global.tile_mode and _get_tile_mode_rect().has_point(position):
|
if Global.tile_mode and _get_tile_mode_rect().has_point(position):
|
||||||
position = position.posmodv(project.size)
|
position = position.posmodv(project.size)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ extends Node2D
|
||||||
|
|
||||||
var location := Vector2.ZERO
|
var location := Vector2.ZERO
|
||||||
var fill_color := Color(0, 0, 0, 0)
|
var fill_color := Color(0, 0, 0, 0)
|
||||||
var current_pixel := Vector2.ZERO # pretty much same as mouse_pos, but can be accessed externally
|
var current_pixel := Vector2.ZERO
|
||||||
var can_undo := true
|
var can_undo := true
|
||||||
var cursor_image_has_changed := false
|
var cursor_image_has_changed := false
|
||||||
var sprite_changed_this_frame := false # for optimization purposes
|
var sprite_changed_this_frame := false # for optimization purposes
|
||||||
|
@ -28,6 +28,12 @@ func _draw() -> void:
|
||||||
|
|
||||||
var current_cels : Array = Global.current_project.frames[Global.current_project.current_frame].cels
|
var current_cels : Array = Global.current_project.frames[Global.current_project.current_frame].cels
|
||||||
|
|
||||||
|
var _position := position
|
||||||
|
var _scale := scale
|
||||||
|
if Global.mirror_view:
|
||||||
|
_position.x = _position.x + Global.current_project.size.x
|
||||||
|
_scale.x = -1
|
||||||
|
draw_set_transform(_position, rotation, _scale)
|
||||||
# Draw current frame layers
|
# Draw current frame layers
|
||||||
for i in range(Global.current_project.layers.size()):
|
for i in range(Global.current_project.layers.size()):
|
||||||
var modulate_color := Color(1, 1, 1, current_cels[i].opacity)
|
var modulate_color := Color(1, 1, 1, current_cels[i].opacity)
|
||||||
|
@ -37,6 +43,7 @@ func _draw() -> void:
|
||||||
if Global.onion_skinning:
|
if Global.onion_skinning:
|
||||||
onion_skinning()
|
onion_skinning()
|
||||||
tile_mode.update()
|
tile_mode.update()
|
||||||
|
draw_set_transform(position, rotation, scale)
|
||||||
|
|
||||||
|
|
||||||
func _input(event : InputEvent) -> void:
|
func _input(event : InputEvent) -> void:
|
||||||
|
|
|
@ -10,6 +10,13 @@ func _draw() -> void:
|
||||||
var positions : Array = get_tile_positions(size)
|
var positions : Array = get_tile_positions(size)
|
||||||
var tilemode_opacity = 1.0 - Global.tilemode_opacity
|
var tilemode_opacity = 1.0 - Global.tilemode_opacity
|
||||||
|
|
||||||
|
var _position := position
|
||||||
|
var _scale := scale
|
||||||
|
if Global.mirror_view:
|
||||||
|
_position.x = _position.x + Global.current_project.size.x
|
||||||
|
_scale.x = -1
|
||||||
|
draw_set_transform(_position, rotation, _scale)
|
||||||
|
|
||||||
for i in range(Global.current_project.layers.size()):
|
for i in range(Global.current_project.layers.size()):
|
||||||
var modulate_color := Color(1, 1, 1, current_cels[i].opacity - tilemode_opacity)
|
var modulate_color := Color(1, 1, 1, current_cels[i].opacity - tilemode_opacity)
|
||||||
if Global.current_project.layers[i].visible: # if it's visible
|
if Global.current_project.layers[i].visible: # if it's visible
|
||||||
|
@ -17,6 +24,8 @@ func _draw() -> void:
|
||||||
for pos in positions:
|
for pos in positions:
|
||||||
draw_texture(current_cels[i].image_texture, pos, modulate_color)
|
draw_texture(current_cels[i].image_texture, pos, modulate_color)
|
||||||
|
|
||||||
|
draw_set_transform(position, rotation, scale)
|
||||||
|
|
||||||
|
|
||||||
func get_tile_positions(size):
|
func get_tile_positions(size):
|
||||||
match Global.tile_mode:
|
match Global.tile_mode:
|
||||||
|
|
|
@ -75,6 +75,7 @@ func setup_edit_menu() -> void:
|
||||||
func setup_view_menu() -> void:
|
func setup_view_menu() -> void:
|
||||||
var view_menu_items := {
|
var view_menu_items := {
|
||||||
"Tile Mode" : 0,
|
"Tile Mode" : 0,
|
||||||
|
"Mirror View" : InputMap.get_action_list("mirror_view")[0].get_scancode_with_modifiers(),
|
||||||
"Show Grid" : InputMap.get_action_list("show_grid")[0].get_scancode_with_modifiers(),
|
"Show Grid" : InputMap.get_action_list("show_grid")[0].get_scancode_with_modifiers(),
|
||||||
"Show Rulers" : InputMap.get_action_list("show_rulers")[0].get_scancode_with_modifiers(),
|
"Show Rulers" : InputMap.get_action_list("show_rulers")[0].get_scancode_with_modifiers(),
|
||||||
"Show Guides" : InputMap.get_action_list("show_guides")[0].get_scancode_with_modifiers(),
|
"Show Guides" : InputMap.get_action_list("show_guides")[0].get_scancode_with_modifiers(),
|
||||||
|
@ -91,9 +92,9 @@ func setup_view_menu() -> void:
|
||||||
else:
|
else:
|
||||||
view_menu.add_check_item(item, i, view_menu_items[item])
|
view_menu.add_check_item(item, i, view_menu_items[item])
|
||||||
i += 1
|
i += 1
|
||||||
view_menu.set_item_checked(2, true) # Show Rulers
|
view_menu.set_item_checked(3, true) # Show Rulers
|
||||||
view_menu.set_item_checked(3, true) # Show Guides
|
view_menu.set_item_checked(4, true) # Show Guides
|
||||||
view_menu.set_item_checked(4, true) # Show Animation Timeline
|
view_menu.set_item_checked(5, true) # Show Animation Timeline
|
||||||
view_menu.hide_on_checkable_item_selection = false
|
view_menu.hide_on_checkable_item_selection = false
|
||||||
view_menu.connect("id_pressed", self, "view_menu_id_pressed")
|
view_menu.connect("id_pressed", self, "view_menu_id_pressed")
|
||||||
|
|
||||||
|
@ -253,17 +254,19 @@ 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:
|
||||||
1: # Show grid
|
1: # Mirror View
|
||||||
|
toggle_mirror_view()
|
||||||
|
2: # Show grid
|
||||||
toggle_show_grid()
|
toggle_show_grid()
|
||||||
2: # Show rulers
|
3: # Show rulers
|
||||||
toggle_show_rulers()
|
toggle_show_rulers()
|
||||||
3: # Show guides
|
4: # Show guides
|
||||||
toggle_show_guides()
|
toggle_show_guides()
|
||||||
4: # Show animation timeline
|
5: # Show animation timeline
|
||||||
toggle_show_anim_timeline()
|
toggle_show_anim_timeline()
|
||||||
5: # Zen mode
|
6: # Zen mode
|
||||||
toggle_zen_mode()
|
toggle_zen_mode()
|
||||||
6: # Fullscreen mode
|
7: # Fullscreen mode
|
||||||
toggle_fullscreen()
|
toggle_fullscreen()
|
||||||
Global.canvas.update()
|
Global.canvas.update()
|
||||||
|
|
||||||
|
@ -280,22 +283,27 @@ func tile_mode_submenu_id_pressed(id : int):
|
||||||
Global.canvas.grid.set_position(Global.transparent_checker.get_position())
|
Global.canvas.grid.set_position(Global.transparent_checker.get_position())
|
||||||
|
|
||||||
|
|
||||||
|
func toggle_mirror_view() -> void:
|
||||||
|
Global.mirror_view = !Global.mirror_view
|
||||||
|
view_menu.set_item_checked(1, Global.mirror_view)
|
||||||
|
|
||||||
|
|
||||||
func toggle_show_grid() -> void:
|
func toggle_show_grid() -> void:
|
||||||
Global.draw_grid = !Global.draw_grid
|
Global.draw_grid = !Global.draw_grid
|
||||||
view_menu.set_item_checked(1, Global.draw_grid)
|
view_menu.set_item_checked(2, Global.draw_grid)
|
||||||
Global.canvas.grid.update()
|
Global.canvas.grid.update()
|
||||||
|
|
||||||
|
|
||||||
func toggle_show_rulers() -> void:
|
func toggle_show_rulers() -> void:
|
||||||
Global.show_rulers = !Global.show_rulers
|
Global.show_rulers = !Global.show_rulers
|
||||||
view_menu.set_item_checked(2, Global.show_rulers)
|
view_menu.set_item_checked(3, Global.show_rulers)
|
||||||
Global.horizontal_ruler.visible = Global.show_rulers
|
Global.horizontal_ruler.visible = Global.show_rulers
|
||||||
Global.vertical_ruler.visible = Global.show_rulers
|
Global.vertical_ruler.visible = Global.show_rulers
|
||||||
|
|
||||||
|
|
||||||
func toggle_show_guides() -> void:
|
func toggle_show_guides() -> void:
|
||||||
Global.show_guides = !Global.show_guides
|
Global.show_guides = !Global.show_guides
|
||||||
view_menu.set_item_checked(3, Global.show_guides)
|
view_menu.set_item_checked(4, Global.show_guides)
|
||||||
for guide in Global.canvas.get_children():
|
for guide in Global.canvas.get_children():
|
||||||
if guide is Guide and guide in Global.current_project.guides:
|
if guide is Guide and guide in Global.current_project.guides:
|
||||||
guide.visible = Global.show_guides
|
guide.visible = Global.show_guides
|
||||||
|
@ -310,7 +318,7 @@ func toggle_show_anim_timeline() -> void:
|
||||||
if zen_mode:
|
if zen_mode:
|
||||||
return
|
return
|
||||||
Global.show_animation_timeline = !Global.show_animation_timeline
|
Global.show_animation_timeline = !Global.show_animation_timeline
|
||||||
view_menu.set_item_checked(4, Global.show_animation_timeline)
|
view_menu.set_item_checked(5, Global.show_animation_timeline)
|
||||||
Global.animation_timeline.visible = Global.show_animation_timeline
|
Global.animation_timeline.visible = Global.show_animation_timeline
|
||||||
|
|
||||||
|
|
||||||
|
@ -321,12 +329,12 @@ func toggle_zen_mode() -> void:
|
||||||
Global.control.get_node("MenuAndUI/UI/RightPanel").visible = zen_mode
|
Global.control.get_node("MenuAndUI/UI/RightPanel").visible = zen_mode
|
||||||
Global.control.get_node("MenuAndUI/UI/CanvasAndTimeline/ViewportAndRulers/TabsContainer").visible = zen_mode
|
Global.control.get_node("MenuAndUI/UI/CanvasAndTimeline/ViewportAndRulers/TabsContainer").visible = zen_mode
|
||||||
zen_mode = !zen_mode
|
zen_mode = !zen_mode
|
||||||
view_menu.set_item_checked(5, zen_mode)
|
view_menu.set_item_checked(6, zen_mode)
|
||||||
|
|
||||||
|
|
||||||
func toggle_fullscreen() -> void:
|
func toggle_fullscreen() -> void:
|
||||||
OS.window_fullscreen = !OS.window_fullscreen
|
OS.window_fullscreen = !OS.window_fullscreen
|
||||||
view_menu.set_item_checked(6, OS.window_fullscreen)
|
view_menu.set_item_checked(7, OS.window_fullscreen)
|
||||||
|
|
||||||
|
|
||||||
func image_menu_id_pressed(id : int) -> void:
|
func image_menu_id_pressed(id : int) -> void:
|
||||||
|
|
Loading…
Reference in a new issue