mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
fc3173b9b4
This results in less merge conflicts when using the Text Editor > Files > Trim Trailing Whitespace editor setting. .ptex, .mmg and .json files generated weren't modified as these are saved by Material Maker. These files could be made to end with a newline automatically on save in a future commit.
30 lines
775 B
GDScript
30 lines
775 B
GDScript
tool
|
|
extends MMGraphNodeBase
|
|
|
|
onready var label = $VBox/Label
|
|
onready var editor = $VBox/TextEdit
|
|
|
|
func set_generator(g) -> void:
|
|
generator = g
|
|
label.text = generator.text
|
|
rect_size = generator.size
|
|
|
|
func _on_resize_request(new_size) -> void:
|
|
rect_size = new_size
|
|
generator.size = new_size
|
|
|
|
func _on_Label_gui_input(ev) -> void:
|
|
if ev is InputEventMouseButton and ev.doubleclick and ev.button_index == BUTTON_LEFT:
|
|
editor.rect_min_size = label.rect_size + Vector2(0, rect_size.y - get_minimum_size().y)
|
|
editor.text = label.text
|
|
label.visible = false
|
|
editor.visible = true
|
|
editor.select_all()
|
|
editor.grab_focus()
|
|
|
|
func _on_TextEdit_focus_exited() -> void:
|
|
label.text = editor.text
|
|
generator.text = editor.text
|
|
label.visible = true
|
|
editor.visible = false
|