diff options
author | Gone2Daly <71726742+Gone2Daly@users.noreply.github.com> | 2023-07-22 21:05:42 +0200 |
---|---|---|
committer | Gone2Daly <71726742+Gone2Daly@users.noreply.github.com> | 2023-07-22 21:05:42 +0200 |
commit | 71b3cd829f80de4c2cd3972d8bfd5ee470a5d180 (patch) | |
tree | b4280fde6eef2ae6987648bc7bf8e00e9011bb7f /game/addons/zylann.hterrain/tools/brush/settings_dialog/preview_painter.gd | |
parent | ce9022d0df74d6c33db3686622be2050d873ab0b (diff) |
init_testtest3d
Diffstat (limited to 'game/addons/zylann.hterrain/tools/brush/settings_dialog/preview_painter.gd')
-rw-r--r-- | game/addons/zylann.hterrain/tools/brush/settings_dialog/preview_painter.gd | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/game/addons/zylann.hterrain/tools/brush/settings_dialog/preview_painter.gd b/game/addons/zylann.hterrain/tools/brush/settings_dialog/preview_painter.gd new file mode 100644 index 0000000..be52072 --- /dev/null +++ b/game/addons/zylann.hterrain/tools/brush/settings_dialog/preview_painter.gd @@ -0,0 +1,41 @@ +@tool +extends Node + +const HT_Painter = preload("./../painter.gd") +const HT_Brush = preload("./../brush.gd") + +const HT_ColorShader = preload("../shaders/color.gdshader") + +var _painter : HT_Painter +var _brush : HT_Brush + + +func _init(): + var p = HT_Painter.new() + # The name is just for debugging + p.set_name("Painter") + add_child(p) + _painter = p + + _brush = HT_Brush.new() + + +func set_image_texture(image: Image, texture: ImageTexture): + _painter.set_image(image, texture) + + +func get_brush() -> HT_Brush: + return _brush + + +# This may be called from an `_input` callback +func paint_input(position: Vector2, pressure: float): + var p : HT_Painter = _painter + + if not _brush.configure_paint_input([p], position, pressure): + return + + p.set_brush_shader(HT_ColorShader) + p.set_brush_shader_param("u_color", Color(0,0,0,1)) + #p.set_image(_image, _texture) + p.paint_input(position) |