1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +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: class ColorOp:
var strength := 1.0 var strength := 1.0
func process(src: Color, _dst: Color) -> Color: func process(src: Color, _dst: Color) -> Color:
return src return src

View file

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