1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-23 05:53:14 +00:00

flip_rotate for BrushButton

This commit is contained in:
RorotoSic 2024-03-02 18:25:00 +01:00
parent 706222c987
commit c7fdc9a32e
4 changed files with 16 additions and 2 deletions

View file

@ -1,6 +1,7 @@
extends Node
signal color_changed(color, button)
signal flip_rotate(flip_x, flip_y, rotate_90, rotate_180, rotate_270)
enum Dynamics { NONE, PRESSURE, VELOCITY }

View file

@ -59,6 +59,8 @@ func _on_BrushType_pressed() -> void:
if child is GridContainer:
child.columns = columns
Global.brushes_popup.popup(Rect2(pop_position, Vector2(size_x, size_y)))
Tools.flip_rotate.emit(_brush_flip_x, _brush_flip_y, _brush_rotate_90, _brush_rotate_180, _brush_rotate_270)
func _on_Brush_selected(brush: Brushes.Brush) -> void:
@ -168,8 +170,6 @@ func update_brush() -> void:
_indicator = _create_brush_indicator()
_polylines = _create_polylines(_indicator)
$Brush/Type/Texture.texture = _brush_texture
#$Brush/Type/Texture.set_flip_v(Tools.brush_flip_x)
#$Brush/Type/Texture.set_flip_h(Tools.brush_flip_y)
$ColorInterpolation.visible = _brush.type in [Brushes.FILE, Brushes.RANDOM_FILE, Brushes.CUSTOM]

View file

@ -2,6 +2,9 @@ extends BaseButton
var brush = Global.brushes_popup.Brush.new()
func _ready() -> void:
Tools.flip_rotate.connect(_flip_rotate_updated)
func _on_BrushButton_pressed() -> void:
# Delete the brush on middle mouse press
@ -26,3 +29,12 @@ func _on_BrushButton_mouse_entered() -> void:
func _on_BrushButton_mouse_exited() -> void:
if brush.type == Global.brushes_popup.CUSTOM:
$DeleteButton.visible = false
func _flip_rotate_updated(flip_x: bool, flip_y: bool, rotate_90: bool, rotate_180: bool,rotate_270: bool):
$BrushTexture.set_flip_v(flip_x)
$BrushTexture.set_flip_v(flip_y)
var _rotation = 0
if rotate_90 ==true : _rotation += 90
if rotate_180 ==true : _rotation += 180
if rotate_270 ==true : _rotation += 270
$BrushTexture.rotation_degrees = _rotation

View file

@ -19,6 +19,7 @@ offset_left = 2.0
offset_top = 2.0
offset_right = -2.0
offset_bottom = -2.0
pivot_offset = Vector2(16, 16)
expand_mode = 1
stretch_mode = 6