mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-03-15 15:55:18 +00:00
Compare commits
7 commits
fcfc606861
...
fe9eb4a5e1
Author | SHA1 | Date | |
---|---|---|---|
|
fe9eb4a5e1 | ||
|
29f241a607 | ||
|
8284a24989 | ||
|
436406a527 | ||
|
e4afcc275a | ||
|
5f43a3e282 | ||
|
c1cdc304f2 |
24 changed files with 111 additions and 66 deletions
2
.github/workflows/dev-desktop-builds.yml
vendored
2
.github/workflows/dev-desktop-builds.yml
vendored
|
@ -123,7 +123,7 @@ jobs:
|
|||
- name: Download and extract export templates 💾
|
||||
run: |
|
||||
mkdir -v -p ~/.local/share/godot/templates/${GODOT_VERSION_MAC}.stable
|
||||
curl -O https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION_MAC}/Godot_v${GODOT_VERSION_MAC}-stable_export_templates.tpz
|
||||
wget https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION_MAC}-stable/Godot_v${GODOT_VERSION_MAC}-stable_export_templates.tpz
|
||||
unzip -a Godot_v${GODOT_VERSION_MAC}-stable_export_templates.tpz
|
||||
mv ./templates/* ~/.local/share/godot/templates/${GODOT_VERSION_MAC}.stable
|
||||
- name: Download Godot headless binary 🤖
|
||||
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -141,7 +141,7 @@ jobs:
|
|||
- name: Download and extract export templates 💾
|
||||
run: |
|
||||
mkdir -v -p ~/.local/share/godot/templates/${GODOT_VERSION_MAC}.stable
|
||||
curl -O https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION_MAC}/Godot_v${GODOT_VERSION_MAC}-stable_export_templates.tpz
|
||||
wget https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION_MAC}-stable/Godot_v${GODOT_VERSION_MAC}-stable_export_templates.tpz
|
||||
unzip -a Godot_v${GODOT_VERSION_MAC}-stable_export_templates.tpz
|
||||
mv ./templates/* ~/.local/share/godot/templates/${GODOT_VERSION_MAC}.stable
|
||||
- name: Download Godot headless binary 🤖
|
||||
|
|
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -31,16 +31,19 @@ Built using Godot 3.5.2
|
|||
- Fix bug where using shortcuts to switch between frames also moved the selection, causing deletions.
|
||||
- Pxo files can now be loaded from the Open menu option in the Web version. [3dcc51705a999145e53a8e6d4de217dc03b0f147](https://github.com/Orama-Interactive/Pixelorama/commit/3dcc51705a999145e53a8e6d4de217dc03b0f147)
|
||||
- The same frames are no longer being exported multiple times when "Selected frames" is selected, and multiple cels of the same frames are currently selected on the timeline. [#1001](https://github.com/Orama-Interactive/Pixelorama/issues/1001)
|
||||
- Fixed crash due to division by zero when locking two or three ValueSliders, and one of them has the value of 0 and the user attempts to change it.
|
||||
- Fixed exporting selected layers not including the non-selected frames.
|
||||
- Fix bug where images with width or height 1 are being completely cleared by image effects.
|
||||
- Fixed crash due to division by zero when locking two or three ValueSliders, and one of them has the value of 0 and the user attempts to change it. [3b8c63c4a6a3325707ef624942ea50834634e45c](https://github.com/Orama-Interactive/Pixelorama/commit/3b8c63c4a6a3325707ef624942ea50834634e45c)
|
||||
- Fixed exporting selected layers not including the non-selected frames. [324e21776de853e6ea24703d5724a491547371ab](https://github.com/Orama-Interactive/Pixelorama/commit/324e21776de853e6ea24703d5724a491547371ab)
|
||||
- Fix bug where images with width or height 1 are being completely cleared by image effects. [fcfc606861d247856db5473b702628ebd71df43f](https://github.com/Orama-Interactive/Pixelorama/commit/fcfc606861d247856db5473b702628ebd71df43f)
|
||||
- Made the color picker not select fully transparent pixels that are not black. [#999](https://github.com/Orama-Interactive/Pixelorama/issues/999)
|
||||
- Brushes are no longer being drawn outside the selection, if the selection is outside the canvas. [5f43a3e2829a7119d18d0762796222f20170f410](https://github.com/Orama-Interactive/Pixelorama/commit/5f43a3e2829a7119d18d0762796222f20170f410)
|
||||
- Bucket "similar color" and "whole selection" modes and image effects no longer affect pixels outside the selection area, if the selection is outside the canvas. [436406a527f0db67c5e2b58a90b43597b3168600](https://github.com/Orama-Interactive/Pixelorama/commit/436406a527f0db67c5e2b58a90b43597b3168600)
|
||||
- The ellipse tool no longer produces gaps with large sizes. [4f3a7a305a264e0d2fe86c201af76eca4b2fea0a](https://github.com/Orama-Interactive/Pixelorama/commit/4f3a7a305a264e0d2fe86c201af76eca4b2fea0a)
|
||||
- Fix "visible layers" option on the export dialog producing wrong results. [346d1f071a8c6b1defb1072d39aea9c642f1ef59](https://github.com/Orama-Interactive/Pixelorama/commit/346d1f071a8c6b1defb1072d39aea9c642f1ef59)
|
||||
- Random brushes now work again. [1317e40ffa5e9f01a9d214221bb5133db20a1de9](https://github.com/Orama-Interactive/Pixelorama/commit/1317e40ffa5e9f01a9d214221bb5133db20a1de9)
|
||||
- Fixed issue where the override.cfg file would be created at the wrong location, if Pixelorama is launched through a shortcut.
|
||||
- Fixed issue where the override.cfg file would be created at the wrong location, if Pixelorama is launched through a shortcut. [0c6566de761a683a0e8a781131024a1dedb9734f](https://github.com/Orama-Interactive/Pixelorama/commit/0c6566de761a683a0e8a781131024a1dedb9734f)
|
||||
- The gizmo in the rotation image effect dialog is now accurately following the mouse.
|
||||
- Fixed the size label not being updated on the Export dialog's spritesheet tab when the direction changes.
|
||||
- Fixed the size label not being updated on the Export dialog's spritesheet tab when the direction changes. [9a5eb9720d2328f914f8efc3b9aa605dadca99b0](https://github.com/Orama-Interactive/Pixelorama/commit/9a5eb9720d2328f914f8efc3b9aa605dadca99b0)
|
||||
- The "Export dimensions" label in the export dialog no longer shows fractions as the final image's size.
|
||||
|
||||
## [v0.11.3] - 2023-10-30
|
||||
This update has been brought to you by the contributions of:
|
||||
|
|
|
@ -343,7 +343,7 @@ config/icon="res://assets/graphics/icons/icon.png"
|
|||
config/macos_native_icon="res://assets/graphics/icons/icon.icns"
|
||||
config/windows_native_icon="res://assets/graphics/icons/icon.ico"
|
||||
config/custom_user_dir_name.X11="pixelorama"
|
||||
config/Version="v0.11.4-rc2"
|
||||
config/Version="v0.11.4-rc3"
|
||||
config/ExtensionsAPI_Version=3
|
||||
config/Pxo_Version=2
|
||||
|
||||
|
|
|
@ -92,6 +92,25 @@ func invert() -> void:
|
|||
self.convert(Image.FORMAT_LA8)
|
||||
|
||||
|
||||
## Return Image because Godot 3.x doesn't like when the class name is referenced inside the class
|
||||
func return_cropped_copy(size: Vector2) -> Image:
|
||||
var selection_map_copy: Image = get_script().new()
|
||||
selection_map_copy.copy_from(self)
|
||||
var diff := Vector2.ZERO
|
||||
var selection_position: Vector2 = Global.canvas.selection.big_bounding_rectangle.position
|
||||
if selection_position.x < 0:
|
||||
diff.x += selection_position.x
|
||||
if selection_position.y < 0:
|
||||
diff.y += selection_position.y
|
||||
if diff != Vector2.ZERO:
|
||||
# If there are pixels out of bounds on the negative side (left & up),
|
||||
# move them before resizing
|
||||
selection_map_copy.fill(Color(0))
|
||||
selection_map_copy.blit_rect(self, Rect2(Vector2.ZERO, get_size()), diff)
|
||||
selection_map_copy.crop(size.x, size.y)
|
||||
return selection_map_copy
|
||||
|
||||
|
||||
func move_bitmap_values(project, move_offset := true) -> void:
|
||||
var size: Vector2 = project.size
|
||||
var selection_node = Global.canvas.selection
|
||||
|
|
|
@ -189,7 +189,7 @@ func fill_in_color(position: Vector2) -> void:
|
|||
var selection: Image
|
||||
var selection_tex := ImageTexture.new()
|
||||
if project.has_selection:
|
||||
selection = project.selection_map
|
||||
selection = project.selection_map.return_cropped_copy(project.size)
|
||||
else:
|
||||
selection = Image.new()
|
||||
selection.create(project.size.x, project.size.y, false, Image.FORMAT_RGBA8)
|
||||
|
@ -248,10 +248,7 @@ func fill_in_selection() -> void:
|
|||
filler.create(project.size.x, project.size.y, false, Image.FORMAT_RGBA8)
|
||||
filler.fill(tool_slot.color)
|
||||
var rect: Rect2 = Global.canvas.selection.big_bounding_rectangle
|
||||
var selection_map_copy := SelectionMap.new()
|
||||
selection_map_copy.copy_from(project.selection_map)
|
||||
# In case the selection map is bigger than the canvas
|
||||
selection_map_copy.crop(project.size.x, project.size.y)
|
||||
var selection_map_copy := project.selection_map.return_cropped_copy(project.size)
|
||||
for image in images:
|
||||
image.blit_rect_mask(filler, selection_map_copy, rect, rect.position)
|
||||
else:
|
||||
|
@ -267,7 +264,7 @@ func fill_in_selection() -> void:
|
|||
var selection: Image
|
||||
var selection_tex := ImageTexture.new()
|
||||
if project.has_selection:
|
||||
selection = project.selection_map
|
||||
selection = project.selection_map.return_cropped_copy(project.size)
|
||||
else:
|
||||
selection = Image.new()
|
||||
selection.create(project.size.x, project.size.y, false, Image.FORMAT_RGBA8)
|
||||
|
|
|
@ -432,7 +432,7 @@ func remove_unselected_parts_of_brush(brush: Image, dst: Vector2) -> Image:
|
|||
for x in size.x:
|
||||
for y in size.y:
|
||||
var pos := Vector2(x, y) + dst
|
||||
if !project.selection_map.is_pixel_selected(pos):
|
||||
if !project.can_pixel_get_drawn(pos):
|
||||
new_brush.set_pixel(x, y, Color(0))
|
||||
new_brush.unlock()
|
||||
return new_brush
|
||||
|
|
|
@ -52,7 +52,7 @@ func draw_preview() -> void:
|
|||
var canvas: Node2D = Global.canvas.previews
|
||||
var position := canvas.position
|
||||
var scale := canvas.scale
|
||||
var temp_rect = _rect
|
||||
var temp_rect := _rect
|
||||
if Global.mirror_view:
|
||||
position.x = position.x + Global.current_project.size.x
|
||||
temp_rect.position.x = Global.current_project.size.x - temp_rect.position.x
|
||||
|
@ -113,8 +113,9 @@ func apply_selection(_position: Vector2) -> void:
|
|||
|
||||
|
||||
func set_ellipse(selection_map: SelectionMap, position: Vector2) -> void:
|
||||
var project: Project = Global.current_project
|
||||
var bitmap_size: Vector2 = selection_map.get_size()
|
||||
var previous_selection_map := SelectionMap.new() # Used for intersect
|
||||
previous_selection_map.copy_from(selection_map)
|
||||
if _intersect:
|
||||
selection_map.clear()
|
||||
var points := _get_shape_points_filled(_rect.size)
|
||||
|
@ -123,7 +124,7 @@ func set_ellipse(selection_map: SelectionMap, position: Vector2) -> void:
|
|||
if pos.x < 0 or pos.y < 0 or pos.x >= bitmap_size.x or pos.y >= bitmap_size.y:
|
||||
continue
|
||||
if _intersect:
|
||||
if project.selection_map.is_pixel_selected(pos):
|
||||
if previous_selection_map.is_pixel_selected(pos):
|
||||
selection_map.select_pixel(pos, true)
|
||||
else:
|
||||
selection_map.select_pixel(pos, !_subtract)
|
||||
|
|
|
@ -77,21 +77,26 @@ func apply_selection(_position) -> void:
|
|||
.apply_selection(_position)
|
||||
var project: Project = Global.current_project
|
||||
var cleared := false
|
||||
var previous_selection_map := SelectionMap.new() # Used for intersect
|
||||
previous_selection_map.copy_from(project.selection_map)
|
||||
if !_add and !_subtract and !_intersect:
|
||||
cleared = true
|
||||
Global.canvas.selection.clear_selection()
|
||||
if _draw_points.size() > 3:
|
||||
if _intersect:
|
||||
project.selection_map.clear()
|
||||
lasso_selection(project.selection_map, _draw_points)
|
||||
lasso_selection(project.selection_map, previous_selection_map, _draw_points)
|
||||
|
||||
# Handle mirroring
|
||||
if Tools.horizontal_mirror:
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, true, false))
|
||||
var mirror_x := mirror_array(_draw_points, true, false)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_x)
|
||||
if Tools.vertical_mirror:
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, true, true))
|
||||
var mirror_xy := mirror_array(_draw_points, true, true)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_xy)
|
||||
if Tools.vertical_mirror:
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, false, true))
|
||||
var mirror_y := mirror_array(_draw_points, false, true)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_y)
|
||||
|
||||
Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||
else:
|
||||
|
@ -103,14 +108,16 @@ func apply_selection(_position) -> void:
|
|||
_last_position = Vector2.INF
|
||||
|
||||
|
||||
func lasso_selection(selection_map: SelectionMap, points: PoolVector2Array) -> void:
|
||||
func lasso_selection(
|
||||
selection_map: SelectionMap, previous_selection_map: SelectionMap, points: PoolVector2Array
|
||||
) -> void:
|
||||
var project: Project = Global.current_project
|
||||
var size := selection_map.get_size()
|
||||
for point in points:
|
||||
if point.x < 0 or point.y < 0 or point.x >= size.x or point.y >= size.y:
|
||||
continue
|
||||
if _intersect:
|
||||
if project.selection_map.is_pixel_selected(point):
|
||||
if previous_selection_map.is_pixel_selected(point):
|
||||
selection_map.select_pixel(point, true)
|
||||
else:
|
||||
selection_map.select_pixel(point, !_subtract)
|
||||
|
@ -123,7 +130,7 @@ func lasso_selection(selection_map: SelectionMap, points: PoolVector2Array) -> v
|
|||
v.y = y
|
||||
if Geometry.is_point_in_polygon(v, points):
|
||||
if _intersect:
|
||||
if project.selection_map.is_pixel_selected(v):
|
||||
if previous_selection_map.is_pixel_selected(v):
|
||||
selection_map.select_pixel(v, true)
|
||||
else:
|
||||
selection_map.select_pixel(v, !_subtract)
|
||||
|
|
|
@ -12,30 +12,31 @@ func apply_selection(position: Vector2) -> void:
|
|||
var size: Vector2 = project.size
|
||||
if position.x < 0 or position.y < 0 or position.x >= size.x or position.y >= size.y:
|
||||
return
|
||||
var previous_selection_map := SelectionMap.new() # Used for intersect
|
||||
previous_selection_map.copy_from(project.selection_map)
|
||||
if !_add and !_subtract and !_intersect:
|
||||
Global.canvas.selection.clear_selection()
|
||||
|
||||
if _intersect:
|
||||
project.selection_map.clear()
|
||||
|
||||
var cel_image := Image.new()
|
||||
cel_image.copy_from(_get_draw_image())
|
||||
cel_image.lock()
|
||||
_flood_fill(position, cel_image, project.selection_map)
|
||||
_flood_fill(position, cel_image, project.selection_map, previous_selection_map)
|
||||
|
||||
# Handle mirroring
|
||||
if Tools.horizontal_mirror:
|
||||
var mirror_x := position
|
||||
mirror_x.x = Global.current_project.x_symmetry_point - position.x
|
||||
_flood_fill(mirror_x, cel_image, project.selection_map)
|
||||
_flood_fill(mirror_x, cel_image, project.selection_map, previous_selection_map)
|
||||
if Tools.vertical_mirror:
|
||||
var mirror_xy := mirror_x
|
||||
mirror_xy.y = Global.current_project.y_symmetry_point - position.y
|
||||
_flood_fill(mirror_xy, cel_image, project.selection_map)
|
||||
_flood_fill(mirror_xy, cel_image, project.selection_map, previous_selection_map)
|
||||
if Tools.vertical_mirror:
|
||||
var mirror_y := position
|
||||
mirror_y.y = Global.current_project.y_symmetry_point - position.y
|
||||
_flood_fill(mirror_y, cel_image, project.selection_map)
|
||||
_flood_fill(mirror_y, cel_image, project.selection_map, previous_selection_map)
|
||||
cel_image.unlock()
|
||||
Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||
Global.canvas.selection.commit_undo("Select", undo_data)
|
||||
|
@ -127,18 +128,20 @@ func _check_flooded_segment(
|
|||
return ret
|
||||
|
||||
|
||||
func _flood_fill(position: Vector2, image: Image, selection_map: SelectionMap) -> void:
|
||||
func _flood_fill(
|
||||
pos: Vector2, image: Image, selection_map: SelectionMap, previous_selection_map: SelectionMap
|
||||
) -> void:
|
||||
# implements the floodfill routine by Shawn Hargreaves
|
||||
# from https://www1.udel.edu/CIS/software/dist/allegro-4.2.1/src/flood.c
|
||||
var project: Project = Global.current_project
|
||||
var color: Color = image.get_pixelv(position)
|
||||
var color: Color = image.get_pixelv(pos)
|
||||
# init flood data structures
|
||||
_allegro_flood_segments = []
|
||||
_allegro_image_segments = []
|
||||
_compute_segments_for_image(position, project, image, color)
|
||||
_compute_segments_for_image(pos, project, image, color)
|
||||
# now actually color the image: since we have already checked a few things for the points
|
||||
# we'll process here, we're going to skip a bunch of safety checks to speed things up.
|
||||
_select_segments(selection_map)
|
||||
_select_segments(selection_map, previous_selection_map)
|
||||
|
||||
|
||||
func _compute_segments_for_image(
|
||||
|
@ -170,18 +173,17 @@ func _compute_segments_for_image(
|
|||
done = false
|
||||
|
||||
|
||||
func _select_segments(selection_map: SelectionMap) -> void:
|
||||
func _select_segments(selection_map: SelectionMap, previous_selection_map: SelectionMap) -> void:
|
||||
# short circuit for flat colors
|
||||
for c in _allegro_image_segments.size():
|
||||
var p = _allegro_image_segments[c]
|
||||
for px in range(p.left_position, p.right_position + 1):
|
||||
# We don't have to check again whether the point being processed is within the bounds
|
||||
_set_bit(Vector2(px, p.y), selection_map)
|
||||
_set_bit(Vector2(px, p.y), selection_map, previous_selection_map)
|
||||
|
||||
|
||||
func _set_bit(p: Vector2, selection_map: SelectionMap) -> void:
|
||||
var project: Project = Global.current_project
|
||||
func _set_bit(p: Vector2, selection_map: SelectionMap, prev_selection_map: SelectionMap) -> void:
|
||||
if _intersect:
|
||||
selection_map.select_pixel(p, project.selection_map.is_pixel_selected(p))
|
||||
selection_map.select_pixel(p, prev_selection_map.is_pixel_selected(p))
|
||||
else:
|
||||
selection_map.select_pixel(p, !_subtract)
|
||||
|
|
|
@ -105,6 +105,8 @@ func apply_selection(_position) -> void:
|
|||
.apply_selection(_position)
|
||||
var project: Project = Global.current_project
|
||||
var cleared := false
|
||||
var previous_selection_map := SelectionMap.new() # Used for intersect
|
||||
previous_selection_map.copy_from(project.selection_map)
|
||||
if !_add and !_subtract and !_intersect:
|
||||
cleared = true
|
||||
Global.canvas.selection.clear_selection()
|
||||
|
@ -112,15 +114,18 @@ func apply_selection(_position) -> void:
|
|||
if _draw_points.size() >= 1:
|
||||
if _intersect:
|
||||
project.selection_map.clear()
|
||||
paint_selection(project.selection_map, _draw_points)
|
||||
paint_selection(project.selection_map, previous_selection_map, _draw_points)
|
||||
|
||||
# Handle mirroring
|
||||
if Tools.horizontal_mirror:
|
||||
paint_selection(project.selection_map, mirror_array(_draw_points, true, false))
|
||||
var mirror_x := mirror_array(_draw_points, true, false)
|
||||
paint_selection(project.selection_map, previous_selection_map, mirror_x)
|
||||
if Tools.vertical_mirror:
|
||||
paint_selection(project.selection_map, mirror_array(_draw_points, true, true))
|
||||
var mirror_xy := mirror_array(_draw_points, true, true)
|
||||
paint_selection(project.selection_map, previous_selection_map, mirror_xy)
|
||||
if Tools.vertical_mirror:
|
||||
paint_selection(project.selection_map, mirror_array(_draw_points, false, true))
|
||||
var mirror_y := mirror_array(_draw_points, false, true)
|
||||
paint_selection(project.selection_map, previous_selection_map, mirror_y)
|
||||
|
||||
Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||
else:
|
||||
|
@ -132,14 +137,15 @@ func apply_selection(_position) -> void:
|
|||
_last_position = Vector2.INF
|
||||
|
||||
|
||||
func paint_selection(selection_map: SelectionMap, points: PoolVector2Array) -> void:
|
||||
var project: Project = Global.current_project
|
||||
func paint_selection(
|
||||
selection_map: SelectionMap, previous_selection_map: SelectionMap, points: PoolVector2Array
|
||||
) -> void:
|
||||
var size := selection_map.get_size()
|
||||
for point in points:
|
||||
if point.x < 0 or point.y < 0 or point.x >= size.x or point.y >= size.y:
|
||||
continue
|
||||
if _intersect:
|
||||
if project.selection_map.is_pixel_selected(point):
|
||||
if previous_selection_map.is_pixel_selected(point):
|
||||
selection_map.select_pixel(point, true)
|
||||
else:
|
||||
selection_map.select_pixel(point, !_subtract)
|
||||
|
|
|
@ -115,21 +115,26 @@ func apply_selection(_position) -> void:
|
|||
return
|
||||
var project: Project = Global.current_project
|
||||
var cleared := false
|
||||
var previous_selection_map := SelectionMap.new() # Used for intersect
|
||||
previous_selection_map.copy_from(project.selection_map)
|
||||
if !_add and !_subtract and !_intersect:
|
||||
cleared = true
|
||||
Global.canvas.selection.clear_selection()
|
||||
if _draw_points.size() > 3:
|
||||
if _intersect:
|
||||
project.selection_map.clear()
|
||||
lasso_selection(project.selection_map, _draw_points)
|
||||
lasso_selection(project.selection_map, previous_selection_map, _draw_points)
|
||||
|
||||
# Handle mirroring
|
||||
if Tools.horizontal_mirror:
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, true, false))
|
||||
var mirror_x := mirror_array(_draw_points, true, false)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_x)
|
||||
if Tools.vertical_mirror:
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, true, true))
|
||||
var mirror_xy := mirror_array(_draw_points, true, true)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_xy)
|
||||
if Tools.vertical_mirror:
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, false, true))
|
||||
var mirror_y := mirror_array(_draw_points, false, true)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_y)
|
||||
|
||||
Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||
else:
|
||||
|
@ -143,14 +148,16 @@ func apply_selection(_position) -> void:
|
|||
Global.canvas.previews.update()
|
||||
|
||||
|
||||
func lasso_selection(selection_map: SelectionMap, points: PoolVector2Array) -> void:
|
||||
func lasso_selection(
|
||||
selection_map: SelectionMap, previous_selection_map: SelectionMap, points: PoolVector2Array
|
||||
) -> void:
|
||||
var project: Project = Global.current_project
|
||||
var size := selection_map.get_size()
|
||||
for point in points:
|
||||
if point.x < 0 or point.y < 0 or point.x >= size.x or point.y >= size.y:
|
||||
continue
|
||||
if _intersect:
|
||||
if project.selection_map.is_pixel_selected(point):
|
||||
if previous_selection_map.is_pixel_selected(point):
|
||||
selection_map.select_pixel(point, true)
|
||||
else:
|
||||
selection_map.select_pixel(point, !_subtract)
|
||||
|
@ -163,7 +170,7 @@ func lasso_selection(selection_map: SelectionMap, points: PoolVector2Array) -> v
|
|||
v.y = y
|
||||
if Geometry.is_point_in_polygon(v, points):
|
||||
if _intersect:
|
||||
if project.selection_map.is_pixel_selected(v):
|
||||
if previous_selection_map.is_pixel_selected(v):
|
||||
selection_map.select_pixel(v, true)
|
||||
else:
|
||||
selection_map.select_pixel(v, !_subtract)
|
||||
|
|
|
@ -451,14 +451,16 @@ func select_rect(rect: Rect2, operation: int = SelectionOperation.ADD) -> void:
|
|||
elif operation == SelectionOperation.SUBTRACT:
|
||||
project.selection_map.fill_rect(rect, Color(0))
|
||||
elif operation == SelectionOperation.INTERSECT:
|
||||
var previous_selection_map := SelectionMap.new() # Used for intersect
|
||||
previous_selection_map.copy_from(project.selection_map)
|
||||
project.selection_map.clear()
|
||||
for x in range(rect.position.x, rect.end.x):
|
||||
for y in range(rect.position.y, rect.end.y):
|
||||
var pos := Vector2(x, y)
|
||||
if !Rect2(Vector2.ZERO, project.selection_map.get_size()).has_point(pos):
|
||||
if !Rect2(Vector2.ZERO, previous_selection_map.get_size()).has_point(pos):
|
||||
continue
|
||||
project.selection_map.select_pixel(
|
||||
pos, project.selection_map.is_pixel_selected(pos)
|
||||
pos, previous_selection_map.is_pixel_selected(pos)
|
||||
)
|
||||
big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||
|
||||
|
|
|
@ -226,6 +226,7 @@ func create_layer_list() -> void:
|
|||
func update_dimensions_label() -> void:
|
||||
if Export.processed_images.size() > 0:
|
||||
var new_size: Vector2 = Export.processed_images[0].get_size() * (Export.resize / 100.0)
|
||||
new_size = new_size.floor()
|
||||
dimension_label.text = str(new_size.x, "×", new_size.y)
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project: Project = Global.current_project) -> void:
|
||||
var selection_tex := ImageTexture.new()
|
||||
if selection_checkbox.pressed and project.has_selection:
|
||||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
selection_tex.create_from_image(project.selection_map.return_cropped_copy(project.size), 0)
|
||||
|
||||
var params := {
|
||||
"red": red, "blue": blue, "green": green, "alpha": alpha, "selection": selection_tex
|
||||
|
|
|
@ -28,7 +28,7 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi
|
|||
var offset_y := animate_panel.get_animated_value(commit_idx, Animate.OFFSET_Y)
|
||||
var selection_tex := ImageTexture.new()
|
||||
if selection_checkbox.pressed and project.has_selection:
|
||||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
selection_tex.create_from_image(project.selection_map.return_cropped_copy(project.size), 0)
|
||||
|
||||
var params := {
|
||||
"shadow_offset": Vector2(offset_x, offset_y),
|
||||
|
|
|
@ -58,7 +58,7 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi
|
|||
var selection: Image
|
||||
var selection_tex := ImageTexture.new()
|
||||
if selection_checkbox.pressed and project.has_selection:
|
||||
selection = project.selection_map
|
||||
selection = project.selection_map.return_cropped_copy(project.size)
|
||||
else: # This is needed to prevent a weird bug with the dithering shaders and GLES2
|
||||
selection = Image.new()
|
||||
selection.create(project.size.x, project.size.y, false, Image.FORMAT_L8)
|
||||
|
|
|
@ -12,7 +12,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project: Project = Global.current_project) -> void:
|
||||
var selection_tex := ImageTexture.new()
|
||||
if selection_checkbox.pressed and project.has_selection:
|
||||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
selection_tex.create_from_image(project.selection_map.return_cropped_copy(project.size), 0)
|
||||
|
||||
var params := {"selection": selection_tex, "map": $VBoxContainer/GradientEdit.texture}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi
|
|||
var val = animate_panel.get_animated_value(commit_idx, Animate.VALUE) / 100
|
||||
var selection_tex := ImageTexture.new()
|
||||
if selection_checkbox.pressed and project.has_selection:
|
||||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
selection_tex.create_from_image(project.selection_map.return_cropped_copy(project.size), 0)
|
||||
|
||||
var params := {"hue_shift": hue, "sat_shift": sat, "val_shift": val, "selection": selection_tex}
|
||||
if !confirmed:
|
||||
|
|
|
@ -17,7 +17,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project: Project = Global.current_project) -> void:
|
||||
var selection_tex := ImageTexture.new()
|
||||
if selection_checkbox.pressed and project.has_selection:
|
||||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
selection_tex.create_from_image(project.selection_map.return_cropped_copy(project.size), 0)
|
||||
|
||||
var params := {
|
||||
"red": red, "blue": blue, "green": green, "alpha": alpha, "selection": selection_tex
|
||||
|
|
|
@ -33,7 +33,7 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi
|
|||
var offset := Vector2(offset_x, offset_y)
|
||||
var selection_tex := ImageTexture.new()
|
||||
if selection_checkbox.pressed and project.has_selection:
|
||||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
selection_tex.create_from_image(project.selection_map.return_cropped_copy(project.size), 0)
|
||||
|
||||
var params := {"offset": offset, "wrap_around": wrap_around, "selection": selection_tex}
|
||||
if !confirmed:
|
||||
|
|
|
@ -35,7 +35,7 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi
|
|||
|
||||
var selection_tex := ImageTexture.new()
|
||||
if selection_checkbox.pressed and project.has_selection:
|
||||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
selection_tex.create_from_image(project.selection_map.return_cropped_copy(project.size), 0)
|
||||
|
||||
var params := {
|
||||
"color": color,
|
||||
|
|
|
@ -14,7 +14,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project: Project = Global.current_project) -> void:
|
||||
var selection_tex := ImageTexture.new()
|
||||
if selection_checkbox.pressed and project.has_selection:
|
||||
selection_tex.create_from_image(project.selection_map, 0)
|
||||
selection_tex.create_from_image(project.selection_map.return_cropped_copy(project.size), 0)
|
||||
|
||||
var params := {"colors": levels, "dither": dither, "selection": selection_tex}
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ func commit_action(cel: Image, _project: Project = Global.current_project) -> vo
|
|||
var selection_rectangle: Rect2 = _project.selection_map.get_used_rect()
|
||||
selection_size = selection_rectangle.size
|
||||
|
||||
var selection: Image = _project.selection_map
|
||||
selection_tex.create_from_image(selection, 0)
|
||||
var selection := _project.selection_map
|
||||
selection_tex.create_from_image(selection.return_cropped_copy(_project.size), 0)
|
||||
|
||||
if !_type_is_shader():
|
||||
image.lock()
|
||||
|
|
Loading…
Add table
Reference in a new issue