1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Fixed bucket crash when there were no patterns

This commit is contained in:
OverloadedOrama 2020-07-09 15:52:59 +03:00
parent 4a668f71f5
commit 671536cbd7
2 changed files with 11 additions and 5 deletions

View file

@ -3,8 +3,8 @@ class_name Drawer
class ColorOp:
var strength := 1.0
func process(src: Color, _dst: Color) -> Color:
return src

View file

@ -48,6 +48,8 @@ func _on_PatternOffsetY_value_changed(value : float):
func get_config() -> Dictionary:
if !_pattern:
return {}
return {
"pattern_index" : _pattern.index,
"fill_area" : _fill_area,
@ -58,8 +60,9 @@ func get_config() -> Dictionary:
func set_config(config : Dictionary) -> void:
var index = config.get("pattern_index", _pattern.index)
_pattern = Global.patterns_popup.get_pattern(index)
if _pattern:
var index = config.get("pattern_index", _pattern.index)
_pattern = Global.patterns_popup.get_pattern(index)
_fill_area = config.get("fill_area", _fill_area)
_fill_with = config.get("fill_with", _fill_with)
_offset_x = config.get("offset_x", _offset_x)
@ -78,7 +81,10 @@ func update_config() -> void:
func update_pattern() -> void:
if _pattern == null:
_pattern = Global.patterns_popup.default_pattern
if Global.patterns_popup.default_pattern == null:
return
else:
_pattern = Global.patterns_popup.default_pattern
var tex := ImageTexture.new()
tex.create_from_image(_pattern.image, 0)
$FillPattern/Type/Texture.texture = tex