mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-03-16 16:25:17 +00:00
Compare commits
No commits in common. "dc6efe02bbf58f958ceb995624ed76658cb48252" and "a626772357ded6ac45d3a5d2eeb5762085c7803d" have entirely different histories.
dc6efe02bb
...
a626772357
26 changed files with 87 additions and 112 deletions
src
|
@ -526,7 +526,11 @@ func is_empty() -> bool:
|
|||
)
|
||||
|
||||
|
||||
func can_pixel_get_drawn(pixel: Vector2i, image := selection_map) -> bool:
|
||||
func can_pixel_get_drawn(
|
||||
pixel: Vector2i,
|
||||
image: SelectionMap = selection_map,
|
||||
selection_position: Vector2i = Global.canvas.selection.big_bounding_rectangle.position
|
||||
) -> bool:
|
||||
if pixel.x < 0 or pixel.y < 0 or pixel.x >= size.x or pixel.y >= size.y:
|
||||
return false
|
||||
|
||||
|
@ -534,6 +538,10 @@ func can_pixel_get_drawn(pixel: Vector2i, image := selection_map) -> bool:
|
|||
return false
|
||||
|
||||
if has_selection:
|
||||
if selection_position.x < 0:
|
||||
pixel.x -= selection_position.x
|
||||
if selection_position.y < 0:
|
||||
pixel.y -= selection_position.y
|
||||
return image.is_pixel_selected(pixel)
|
||||
else:
|
||||
return true
|
||||
|
|
|
@ -4,13 +4,7 @@ extends Image
|
|||
var invert_shader := preload("res://src/Shaders/Effects/Invert.gdshader")
|
||||
|
||||
|
||||
func is_pixel_selected(pixel: Vector2i, calculate_offset := true) -> bool:
|
||||
var selection_position: Vector2i = Global.canvas.selection.big_bounding_rectangle.position
|
||||
if calculate_offset:
|
||||
if selection_position.x < 0:
|
||||
pixel.x -= selection_position.x
|
||||
if selection_position.y < 0:
|
||||
pixel.y -= selection_position.y
|
||||
func is_pixel_selected(pixel: Vector2i) -> bool:
|
||||
if pixel.x < 0 or pixel.y < 0 or pixel.x >= get_width() or pixel.y >= get_height():
|
||||
return false
|
||||
var selected: bool = get_pixelv(pixel).a > 0
|
||||
|
@ -96,17 +90,6 @@ func invert() -> void:
|
|||
func return_cropped_copy(size: Vector2i) -> SelectionMap:
|
||||
var selection_map_copy := SelectionMap.new()
|
||||
selection_map_copy.copy_from(self)
|
||||
var diff := Vector2i.ZERO
|
||||
var selection_position: Vector2i = 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 != Vector2i.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, Rect2i(Vector2i.ZERO, get_size()), diff)
|
||||
selection_map_copy.crop(size.x, size.y)
|
||||
return selection_map_copy
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
shader_type canvas_item;
|
||||
render_mode unshaded;
|
||||
|
||||
uniform sampler2D selection : filter_nearest, hint_default_black;
|
||||
uniform sampler2D selection : hint_default_black;
|
||||
uniform vec4 color;
|
||||
uniform float similarity_percent : hint_range(0.0, 100.0);
|
||||
uniform int operation = 0; // 0 = add, 1 = subtract, 2 = intersect
|
||||
|
|
|
@ -467,7 +467,7 @@ func remove_unselected_parts_of_brush(brush: Image, dst: Vector2i) -> Image:
|
|||
for x in brush_size.x:
|
||||
for y in brush_size.y:
|
||||
var pos := Vector2i(x, y) + dst
|
||||
if !project.can_pixel_get_drawn(pos):
|
||||
if !project.selection_map.is_pixel_selected(pos):
|
||||
new_brush.set_pixel(x, y, Color(0))
|
||||
return new_brush
|
||||
|
||||
|
|
|
@ -84,13 +84,27 @@ func draw_start(pos: Vector2i) -> void:
|
|||
_start_pos = pos
|
||||
_offset = pos
|
||||
|
||||
var selection_position: Vector2i = selection_node.big_bounding_rectangle.position
|
||||
var offsetted_pos := pos
|
||||
if selection_position.x < 0:
|
||||
offsetted_pos.x -= selection_position.x
|
||||
if selection_position.y < 0:
|
||||
offsetted_pos.y -= selection_position.y
|
||||
|
||||
var quick_copy := Input.is_action_pressed("transform_copy_selection_content", true)
|
||||
if (
|
||||
project.selection_map.is_pixel_selected(pos)
|
||||
offsetted_pos.x >= 0
|
||||
and offsetted_pos.y >= 0
|
||||
and project.selection_map.is_pixel_selected(offsetted_pos)
|
||||
and (!_add and !_subtract and !_intersect or quick_copy)
|
||||
and !_ongoing_selection
|
||||
):
|
||||
if not project.layers[project.current_layer].can_layer_get_drawn():
|
||||
if !(
|
||||
Global
|
||||
. current_project
|
||||
. layers[Global.current_project.current_layer]
|
||||
. can_layer_get_drawn()
|
||||
):
|
||||
return
|
||||
# Move current selection
|
||||
_move = true
|
||||
|
|
|
@ -199,7 +199,7 @@ func fill_in_color(pos: Vector2i) -> void:
|
|||
var selection: Image
|
||||
var selection_tex: ImageTexture
|
||||
if project.has_selection:
|
||||
selection = project.selection_map.return_cropped_copy(project.size)
|
||||
selection = project.selection_map
|
||||
else:
|
||||
selection = Image.create(project.size.x, project.size.y, false, Image.FORMAT_RGBA8)
|
||||
selection.fill(Color(1, 1, 1, 1))
|
||||
|
@ -263,7 +263,7 @@ func fill_in_selection() -> void:
|
|||
var selection: Image
|
||||
var selection_tex: ImageTexture
|
||||
if project.has_selection:
|
||||
selection = project.selection_map.return_cropped_copy(project.size)
|
||||
selection = project.selection_map
|
||||
else:
|
||||
selection = Image.create(project.size.x, project.size.y, false, Image.FORMAT_RGBA8)
|
||||
selection.fill(Color(1, 1, 1, 1))
|
||||
|
|
|
@ -49,6 +49,8 @@ popup/item_2/id = 2
|
|||
[node name="SimilaritySlider" parent="." index="4" instance=ExtResource("1")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
focus_mode = 2
|
||||
theme_type_variation = &"ValueSlider"
|
||||
value = 100.0
|
||||
prefix = "Similarity:"
|
||||
|
||||
|
@ -94,10 +96,14 @@ stretch_mode = 6
|
|||
|
||||
[node name="OffsetX" parent="FillPattern" index="1" instance=ExtResource("1")]
|
||||
layout_mode = 2
|
||||
focus_mode = 2
|
||||
theme_type_variation = &"ValueSlider"
|
||||
prefix = "Offset X:"
|
||||
|
||||
[node name="OffsetY" parent="FillPattern" index="2" instance=ExtResource("1")]
|
||||
layout_mode = 2
|
||||
focus_mode = 2
|
||||
theme_type_variation = &"ValueSlider"
|
||||
prefix = "Offset Y:"
|
||||
|
||||
[connection signal="item_selected" from="FillAreaOptions" to="." method="_on_FillAreaOptions_item_selected"]
|
||||
|
|
|
@ -92,9 +92,8 @@ func apply_selection(_position: Vector2i) -> void:
|
|||
|
||||
|
||||
func set_ellipse(selection_map: SelectionMap, pos: Vector2i) -> void:
|
||||
var project := Global.current_project
|
||||
var bitmap_size := 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 := DrawingAlgos.get_ellipse_points_filled(Vector2.ZERO, _rect.size)
|
||||
|
@ -103,7 +102,7 @@ func set_ellipse(selection_map: SelectionMap, pos: Vector2i) -> void:
|
|||
if fill_p.x < 0 or fill_p.y < 0 or fill_p.x >= bitmap_size.x or fill_p.y >= bitmap_size.y:
|
||||
continue
|
||||
if _intersect:
|
||||
if previous_selection_map.is_pixel_selected(fill_p):
|
||||
if project.selection_map.is_pixel_selected(fill_p):
|
||||
selection_map.select_pixel(fill_p, true)
|
||||
else:
|
||||
selection_map.select_pixel(fill_p, !_subtract)
|
||||
|
|
|
@ -21,7 +21,7 @@ func draw_move(pos_i: Vector2i) -> void:
|
|||
if !_move:
|
||||
append_gap(_last_position, pos)
|
||||
_last_position = pos
|
||||
_draw_points.append(Vector2i(pos))
|
||||
_draw_points.append(pos)
|
||||
_offset = pos
|
||||
|
||||
|
||||
|
@ -76,26 +76,21 @@ func apply_selection(_position) -> void:
|
|||
super.apply_selection(_position)
|
||||
var 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, previous_selection_map, _draw_points)
|
||||
lasso_selection(project.selection_map, _draw_points)
|
||||
|
||||
# Handle mirroring
|
||||
if Tools.horizontal_mirror:
|
||||
var mirror_x := mirror_array(_draw_points, true, false)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_x)
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, true, false))
|
||||
if Tools.vertical_mirror:
|
||||
var mirror_xy := mirror_array(_draw_points, true, true)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_xy)
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, true, true))
|
||||
if Tools.vertical_mirror:
|
||||
var mirror_y := mirror_array(_draw_points, false, true)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_y)
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, false, true))
|
||||
|
||||
Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||
else:
|
||||
|
@ -107,16 +102,14 @@ func apply_selection(_position) -> void:
|
|||
_last_position = Vector2.INF
|
||||
|
||||
|
||||
func lasso_selection(
|
||||
selection_map: SelectionMap, previous_selection_map: SelectionMap, points: Array[Vector2i]
|
||||
) -> void:
|
||||
func lasso_selection(selection_map: SelectionMap, points: Array[Vector2i]) -> void:
|
||||
var project := Global.current_project
|
||||
var selection_size := selection_map.get_size()
|
||||
for point in points:
|
||||
if point.x < 0 or point.y < 0 or point.x >= selection_size.x or point.y >= selection_size.y:
|
||||
continue
|
||||
if _intersect:
|
||||
if previous_selection_map.is_pixel_selected(point):
|
||||
if project.selection_map.is_pixel_selected(point):
|
||||
selection_map.select_pixel(point, true)
|
||||
else:
|
||||
selection_map.select_pixel(point, !_subtract)
|
||||
|
@ -129,7 +122,7 @@ func lasso_selection(
|
|||
v.y = y
|
||||
if Geometry2D.is_point_in_polygon(v, points):
|
||||
if _intersect:
|
||||
if previous_selection_map.is_pixel_selected(v):
|
||||
if project.selection_map.is_pixel_selected(v):
|
||||
selection_map.select_pixel(v, true)
|
||||
else:
|
||||
selection_map.select_pixel(v, !_subtract)
|
||||
|
|
|
@ -24,19 +24,18 @@ func apply_selection(pos: Vector2i) -> void:
|
|||
var project := Global.current_project
|
||||
if pos.x < 0 or pos.y < 0 or pos.x >= project.size.x or pos.y >= project.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())
|
||||
_flood_fill(pos, cel_image, project.selection_map, previous_selection_map)
|
||||
_flood_fill(pos, cel_image, project.selection_map)
|
||||
# Handle mirroring
|
||||
for mirror_pos in Tools.get_mirrored_positions(pos):
|
||||
_flood_fill(mirror_pos, cel_image, project.selection_map, previous_selection_map)
|
||||
_flood_fill(mirror_pos, cel_image, project.selection_map)
|
||||
|
||||
Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||
Global.canvas.selection.commit_undo("Select", undo_data)
|
||||
|
@ -120,9 +119,7 @@ func _check_flooded_segment(
|
|||
return ret
|
||||
|
||||
|
||||
func _flood_fill(
|
||||
pos: Vector2i, image: Image, selection_map: SelectionMap, previous_selection_map: SelectionMap
|
||||
) -> void:
|
||||
func _flood_fill(pos: Vector2i, image: Image, 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 := Global.current_project
|
||||
|
@ -133,7 +130,7 @@ func _flood_fill(
|
|||
_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, previous_selection_map)
|
||||
_select_segments(selection_map)
|
||||
|
||||
|
||||
func _compute_segments_for_image(
|
||||
|
@ -165,17 +162,18 @@ func _compute_segments_for_image(
|
|||
done = false
|
||||
|
||||
|
||||
func _select_segments(selection_map: SelectionMap, previous_selection_map: SelectionMap) -> void:
|
||||
func _select_segments(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(Vector2i(px, p.y), selection_map, previous_selection_map)
|
||||
_set_bit(Vector2i(px, p.y), selection_map)
|
||||
|
||||
|
||||
func _set_bit(p: Vector2i, selection_map: SelectionMap, prev_selection_map: SelectionMap) -> void:
|
||||
func _set_bit(p: Vector2i, selection_map: SelectionMap) -> void:
|
||||
var project := Global.current_project
|
||||
if _intersect:
|
||||
selection_map.select_pixel(p, prev_selection_map.is_pixel_selected(p))
|
||||
selection_map.select_pixel(p, project.selection_map.is_pixel_selected(p))
|
||||
else:
|
||||
selection_map.select_pixel(p, !_subtract)
|
||||
|
|
|
@ -104,8 +104,6 @@ func apply_selection(pos: Vector2i) -> void:
|
|||
super.apply_selection(pos)
|
||||
var 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()
|
||||
|
@ -113,18 +111,15 @@ func apply_selection(pos: Vector2i) -> void:
|
|||
if _draw_points.size() >= 1:
|
||||
if _intersect:
|
||||
project.selection_map.clear()
|
||||
paint_selection(project.selection_map, previous_selection_map, _draw_points)
|
||||
paint_selection(project.selection_map, _draw_points)
|
||||
|
||||
# Handle mirroring
|
||||
if Tools.horizontal_mirror:
|
||||
var mirror_x := mirror_array(_draw_points, true, false)
|
||||
paint_selection(project.selection_map, previous_selection_map, mirror_x)
|
||||
paint_selection(project.selection_map, mirror_array(_draw_points, true, false))
|
||||
if Tools.vertical_mirror:
|
||||
var mirror_xy := mirror_array(_draw_points, true, true)
|
||||
paint_selection(project.selection_map, previous_selection_map, mirror_xy)
|
||||
paint_selection(project.selection_map, mirror_array(_draw_points, true, true))
|
||||
if Tools.vertical_mirror:
|
||||
var mirror_y := mirror_array(_draw_points, false, true)
|
||||
paint_selection(project.selection_map, previous_selection_map, mirror_y)
|
||||
paint_selection(project.selection_map, mirror_array(_draw_points, false, true))
|
||||
|
||||
Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||
else:
|
||||
|
@ -136,15 +131,14 @@ func apply_selection(pos: Vector2i) -> void:
|
|||
_last_position = Vector2.INF
|
||||
|
||||
|
||||
func paint_selection(
|
||||
selection_map: SelectionMap, previous_selection_map: SelectionMap, points: Array[Vector2i]
|
||||
) -> void:
|
||||
func paint_selection(selection_map: SelectionMap, points: Array[Vector2i]) -> void:
|
||||
var project := Global.current_project
|
||||
var selection_size := selection_map.get_size()
|
||||
for point in points:
|
||||
if point.x < 0 or point.y < 0 or point.x >= selection_size.x or point.y >= selection_size.y:
|
||||
continue
|
||||
if _intersect:
|
||||
if previous_selection_map.is_pixel_selected(point):
|
||||
if project.selection_map.is_pixel_selected(point):
|
||||
selection_map.select_pixel(point, true)
|
||||
else:
|
||||
selection_map.select_pixel(point, !_subtract)
|
||||
|
|
|
@ -115,26 +115,21 @@ func apply_selection(pos: Vector2i) -> void:
|
|||
return
|
||||
var 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, previous_selection_map, _draw_points)
|
||||
lasso_selection(project.selection_map, _draw_points)
|
||||
|
||||
# Handle mirroring
|
||||
if Tools.horizontal_mirror:
|
||||
var mirror_x := mirror_array(_draw_points, true, false)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_x)
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, true, false))
|
||||
if Tools.vertical_mirror:
|
||||
var mirror_xy := mirror_array(_draw_points, true, true)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_xy)
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, true, true))
|
||||
if Tools.vertical_mirror:
|
||||
var mirror_y := mirror_array(_draw_points, false, true)
|
||||
lasso_selection(project.selection_map, previous_selection_map, mirror_y)
|
||||
lasso_selection(project.selection_map, mirror_array(_draw_points, false, true))
|
||||
|
||||
Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||
else:
|
||||
|
@ -148,16 +143,14 @@ func apply_selection(pos: Vector2i) -> void:
|
|||
Global.canvas.previews.queue_redraw()
|
||||
|
||||
|
||||
func lasso_selection(
|
||||
selection_map: SelectionMap, previous_selection_map: SelectionMap, points: Array[Vector2i]
|
||||
) -> void:
|
||||
func lasso_selection(selection_map: SelectionMap, points: Array[Vector2i]) -> void:
|
||||
var project := Global.current_project
|
||||
var selection_size := selection_map.get_size()
|
||||
for point in points:
|
||||
if point.x < 0 or point.y < 0 or point.x >= selection_size.x or point.y >= selection_size.y:
|
||||
continue
|
||||
if _intersect:
|
||||
if previous_selection_map.is_pixel_selected(point):
|
||||
if project.selection_map.is_pixel_selected(point):
|
||||
selection_map.select_pixel(point, true)
|
||||
else:
|
||||
selection_map.select_pixel(point, !_subtract)
|
||||
|
@ -170,7 +163,7 @@ func lasso_selection(
|
|||
v.y = y
|
||||
if Geometry2D.is_point_in_polygon(v, points):
|
||||
if _intersect:
|
||||
if previous_selection_map.is_pixel_selected(v):
|
||||
if project.selection_map.is_pixel_selected(v):
|
||||
selection_map.select_pixel(v, true)
|
||||
else:
|
||||
selection_map.select_pixel(v, !_subtract)
|
||||
|
|
|
@ -421,20 +421,18 @@ func select_rect(rect: Rect2i, operation := 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()
|
||||
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 := Vector2i(x, y)
|
||||
if !Rect2i(Vector2i.ZERO, previous_selection_map.get_size()).has_point(pos):
|
||||
if !Rect2i(Vector2i.ZERO, project.selection_map.get_size()).has_point(pos):
|
||||
continue
|
||||
project.selection_map.select_pixel(
|
||||
pos, previous_selection_map.is_pixel_selected(pos, false)
|
||||
pos, project.selection_map.is_pixel_selected(pos)
|
||||
)
|
||||
big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||
|
||||
if offset_position != Vector2i.ZERO and big_bounding_rectangle.get_area() != 0:
|
||||
if offset_position != Vector2i.ZERO:
|
||||
big_bounding_rectangle.position += offset_position
|
||||
project.selection_map.move_bitmap_values(project)
|
||||
|
||||
|
@ -685,7 +683,7 @@ func copy() -> void:
|
|||
offset_pos.x = 0
|
||||
if offset_pos.y < 0:
|
||||
offset_pos.y = 0
|
||||
if not project.selection_map.is_pixel_selected(pos + offset_pos, false):
|
||||
if not project.selection_map.is_pixel_selected(pos + offset_pos):
|
||||
to_copy.set_pixelv(pos, Color(0))
|
||||
cl_selection_map.copy_from(project.selection_map)
|
||||
cl_big_bounding_rectangle = big_bounding_rectangle
|
||||
|
|
|
@ -236,7 +236,7 @@ func create_layer_list() -> void:
|
|||
|
||||
func update_dimensions_label() -> void:
|
||||
if _preview_images.size() > 0:
|
||||
var new_size: Vector2i = _preview_images[0].image.get_size() * (Export.resize / 100.0)
|
||||
var new_size: Vector2 = _preview_images[0].image.get_size() * (Export.resize / 100.0)
|
||||
dimension_label.text = str(new_size.x, "×", new_size.y)
|
||||
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project := Global.current_project) -> void:
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
var params := {
|
||||
"red": red, "blue": blue, "green": green, "alpha": alpha, "selection": selection_tex
|
||||
|
|
|
@ -29,8 +29,7 @@ func commit_action(cel: Image, project := Global.current_project) -> void:
|
|||
var offset_y := animate_panel.get_animated_value(commit_idx, Animate.OFFSET_Y)
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
var params := {
|
||||
"offset": Vector2(offset_x, offset_y), "shadow_color": color, "selection": selection_tex
|
||||
|
|
|
@ -58,8 +58,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project := Global.current_project) -> void:
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
var dither_texture := selected_dither_matrix.texture
|
||||
var gradient := gradient_edit.gradient
|
||||
|
|
|
@ -13,8 +13,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project := Global.current_project) -> void:
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
var params := {"selection": selection_tex, "gradient_map": $VBoxContainer/GradientEdit.texture}
|
||||
|
||||
|
|
|
@ -30,8 +30,7 @@ func commit_action(cel: Image, project := Global.current_project) -> void:
|
|||
var val = animate_panel.get_animated_value(commit_idx, Animate.VALUE) / 100
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
var params := {"hue": hue, "saturation": sat, "value": val, "selection": selection_tex}
|
||||
if !has_been_confirmed:
|
||||
|
|
|
@ -18,8 +18,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project := Global.current_project) -> void:
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
var params := {
|
||||
"red": red, "blue": blue, "green": green, "alpha": alpha, "selection": selection_tex
|
||||
|
|
|
@ -34,8 +34,7 @@ func commit_action(cel: Image, project := Global.current_project) -> void:
|
|||
var offset := Vector2(offset_x, offset_y)
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
var params := {"offset": offset, "wrap_around": wrap_around, "selection": selection_tex}
|
||||
if !has_been_confirmed:
|
||||
|
|
|
@ -25,8 +25,7 @@ func commit_action(cel: Image, project := Global.current_project) -> void:
|
|||
var anim_thickness := animate_panel.get_animated_value(commit_idx, Animate.THICKNESS)
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
var params := {
|
||||
"color": color,
|
||||
|
|
|
@ -13,8 +13,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project := Global.current_project) -> void:
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
if not is_instance_valid(Palettes.current_palette):
|
||||
return
|
||||
|
|
|
@ -14,8 +14,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project := Global.current_project) -> void:
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
var params := {"pixel_size": pixel_size, "selection": selection_tex}
|
||||
if !has_been_confirmed:
|
||||
|
|
|
@ -15,8 +15,7 @@ func _ready() -> void:
|
|||
func commit_action(cel: Image, project := Global.current_project) -> void:
|
||||
var selection_tex: ImageTexture
|
||||
if selection_checkbox.button_pressed and project.has_selection:
|
||||
var selection := project.selection_map.return_cropped_copy(project.size)
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
selection_tex = ImageTexture.create_from_image(project.selection_map)
|
||||
|
||||
var params := {"colors": levels, "dither_intensity": dither, "selection": selection_tex}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ func commit_action(cel: Image, _project := Global.current_project) -> void:
|
|||
var image := Image.new()
|
||||
image.copy_from(cel)
|
||||
if _project.has_selection and selection_checkbox.button_pressed:
|
||||
var selection := _project.selection_map.return_cropped_copy(_project.size)
|
||||
var selection := _project.selection_map
|
||||
selection_tex = ImageTexture.create_from_image(selection)
|
||||
|
||||
if !_type_is_shader():
|
||||
|
|
Loading…
Add table
Reference in a new issue