mirror of
https://github.com/Relintai/draw_gd.git
synced 2025-04-30 10:57:56 +02:00
Fixed image effects.
This commit is contained in:
parent
548c78d023
commit
c4f8224f40
@ -1,12 +1,9 @@
|
|||||||
tool
|
tool
|
||||||
extends Reference
|
extends Reference
|
||||||
|
|
||||||
var DrawGD : Node = null
|
|
||||||
|
|
||||||
enum GradientDirection {TOP, BOTTOM, LEFT, RIGHT}
|
enum GradientDirection {TOP, BOTTOM, LEFT, RIGHT}
|
||||||
|
|
||||||
|
static func scale3X(sprite : Image, tol : float = 50) -> Image:
|
||||||
func scale3X(sprite : Image, tol : float = 50) -> Image:
|
|
||||||
var scaled = Image.new()
|
var scaled = Image.new()
|
||||||
scaled.create(sprite.get_width()*3, sprite.get_height()*3, false, Image.FORMAT_RGBA8)
|
scaled.create(sprite.get_width()*3, sprite.get_height()*3, false, Image.FORMAT_RGBA8)
|
||||||
scaled.lock()
|
scaled.lock()
|
||||||
@ -178,7 +175,7 @@ func rotxel(sprite : Image, angle : float) -> void:
|
|||||||
aux.unlock()
|
aux.unlock()
|
||||||
|
|
||||||
|
|
||||||
func fake_rotsprite(sprite : Image, angle : float) -> void:
|
static func fake_rotsprite(sprite : Image, angle : float) -> void:
|
||||||
sprite.copy_from(scale3X(sprite))
|
sprite.copy_from(scale3X(sprite))
|
||||||
nn_rotate(sprite,angle)
|
nn_rotate(sprite,angle)
|
||||||
# warning-ignore:integer_division
|
# warning-ignore:integer_division
|
||||||
@ -186,7 +183,7 @@ func fake_rotsprite(sprite : Image, angle : float) -> void:
|
|||||||
sprite.resize(sprite.get_width() / 3, sprite.get_height() / 3, 0)
|
sprite.resize(sprite.get_width() / 3, sprite.get_height() / 3, 0)
|
||||||
|
|
||||||
|
|
||||||
func nn_rotate(sprite : Image, angle : float) -> void:
|
static func nn_rotate(sprite : Image, angle : float) -> void:
|
||||||
var aux : Image = Image.new()
|
var aux : Image = Image.new()
|
||||||
aux.copy_from(sprite)
|
aux.copy_from(sprite)
|
||||||
sprite.lock()
|
sprite.lock()
|
||||||
@ -208,23 +205,24 @@ func nn_rotate(sprite : Image, angle : float) -> void:
|
|||||||
aux.unlock()
|
aux.unlock()
|
||||||
|
|
||||||
|
|
||||||
func similarColors(c1 : Color, c2 : Color, tol : float = 100) -> bool:
|
static func similarColors(c1 : Color, c2 : Color, tol : float = 100) -> bool:
|
||||||
var dist = colorDistance(c1, c2)
|
var dist = colorDistance(c1, c2)
|
||||||
return dist <= tol
|
return dist <= tol
|
||||||
|
|
||||||
|
|
||||||
func colorDistance(c1 : Color, c2 : Color) -> float:
|
static func colorDistance(c1 : Color, c2 : Color) -> float:
|
||||||
return sqrt(pow((c1.r - c2.r)*255, 2) + pow((c1.g - c2.g)*255, 2)
|
return sqrt(pow((c1.r - c2.r)*255, 2) + pow((c1.g - c2.g)*255, 2)
|
||||||
+ pow((c1.b - c2.b)*255, 2) + pow((c1.a - c2.a)*255, 2))
|
+ pow((c1.b - c2.b)*255, 2) + pow((c1.a - c2.a)*255, 2))
|
||||||
|
|
||||||
# Image effects
|
# Image effects
|
||||||
|
|
||||||
func scale_image(width : int, height : int, interpolation : int) -> void:
|
static func scale_image(DrawGD, width : int, height : int, interpolation : int) -> void:
|
||||||
DrawGD.current_project.undos += 1
|
DrawGD.current_project.undos += 1
|
||||||
DrawGD.current_project.undo_redo.create_action("Scale")
|
DrawGD.current_project.undo_redo.create_action("Scale")
|
||||||
DrawGD.current_project.undo_redo.add_do_property(DrawGD.current_project, "size", Vector2(width, height).floor())
|
DrawGD.current_project.undo_redo.add_do_property(DrawGD.current_project, "size", Vector2(width, height).floor())
|
||||||
|
|
||||||
for f in DrawGD.current_project.frames:
|
var f = DrawGD.current_project.frames
|
||||||
|
|
||||||
for i in range(f.cels.size() - 1, -1, -1):
|
for i in range(f.cels.size() - 1, -1, -1):
|
||||||
var sprite := Image.new()
|
var sprite := Image.new()
|
||||||
sprite.copy_from(f.cels[i].image)
|
sprite.copy_from(f.cels[i].image)
|
||||||
@ -245,11 +243,11 @@ func scale_image(width : int, height : int, interpolation : int) -> void:
|
|||||||
DrawGD.current_project.undo_redo.commit_action()
|
DrawGD.current_project.undo_redo.commit_action()
|
||||||
|
|
||||||
|
|
||||||
func crop_image(image : Image) -> void:
|
static func crop_image(DrawGD, image : Image) -> void:
|
||||||
# Use first cel as a starting rectangle
|
# Use first cel as a starting rectangle
|
||||||
var used_rect : Rect2 = image.get_used_rect()
|
var used_rect : Rect2 = image.get_used_rect()
|
||||||
|
|
||||||
for f in DrawGD.current_project.frames:
|
var f = DrawGD.current_project.frames
|
||||||
# However, if first cel is empty, loop through all cels until we find one that isn't
|
# However, if first cel is empty, loop through all cels until we find one that isn't
|
||||||
for cel in f.cels:
|
for cel in f.cels:
|
||||||
if used_rect != Rect2(0, 0, 0, 0):
|
if used_rect != Rect2(0, 0, 0, 0):
|
||||||
@ -272,7 +270,7 @@ func crop_image(image : Image) -> void:
|
|||||||
DrawGD.current_project.undos += 1
|
DrawGD.current_project.undos += 1
|
||||||
DrawGD.current_project.undo_redo.create_action("Scale")
|
DrawGD.current_project.undo_redo.create_action("Scale")
|
||||||
DrawGD.current_project.undo_redo.add_do_property(DrawGD.current_project, "size", Vector2(width, height).floor())
|
DrawGD.current_project.undo_redo.add_do_property(DrawGD.current_project, "size", Vector2(width, height).floor())
|
||||||
for f in DrawGD.current_project.frames:
|
|
||||||
# Loop through all the layers to crop them
|
# Loop through all the layers to crop them
|
||||||
for j in range(DrawGD.current_project.layers.size() - 1, -1, -1):
|
for j in range(DrawGD.current_project.layers.size() - 1, -1, -1):
|
||||||
var sprite : Image = f.cels[j].image.get_rect(used_rect)
|
var sprite : Image = f.cels[j].image.get_rect(used_rect)
|
||||||
@ -285,11 +283,11 @@ func crop_image(image : Image) -> void:
|
|||||||
DrawGD.current_project.undo_redo.commit_action()
|
DrawGD.current_project.undo_redo.commit_action()
|
||||||
|
|
||||||
|
|
||||||
func resize_canvas(width : int, height : int, offset_x : int, offset_y : int) -> void:
|
static func resize_canvas(DrawGD, width : int, height : int, offset_x : int, offset_y : int) -> void:
|
||||||
DrawGD.current_project.undos += 1
|
DrawGD.current_project.undos += 1
|
||||||
DrawGD.current_project.undo_redo.create_action("Scale")
|
DrawGD.current_project.undo_redo.create_action("Scale")
|
||||||
DrawGD.current_project.undo_redo.add_do_property(DrawGD.current_project, "size", Vector2(width, height).floor())
|
DrawGD.current_project.undo_redo.add_do_property(DrawGD.current_project, "size", Vector2(width, height).floor())
|
||||||
for f in DrawGD.current_project.frames:
|
var f = DrawGD.current_project.frames
|
||||||
for c in f.cels:
|
for c in f.cels:
|
||||||
var sprite := Image.new()
|
var sprite := Image.new()
|
||||||
sprite.create(width, height, false, Image.FORMAT_RGBA8)
|
sprite.create(width, height, false, Image.FORMAT_RGBA8)
|
||||||
@ -303,7 +301,7 @@ func resize_canvas(width : int, height : int, offset_x : int, offset_y : int) ->
|
|||||||
DrawGD.current_project.undo_redo.commit_action()
|
DrawGD.current_project.undo_redo.commit_action()
|
||||||
|
|
||||||
|
|
||||||
func invert_image_colors(image : Image, pixels : Array, red := true, green := true, blue := true, alpha := false) -> void:
|
static func invert_image_colors(image : Image, pixels : Array, red := true, green := true, blue := true, alpha := false) -> void:
|
||||||
image.lock()
|
image.lock()
|
||||||
for i in pixels:
|
for i in pixels:
|
||||||
var px_color := image.get_pixelv(i)
|
var px_color := image.get_pixelv(i)
|
||||||
@ -319,7 +317,7 @@ func invert_image_colors(image : Image, pixels : Array, red := true, green := tr
|
|||||||
image.set_pixelv(i, px_color)
|
image.set_pixelv(i, px_color)
|
||||||
|
|
||||||
|
|
||||||
func desaturate_image(image : Image, pixels : Array, red := true, green := true, blue := true, alpha := false) -> void:
|
static func desaturate_image(image : Image, pixels : Array, red := true, green := true, blue := true, alpha := false) -> void:
|
||||||
image.lock()
|
image.lock()
|
||||||
for i in pixels:
|
for i in pixels:
|
||||||
var px_color := image.get_pixelv(i)
|
var px_color := image.get_pixelv(i)
|
||||||
@ -336,7 +334,7 @@ func desaturate_image(image : Image, pixels : Array, red := true, green := true,
|
|||||||
image.set_pixelv(i, px_color)
|
image.set_pixelv(i, px_color)
|
||||||
|
|
||||||
|
|
||||||
func generate_outline(image : Image, pixels : Array, outline_color : Color, thickness : int, diagonal : bool, inside_image : bool) -> void:
|
static func generate_outline(DrawGD, image : Image, pixels : Array, outline_color : Color, thickness : int, diagonal : bool, inside_image : bool) -> void:
|
||||||
if image.is_invisible():
|
if image.is_invisible():
|
||||||
return
|
return
|
||||||
var new_image := Image.new()
|
var new_image := Image.new()
|
||||||
@ -471,7 +469,7 @@ func generate_outline(image : Image, pixels : Array, outline_color : Color, thic
|
|||||||
image.copy_from(new_image)
|
image.copy_from(new_image)
|
||||||
|
|
||||||
|
|
||||||
func adjust_hsv(img: Image, delta_h : float, delta_s : float, delta_v : float, pixels : Array) -> void:
|
static func adjust_hsv(img: Image, delta_h : float, delta_s : float, delta_v : float, pixels : Array) -> void:
|
||||||
img.lock()
|
img.lock()
|
||||||
for i in pixels:
|
for i in pixels:
|
||||||
var c : Color = img.get_pixelv(i)
|
var c : Color = img.get_pixelv(i)
|
||||||
@ -506,7 +504,12 @@ func adjust_hsv(img: Image, delta_h : float, delta_s : float, delta_v : float, p
|
|||||||
img.unlock()
|
img.unlock()
|
||||||
|
|
||||||
|
|
||||||
func generate_gradient(image : Image, colors : Array, steps := 2, direction : int = GradientDirection.TOP, pixels = DrawGD.current_project.selected_pixels) -> void:
|
static func generate_gradient(DrawGD, image : Image, colors : Array, steps := 2, direction : int = GradientDirection.TOP, pixels = null) -> void:
|
||||||
|
|
||||||
|
if !pixels:
|
||||||
|
pixels = DrawGD.current_project.selected_pixels
|
||||||
|
|
||||||
|
|
||||||
if colors.size() < 2:
|
if colors.size() < 2:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ class_name ImageEffect extends AcceptDialog
|
|||||||
|
|
||||||
var Export = preload("res://addons/draw_gd/src/Autoload/Export.gd")
|
var Export = preload("res://addons/draw_gd/src/Autoload/Export.gd")
|
||||||
|
|
||||||
enum {CEL, FRAME, ALL_FRAMES, ALL_PROJECTS}
|
enum {CEL, FRAME, ALL_PROJECTS}
|
||||||
|
|
||||||
var affect : int = CEL
|
var affect : int = CEL
|
||||||
var pixels := []
|
var pixels := []
|
||||||
@ -43,9 +43,11 @@ func _enter_tree() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _about_to_show() -> void:
|
func _about_to_show() -> void:
|
||||||
current_cel = DrawGD.current_project.frames[DrawGD.current_project.current_frame].cels[DrawGD.current_project.current_layer].image
|
current_cel = DrawGD.current_project.frames.cels[DrawGD.current_project.current_layer].image
|
||||||
current_frame.fill(Color(0, 0, 0, 0))
|
current_frame.fill(Color(0, 0, 0, 0))
|
||||||
var frame = DrawGD.current_project.frames[DrawGD.current_project.current_frame]
|
|
||||||
|
var frame = DrawGD.current_project.frames
|
||||||
|
|
||||||
Export.blend_layers(current_frame, frame)
|
Export.blend_layers(current_frame, frame)
|
||||||
if selection_checkbox:
|
if selection_checkbox:
|
||||||
_on_SelectionCheckBox_toggled(selection_checkbox.pressed)
|
_on_SelectionCheckBox_toggled(selection_checkbox.pressed)
|
||||||
@ -65,13 +67,6 @@ func _confirmed() -> void:
|
|||||||
commit_action(cel.image, pixels)
|
commit_action(cel.image, pixels)
|
||||||
DrawGD.canvas.handle_redo("Draw", DrawGD.current_project, -1)
|
DrawGD.canvas.handle_redo("Draw", DrawGD.current_project, -1)
|
||||||
|
|
||||||
elif affect == ALL_FRAMES:
|
|
||||||
DrawGD.canvas.handle_undo("Draw", DrawGD.current_project, -1, -1)
|
|
||||||
for frame in DrawGD.current_project.frames:
|
|
||||||
for cel in frame.cels:
|
|
||||||
commit_action(cel.image, pixels)
|
|
||||||
DrawGD.canvas.handle_redo("Draw", DrawGD.current_project, -1, -1)
|
|
||||||
|
|
||||||
elif affect == ALL_PROJECTS:
|
elif affect == ALL_PROJECTS:
|
||||||
for project in DrawGD.projects:
|
for project in DrawGD.projects:
|
||||||
var _pixels := []
|
var _pixels := []
|
||||||
@ -83,9 +78,11 @@ func _confirmed() -> void:
|
|||||||
_pixels.append(Vector2(x, y))
|
_pixels.append(Vector2(x, y))
|
||||||
|
|
||||||
DrawGD.canvas.handle_undo("Draw", project, -1, -1)
|
DrawGD.canvas.handle_undo("Draw", project, -1, -1)
|
||||||
for frame in project.frames:
|
var frame = project.frames
|
||||||
|
|
||||||
for cel in frame.cels:
|
for cel in frame.cels:
|
||||||
commit_action(cel.image, _pixels, project)
|
commit_action(cel.image, _pixels, project)
|
||||||
|
|
||||||
DrawGD.canvas.handle_redo("Draw", project, -1, -1)
|
DrawGD.canvas.handle_redo("Draw", project, -1, -1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,11 +182,12 @@ func commit_undo(action : String, undo_data : Dictionary) -> void:
|
|||||||
project.undo_redo.add_do_property(project, "selected_rect", redo_data["selected_rect"])
|
project.undo_redo.add_do_property(project, "selected_rect", redo_data["selected_rect"])
|
||||||
project.undo_redo.add_undo_property(project, "selected_rect", undo_data["selected_rect"])
|
project.undo_redo.add_undo_property(project, "selected_rect", undo_data["selected_rect"])
|
||||||
if "image_data" in undo_data:
|
if "image_data" in undo_data:
|
||||||
var image : Image = project.frames[project.current_frame].cels[project.current_layer].image
|
var image : Image = project.frames.cels[project.current_layer].image
|
||||||
project.undo_redo.add_do_property(image, "data", redo_data["image_data"])
|
project.undo_redo.add_do_property(image, "data", redo_data["image_data"])
|
||||||
project.undo_redo.add_undo_property(image, "data", undo_data["image_data"])
|
project.undo_redo.add_undo_property(image, "data", undo_data["image_data"])
|
||||||
project.undo_redo.add_do_method(DrawGD, "redo", project.current_frame, project.current_layer)
|
|
||||||
project.undo_redo.add_undo_method(DrawGD, "undo", project.current_frame, project.current_layer)
|
project.undo_redo.add_do_method(DrawGD, "redo", 0, project.current_layer)
|
||||||
|
project.undo_redo.add_undo_method(DrawGD, "undo", 0, project.current_layer)
|
||||||
project.undo_redo.commit_action()
|
project.undo_redo.commit_action()
|
||||||
|
|
||||||
|
|
||||||
@ -195,7 +196,7 @@ func _get_undo_data(undo_image : bool) -> Dictionary:
|
|||||||
var project = DrawGD.current_project
|
var project = DrawGD.current_project
|
||||||
data["selected_rect"] = DrawGD.current_project.selected_rect
|
data["selected_rect"] = DrawGD.current_project.selected_rect
|
||||||
if undo_image:
|
if undo_image:
|
||||||
var image : Image = project.frames[project.current_frame].cels[project.current_layer].image
|
var image : Image = project.frames.cels[project.current_layer].image
|
||||||
image.unlock()
|
image.unlock()
|
||||||
data["image_data"] = image.data
|
data["image_data"] = image.data
|
||||||
image.lock()
|
image.lock()
|
||||||
|
@ -123,23 +123,18 @@ func handle_undo(action : String, project : Project = DrawGD.current_project, la
|
|||||||
|
|
||||||
if layer_index <= -2:
|
if layer_index <= -2:
|
||||||
layer_index = project.current_layer
|
layer_index = project.current_layer
|
||||||
if frame_index <= -2:
|
|
||||||
frame_index = project.current_frame
|
|
||||||
|
|
||||||
var cels := []
|
var cels := []
|
||||||
var frames := []
|
|
||||||
var layers := []
|
var layers := []
|
||||||
if frame_index == -1:
|
|
||||||
frames = project.frames
|
var frames = project.frames
|
||||||
else:
|
|
||||||
frames.append(project.frames[frame_index])
|
|
||||||
|
|
||||||
if layer_index == -1:
|
if layer_index == -1:
|
||||||
layers = project.layers
|
layers = project.layers
|
||||||
else:
|
else:
|
||||||
layers.append(project.layers[layer_index])
|
layers.append(project.layers[layer_index])
|
||||||
|
|
||||||
for f in frames:
|
var f = frames
|
||||||
for l in layers:
|
for l in layers:
|
||||||
var index = project.layers.find(l)
|
var index = project.layers.find(l)
|
||||||
cels.append(f.cels[index])
|
cels.append(f.cels[index])
|
||||||
@ -164,23 +159,18 @@ func handle_redo(_action : String, project : Project = DrawGD.current_project, l
|
|||||||
|
|
||||||
if layer_index <= -2:
|
if layer_index <= -2:
|
||||||
layer_index = project.current_layer
|
layer_index = project.current_layer
|
||||||
if frame_index <= -2:
|
|
||||||
frame_index = project.current_frame
|
|
||||||
|
|
||||||
var cels := []
|
var cels := []
|
||||||
var frames := []
|
|
||||||
var layers := []
|
var layers := []
|
||||||
if frame_index == -1:
|
|
||||||
frames = project.frames
|
var frames = project.frames
|
||||||
else:
|
|
||||||
frames.append(project.frames[frame_index])
|
|
||||||
|
|
||||||
if layer_index == -1:
|
if layer_index == -1:
|
||||||
layers = project.layers
|
layers = project.layers
|
||||||
else:
|
else:
|
||||||
layers.append(project.layers[layer_index])
|
layers.append(project.layers[layer_index])
|
||||||
|
|
||||||
for f in frames:
|
var f = frames
|
||||||
for l in layers:
|
for l in layers:
|
||||||
var index = project.layers.find(l)
|
var index = project.layers.find(l)
|
||||||
cels.append(f.cels[index])
|
cels.append(f.cels[index])
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/DesaturateDialog.gd" type="Script" id=1]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/DesaturateDialog.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="DesaturateDialog" type="ConfirmationDialog"]
|
[node name="DesaturateDialog" type="ConfirmationDialog"]
|
||||||
margin_right = 200.0
|
margin_right = 200.0
|
||||||
margin_bottom = 70.0
|
margin_bottom = 70.0
|
||||||
@ -21,7 +20,8 @@ __meta__ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[node name="Preview" type="TextureRect" parent="VBoxContainer"]
|
[node name="Preview" type="TextureRect" parent="VBoxContainer"]
|
||||||
margin_right = 263.0
|
margin_left = 31.0
|
||||||
|
margin_right = 231.0
|
||||||
margin_bottom = 200.0
|
margin_bottom = 200.0
|
||||||
rect_min_size = Vector2( 200, 200 )
|
rect_min_size = Vector2( 200, 200 )
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
@ -95,8 +95,9 @@ margin_right = 263.0
|
|||||||
margin_bottom = 24.0
|
margin_bottom = 24.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
text = "Current cel"
|
text = "Current cel"
|
||||||
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ]
|
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All projects", null, false, 3, null ]
|
||||||
selected = 0
|
selected = 0
|
||||||
|
|
||||||
[connection signal="toggled" from="VBoxContainer/RGBAContainer/RButton" to="." method="_on_RButton_toggled"]
|
[connection signal="toggled" from="VBoxContainer/RGBAContainer/RButton" to="." method="_on_RButton_toggled"]
|
||||||
[connection signal="toggled" from="VBoxContainer/RGBAContainer/GButton" to="." method="_on_GButton_toggled"]
|
[connection signal="toggled" from="VBoxContainer/RGBAContainer/GButton" to="." method="_on_GButton_toggled"]
|
||||||
[connection signal="toggled" from="VBoxContainer/RGBAContainer/BButton" to="." method="_on_BButton_toggled"]
|
[connection signal="toggled" from="VBoxContainer/RGBAContainer/BButton" to="." method="_on_BButton_toggled"]
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/FlipImageDialog.gd" type="Script" id=1]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/FlipImageDialog.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="FlipImageDialog" type="ConfirmationDialog"]
|
[node name="FlipImageDialog" type="ConfirmationDialog"]
|
||||||
margin_right = 283.0
|
margin_right = 283.0
|
||||||
margin_bottom = 300.0
|
margin_bottom = 300.0
|
||||||
@ -67,7 +66,8 @@ margin_right = 267.0
|
|||||||
margin_bottom = 52.0
|
margin_bottom = 52.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
text = "Current cel"
|
text = "Current cel"
|
||||||
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ]
|
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All projects", null, false, 3, null ]
|
||||||
selected = 0
|
selected = 0
|
||||||
|
|
||||||
[connection signal="toggled" from="VBoxContainer/OptionsContainer/FlipHorizontal" to="." method="_on_FlipHorizontal_toggled"]
|
[connection signal="toggled" from="VBoxContainer/OptionsContainer/FlipHorizontal" to="." method="_on_FlipHorizontal_toggled"]
|
||||||
[connection signal="toggled" from="VBoxContainer/OptionsContainer/FlipVertical" to="." method="_on_FlipVertical_toggled"]
|
[connection signal="toggled" from="VBoxContainer/OptionsContainer/FlipVertical" to="." method="_on_FlipVertical_toggled"]
|
||||||
|
@ -21,7 +21,7 @@ func set_nodes() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func commit_action(_cel : Image, _pixels : Array, _project : Project = DrawGD.current_project) -> void:
|
func commit_action(_cel : Image, _pixels : Array, _project : Project = DrawGD.current_project) -> void:
|
||||||
DrawingAlgos.generate_gradient(_cel, [color1.color, color2.color], steps.value, direction.selected, _pixels)
|
DrawingAlgos.generate_gradient(DrawGD, _cel, [color1.color, color2.color], steps.value, direction.selected, _pixels)
|
||||||
|
|
||||||
|
|
||||||
func _on_ColorPickerButton_color_changed(_color : Color) -> void:
|
func _on_ColorPickerButton_color_changed(_color : Color) -> void:
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/GradientDialog.gd" type="Script" id=1]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/GradientDialog.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="GradientDialog" type="ConfirmationDialog"]
|
[node name="GradientDialog" type="ConfirmationDialog"]
|
||||||
margin_right = 200.0
|
margin_right = 200.0
|
||||||
margin_bottom = 196.0
|
margin_bottom = 196.0
|
||||||
@ -115,8 +114,9 @@ margin_right = 285.0
|
|||||||
margin_bottom = 100.0
|
margin_bottom = 100.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
text = "Current cel"
|
text = "Current cel"
|
||||||
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ]
|
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All projects", null, false, 3, null ]
|
||||||
selected = 0
|
selected = 0
|
||||||
|
|
||||||
[connection signal="color_changed" from="VBoxContainer/OptionsContainer/ColorsContainer/ColorPickerButton" to="." method="_on_ColorPickerButton_color_changed"]
|
[connection signal="color_changed" from="VBoxContainer/OptionsContainer/ColorsContainer/ColorPickerButton" to="." method="_on_ColorPickerButton_color_changed"]
|
||||||
[connection signal="color_changed" from="VBoxContainer/OptionsContainer/ColorsContainer/ColorPickerButton2" to="." method="_on_ColorPickerButton2_color_changed"]
|
[connection signal="color_changed" from="VBoxContainer/OptionsContainer/ColorsContainer/ColorPickerButton2" to="." method="_on_ColorPickerButton2_color_changed"]
|
||||||
[connection signal="value_changed" from="VBoxContainer/OptionsContainer/StepSpinBox" to="." method="_on_StepSpinBox_value_changed"]
|
[connection signal="value_changed" from="VBoxContainer/OptionsContainer/StepSpinBox" to="." method="_on_StepSpinBox_value_changed"]
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/HSVDialog.gd" type="Script" id=1]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/HSVDialog.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="HSVDialog" type="ConfirmationDialog"]
|
[node name="HSVDialog" type="ConfirmationDialog"]
|
||||||
margin_left = 1.0
|
margin_left = 1.0
|
||||||
margin_top = -1.0
|
margin_top = -1.0
|
||||||
@ -23,7 +22,8 @@ __meta__ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[node name="Preview" type="TextureRect" parent="VBoxContainer"]
|
[node name="Preview" type="TextureRect" parent="VBoxContainer"]
|
||||||
margin_right = 447.0
|
margin_left = 123.0
|
||||||
|
margin_right = 323.0
|
||||||
margin_bottom = 200.0
|
margin_bottom = 200.0
|
||||||
rect_min_size = Vector2( 200, 200 )
|
rect_min_size = Vector2( 200, 200 )
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
@ -146,8 +146,9 @@ margin_right = 263.0
|
|||||||
margin_bottom = 24.0
|
margin_bottom = 24.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
text = "Current cel"
|
text = "Current cel"
|
||||||
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ]
|
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All projects", null, false, 3, null ]
|
||||||
selected = 0
|
selected = 0
|
||||||
|
|
||||||
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/Sliders/Hue" to="." method="_on_Hue_value_changed"]
|
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/Sliders/Hue" to="." method="_on_Hue_value_changed"]
|
||||||
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/Sliders/Saturation" to="." method="_on_Saturation_value_changed"]
|
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/Sliders/Saturation" to="." method="_on_Saturation_value_changed"]
|
||||||
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/Sliders/Value" to="." method="_on_Value_value_changed"]
|
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/Sliders/Value" to="." method="_on_Value_value_changed"]
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/OutlineDialog.tscn" type="PackedScene" id=13]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/OutlineDialog.tscn" type="PackedScene" id=13]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/ScaleImage.tscn" type="PackedScene" id=14]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/ScaleImage.tscn" type="PackedScene" id=14]
|
||||||
|
|
||||||
|
|
||||||
[node name="ImageEffects" type="Control"]
|
[node name="ImageEffects" type="Control"]
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/InvertColorsDialog.gd" type="Script" id=1]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/InvertColorsDialog.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="InvertColorsDialog" type="ConfirmationDialog"]
|
[node name="InvertColorsDialog" type="ConfirmationDialog"]
|
||||||
margin_right = 200.0
|
margin_right = 200.0
|
||||||
margin_bottom = 70.0
|
margin_bottom = 70.0
|
||||||
@ -95,8 +94,9 @@ margin_right = 263.0
|
|||||||
margin_bottom = 24.0
|
margin_bottom = 24.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
text = "Current cel"
|
text = "Current cel"
|
||||||
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ]
|
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All projects", null, false, 3, null ]
|
||||||
selected = 0
|
selected = 0
|
||||||
|
|
||||||
[connection signal="toggled" from="VBoxContainer/RGBAContainer/RButton" to="." method="_on_RButton_toggled"]
|
[connection signal="toggled" from="VBoxContainer/RGBAContainer/RButton" to="." method="_on_RButton_toggled"]
|
||||||
[connection signal="toggled" from="VBoxContainer/RGBAContainer/GButton" to="." method="_on_GButton_toggled"]
|
[connection signal="toggled" from="VBoxContainer/RGBAContainer/GButton" to="." method="_on_GButton_toggled"]
|
||||||
[connection signal="toggled" from="VBoxContainer/RGBAContainer/BButton" to="." method="_on_BButton_toggled"]
|
[connection signal="toggled" from="VBoxContainer/RGBAContainer/BButton" to="." method="_on_BButton_toggled"]
|
||||||
|
@ -23,7 +23,7 @@ func set_nodes() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func commit_action(_cel : Image, _pixels : Array, _project : Project = DrawGD.current_project) -> void:
|
func commit_action(_cel : Image, _pixels : Array, _project : Project = DrawGD.current_project) -> void:
|
||||||
DrawingAlgos.generate_outline(_cel, _pixels, color, thickness, diagonal, inside_image)
|
DrawingAlgos.generate_outline(DrawGD, _cel, _pixels, color, thickness, diagonal, inside_image)
|
||||||
|
|
||||||
|
|
||||||
func _on_ThickValue_value_changed(value : int) -> void:
|
func _on_ThickValue_value_changed(value : int) -> void:
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/OutlineDialog.gd" type="Script" id=1]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/OutlineDialog.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="OutlineDialog" type="ConfirmationDialog"]
|
[node name="OutlineDialog" type="ConfirmationDialog"]
|
||||||
margin_right = 200.0
|
margin_right = 200.0
|
||||||
margin_bottom = 70.0
|
margin_bottom = 70.0
|
||||||
@ -24,7 +23,8 @@ __meta__ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[node name="Preview" type="TextureRect" parent="VBoxContainer"]
|
[node name="Preview" type="TextureRect" parent="VBoxContainer"]
|
||||||
margin_right = 312.0
|
margin_left = 56.0
|
||||||
|
margin_right = 256.0
|
||||||
margin_bottom = 200.0
|
margin_bottom = 200.0
|
||||||
rect_min_size = Vector2( 200, 200 )
|
rect_min_size = Vector2( 200, 200 )
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
@ -100,12 +100,15 @@ pressed = true
|
|||||||
text = "Only affect selection"
|
text = "Only affect selection"
|
||||||
|
|
||||||
[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"]
|
[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"]
|
||||||
margin_right = 29.0
|
margin_left = 164.0
|
||||||
margin_bottom = 20.0
|
margin_top = 80.0
|
||||||
|
margin_right = 312.0
|
||||||
|
margin_bottom = 104.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
text = "Current cel"
|
text = "Current cel"
|
||||||
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ]
|
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All projects", null, false, 3, null ]
|
||||||
selected = 0
|
selected = 0
|
||||||
|
|
||||||
[connection signal="value_changed" from="VBoxContainer/OptionsContainer/ThickValue" to="." method="_on_ThickValue_value_changed"]
|
[connection signal="value_changed" from="VBoxContainer/OptionsContainer/ThickValue" to="." method="_on_ThickValue_value_changed"]
|
||||||
[connection signal="color_changed" from="VBoxContainer/OptionsContainer/OutlineColor" to="." method="_on_OutlineColor_color_changed"]
|
[connection signal="color_changed" from="VBoxContainer/OptionsContainer/OutlineColor" to="." method="_on_OutlineColor_color_changed"]
|
||||||
[connection signal="toggled" from="VBoxContainer/OptionsContainer/DiagonalCheckBox" to="." method="_on_DiagonalCheckBox_toggled"]
|
[connection signal="toggled" from="VBoxContainer/OptionsContainer/DiagonalCheckBox" to="." method="_on_DiagonalCheckBox_toggled"]
|
||||||
|
@ -18,6 +18,14 @@ onready var preview_rect : TextureRect = $VBoxContainer/Preview
|
|||||||
|
|
||||||
var DrawGD : Node = null
|
var DrawGD : Node = null
|
||||||
|
|
||||||
|
func _enter_tree() -> void:
|
||||||
|
var n : Node = get_parent()
|
||||||
|
while n:
|
||||||
|
if n.name == "DrawGDSingleton":
|
||||||
|
DrawGD = n
|
||||||
|
break
|
||||||
|
n = n.get_parent()
|
||||||
|
|
||||||
func _on_ResizeCanvas_about_to_show() -> void:
|
func _on_ResizeCanvas_about_to_show() -> void:
|
||||||
if first_time:
|
if first_time:
|
||||||
width_spinbox.value = DrawGD.current_project.size.x
|
width_spinbox.value = DrawGD.current_project.size.x
|
||||||
@ -27,7 +35,7 @@ func _on_ResizeCanvas_about_to_show() -> void:
|
|||||||
image.create(DrawGD.current_project.size.x, DrawGD.current_project.size.y, false, Image.FORMAT_RGBA8)
|
image.create(DrawGD.current_project.size.x, DrawGD.current_project.size.y, false, Image.FORMAT_RGBA8)
|
||||||
image.lock()
|
image.lock()
|
||||||
var layer_i := 0
|
var layer_i := 0
|
||||||
for cel in DrawGD.current_project.frames[DrawGD.current_project.current_frame].cels:
|
for cel in DrawGD.current_project.frames.cels:
|
||||||
if DrawGD.current_project.layers[layer_i].visible:
|
if DrawGD.current_project.layers[layer_i].visible:
|
||||||
var cel_image := Image.new()
|
var cel_image := Image.new()
|
||||||
cel_image.copy_from(cel.image)
|
cel_image.copy_from(cel.image)
|
||||||
@ -46,7 +54,7 @@ func _on_ResizeCanvas_about_to_show() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _on_ResizeCanvas_confirmed() -> void:
|
func _on_ResizeCanvas_confirmed() -> void:
|
||||||
DrawingAlgos.resize_canvas(width, height, offset_x, offset_y)
|
DrawingAlgos.resize_canvas(DrawGD, width, height, offset_x, offset_y)
|
||||||
first_time = false
|
first_time = false
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/ResizeCanvas.gd" type="Script" id=2]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/ResizeCanvas.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="ResizeCanvas" type="ConfirmationDialog"]
|
[node name="ResizeCanvas" type="ConfirmationDialog"]
|
||||||
margin_right = 200.0
|
margin_right = 200.0
|
||||||
margin_bottom = 114.0
|
margin_bottom = 114.0
|
||||||
@ -127,6 +126,7 @@ stretch_mode = 5
|
|||||||
|
|
||||||
[node name="TransparentChecker" parent="VBoxContainer/Preview" instance=ExtResource( 1 )]
|
[node name="TransparentChecker" parent="VBoxContainer/Preview" instance=ExtResource( 1 )]
|
||||||
show_behind_parent = true
|
show_behind_parent = true
|
||||||
|
|
||||||
[connection signal="about_to_show" from="." to="." method="_on_ResizeCanvas_about_to_show"]
|
[connection signal="about_to_show" from="." to="." method="_on_ResizeCanvas_about_to_show"]
|
||||||
[connection signal="confirmed" from="." to="." method="_on_ResizeCanvas_confirmed"]
|
[connection signal="confirmed" from="." to="." method="_on_ResizeCanvas_confirmed"]
|
||||||
[connection signal="popup_hide" from="." to="." method="_on_ResizeCanvas_popup_hide"]
|
[connection signal="popup_hide" from="." to="." method="_on_ResizeCanvas_popup_hide"]
|
||||||
|
@ -7,45 +7,37 @@ onready var type_option_button : OptionButton = $VBoxContainer/HBoxContainer2/Ty
|
|||||||
onready var angle_hslider : HSlider = $VBoxContainer/AngleOptions/AngleHSlider
|
onready var angle_hslider : HSlider = $VBoxContainer/AngleOptions/AngleHSlider
|
||||||
onready var angle_spinbox : SpinBox = $VBoxContainer/AngleOptions/AngleSpinBox
|
onready var angle_spinbox : SpinBox = $VBoxContainer/AngleOptions/AngleSpinBox
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
type_option_button.add_item("Rotxel")
|
type_option_button.add_item("Rotxel")
|
||||||
type_option_button.add_item("Upscale, Rotate and Downscale")
|
type_option_button.add_item("Upscale, Rotate and Downscale")
|
||||||
type_option_button.add_item("Nearest neighbour")
|
type_option_button.add_item("Nearest neighbour")
|
||||||
|
|
||||||
|
|
||||||
func set_nodes() -> void:
|
func set_nodes() -> void:
|
||||||
preview = $VBoxContainer/Preview
|
preview = $VBoxContainer/Preview
|
||||||
|
|
||||||
|
|
||||||
func _about_to_show() -> void:
|
func _about_to_show() -> void:
|
||||||
._about_to_show()
|
._about_to_show()
|
||||||
angle_hslider.value = 0
|
angle_hslider.value = 0
|
||||||
|
|
||||||
|
|
||||||
func commit_action(_cel : Image, _pixels : Array, _project : Project = DrawGD.current_project) -> void:
|
func commit_action(_cel : Image, _pixels : Array, _project : Project = DrawGD.current_project) -> void:
|
||||||
match type_option_button.text:
|
match type_option_button.text:
|
||||||
"Rotxel":
|
"Rotxel":
|
||||||
DrawingAlgos.rotxel(_cel,angle_hslider.value*PI/180)
|
DrawingAlgos.rotxel(_cel, angle_hslider.value * PI/180)
|
||||||
"Nearest neighbour":
|
"Nearest neighbour":
|
||||||
DrawingAlgos.nn_rotate(_cel,angle_hslider.value*PI/180)
|
DrawingAlgos.nn_rotate(_cel, angle_hslider.value*PI/180)
|
||||||
"Upscale, Rotate and Downscale":
|
"Upscale, Rotate and Downscale":
|
||||||
DrawingAlgos.fake_rotsprite(_cel,angle_hslider.value*PI/180)
|
DrawingAlgos.fake_rotsprite(_cel, angle_hslider.value*PI/180)
|
||||||
|
|
||||||
|
|
||||||
func _confirmed() -> void:
|
func _confirmed() -> void:
|
||||||
._confirmed()
|
._confirmed()
|
||||||
angle_hslider.value = 0
|
angle_hslider.value = 0
|
||||||
|
|
||||||
|
|
||||||
func _on_HSlider_value_changed(_value : float) -> void:
|
func _on_HSlider_value_changed(_value : float) -> void:
|
||||||
update_preview()
|
update_preview()
|
||||||
angle_spinbox.value = angle_hslider.value
|
angle_spinbox.value = angle_hslider.value
|
||||||
|
|
||||||
|
|
||||||
func _on_SpinBox_value_changed(_value : float) -> void:
|
func _on_SpinBox_value_changed(_value : float) -> void:
|
||||||
angle_hslider.value = angle_spinbox.value
|
angle_hslider.value = angle_spinbox.value
|
||||||
|
|
||||||
|
|
||||||
func _on_TypeOptionButton_item_selected(_id : int) -> void:
|
func _on_TypeOptionButton_item_selected(_id : int) -> void:
|
||||||
update_preview()
|
update_preview()
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/RotateImage.gd" type="Script" id=1]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/RotateImage.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="RotateImage" type="ConfirmationDialog"]
|
[node name="RotateImage" type="ConfirmationDialog"]
|
||||||
margin_right = 245.0
|
margin_right = 245.0
|
||||||
margin_bottom = 241.0
|
margin_bottom = 241.0
|
||||||
@ -56,6 +55,9 @@ margin_bottom = 20.0
|
|||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
text = "Rotxel"
|
||||||
|
items = [ "Rotxel", null, false, 0, null, "Upscale, Rotate and Downscale", null, false, 1, null, "Nearest neighbour", null, false, 2, null ]
|
||||||
|
selected = 0
|
||||||
|
|
||||||
[node name="AngleOptions" type="HBoxContainer" parent="VBoxContainer"]
|
[node name="AngleOptions" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
margin_top = 228.0
|
margin_top = 228.0
|
||||||
@ -87,6 +89,7 @@ margin_bottom = 24.0
|
|||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
max_value = 359.0
|
max_value = 359.0
|
||||||
suffix = "°"
|
suffix = "°"
|
||||||
|
|
||||||
[connection signal="item_selected" from="VBoxContainer/HBoxContainer2/TypeOptionButton" to="." method="_on_TypeOptionButton_item_selected"]
|
[connection signal="item_selected" from="VBoxContainer/HBoxContainer2/TypeOptionButton" to="." method="_on_TypeOptionButton_item_selected"]
|
||||||
[connection signal="value_changed" from="VBoxContainer/AngleOptions/AngleHSlider" to="." method="_on_HSlider_value_changed"]
|
[connection signal="value_changed" from="VBoxContainer/AngleOptions/AngleHSlider" to="." method="_on_HSlider_value_changed"]
|
||||||
[connection signal="value_changed" from="VBoxContainer/AngleOptions/AngleSpinBox" to="." method="_on_SpinBox_value_changed"]
|
[connection signal="value_changed" from="VBoxContainer/AngleOptions/AngleSpinBox" to="." method="_on_SpinBox_value_changed"]
|
||||||
|
@ -5,11 +5,19 @@ var DrawGD : Node = null
|
|||||||
|
|
||||||
var DrawingAlgos = preload("res://addons/draw_gd/src/Autoload/DrawingAlgos.gd")
|
var DrawingAlgos = preload("res://addons/draw_gd/src/Autoload/DrawingAlgos.gd")
|
||||||
|
|
||||||
|
func _enter_tree():
|
||||||
|
var n : Node = get_parent()
|
||||||
|
while n:
|
||||||
|
if n.name == "DrawGDSingleton":
|
||||||
|
DrawGD = n
|
||||||
|
break
|
||||||
|
n = n.get_parent()
|
||||||
|
|
||||||
func _on_ScaleImage_confirmed() -> void:
|
func _on_ScaleImage_confirmed() -> void:
|
||||||
var width : int = $VBoxContainer/OptionsContainer/WidthValue.value
|
var width : int = $VBoxContainer/OptionsContainer/WidthValue.value
|
||||||
var height : int = $VBoxContainer/OptionsContainer/HeightValue.value
|
var height : int = $VBoxContainer/OptionsContainer/HeightValue.value
|
||||||
var interpolation : int = $VBoxContainer/OptionsContainer/InterpolationType.selected
|
var interpolation : int = $VBoxContainer/OptionsContainer/InterpolationType.selected
|
||||||
DrawingAlgos.scale_image(width, height, interpolation)
|
DrawingAlgos.scale_image(DrawGD, width, height, interpolation)
|
||||||
|
|
||||||
|
|
||||||
func _on_ScaleImage_popup_hide() -> void:
|
func _on_ScaleImage_popup_hide() -> void:
|
||||||
|
@ -301,13 +301,13 @@ func toggle_zen_mode() -> void:
|
|||||||
func image_menu_id_pressed(id : int) -> void:
|
func image_menu_id_pressed(id : int) -> void:
|
||||||
if DrawGD.current_project.layers[DrawGD.current_project.current_layer].locked: # No changes if the layer is locked
|
if DrawGD.current_project.layers[DrawGD.current_project.current_layer].locked: # No changes if the layer is locked
|
||||||
return
|
return
|
||||||
var image : Image = DrawGD.current_project.frames[DrawGD.current_project.current_frame].cels[DrawGD.current_project.current_layer].image
|
var image : Image = DrawGD.current_project.frames.cels[DrawGD.current_project.current_layer].image
|
||||||
match id:
|
match id:
|
||||||
0: # Scale Image
|
0: # Scale Image
|
||||||
show_scale_image_popup()
|
show_scale_image_popup()
|
||||||
|
|
||||||
1: # Crop Image
|
1: # Crop Image
|
||||||
DrawingAlgos.crop_image(image)
|
DrawingAlgos.crop_image(DrawGD, image)
|
||||||
|
|
||||||
2: # Resize Canvas
|
2: # Resize Canvas
|
||||||
show_resize_canvas_popup()
|
show_resize_canvas_popup()
|
||||||
|
Loading…
Reference in New Issue
Block a user