mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 09:24:44 -04:00
Added Patterns for the bucket tool
The bucket tool can now use Patterns instead of colors to fill areas. They get loaded from the "Patterns" folder, similar to how Brushes and Palletes work. You can no longer use brushes for the bucket tool.
This commit is contained in:
parent
a14e928031
commit
768a1e7b8f
24 changed files with 315 additions and 155 deletions
22
Prefabs/PatternButton.gd
Normal file
22
Prefabs/PatternButton.gd
Normal file
|
@ -0,0 +1,22 @@
|
|||
extends TextureButton
|
||||
|
||||
|
||||
var image : Image
|
||||
var texture : ImageTexture
|
||||
|
||||
|
||||
func _ready():
|
||||
if image:
|
||||
texture = ImageTexture.new()
|
||||
texture.create_from_image(image, 0)
|
||||
|
||||
|
||||
func _on_PatternButton_pressed() -> void:
|
||||
if Global.pattern_window_position == "left":
|
||||
Global.pattern_left_image = image
|
||||
Global.left_fill_pattern_container.get_child(0).get_child(0).texture = texture
|
||||
|
||||
elif Global.pattern_window_position == "right":
|
||||
Global.pattern_right_image = image
|
||||
Global.right_fill_pattern_container.get_child(0).get_child(0).texture = texture
|
||||
Global.patterns_popup.hide()
|
27
Prefabs/PatternButton.tscn
Normal file
27
Prefabs/PatternButton.tscn
Normal file
|
@ -0,0 +1,27 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Assets/Graphics/Brush_button.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Prefabs/PatternButton.gd" type="Script" id=2]
|
||||
|
||||
[node name="PatternButton" type="TextureButton"]
|
||||
margin_right = 32.0
|
||||
margin_bottom = 32.0
|
||||
rect_min_size = Vector2( 3, 0 )
|
||||
button_mask = 7
|
||||
texture_normal = ExtResource( 1 )
|
||||
stretch_mode = 5
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="PatternTexture" type="TextureRect" parent="."]
|
||||
margin_right = 32.0
|
||||
margin_bottom = 32.0
|
||||
rect_min_size = Vector2( 32, 32 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[connection signal="pressed" from="." to="." method="_on_PatternButton_pressed"]
|
Loading…
Add table
Add a link
Reference in a new issue