mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
Added comment node
This commit is contained in:
parent
cb03131b85
commit
1a5ddae226
@ -6,7 +6,7 @@
|
|||||||
[sub_resource type="Theme" id=1]
|
[sub_resource type="Theme" id=1]
|
||||||
|
|
||||||
|
|
||||||
[node name="GraphEdit" type="GraphEdit" index="0"]
|
[node name="GraphEdit" type="GraphEdit"]
|
||||||
|
|
||||||
self_modulate = Color( 1, 1, 1, 0 )
|
self_modulate = Color( 1, 1, 1, 0 )
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
|
@ -205,5 +205,9 @@
|
|||||||
{
|
{
|
||||||
"tree_item":"Miscellaneous/Remote",
|
"tree_item":"Miscellaneous/Remote",
|
||||||
"type":"remote"
|
"type":"remote"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tree_item":"Miscellaneous/Comment",
|
||||||
|
"type":"comment"
|
||||||
}
|
}
|
||||||
]}
|
]}
|
@ -184,6 +184,7 @@ func add_to_user_library():
|
|||||||
selected_nodes.append(n)
|
selected_nodes.append(n)
|
||||||
if !selected_nodes.empty():
|
if !selected_nodes.empty():
|
||||||
var dialog = preload("res://addons/material_maker/widgets/line_dialog.tscn").instance()
|
var dialog = preload("res://addons/material_maker/widgets/line_dialog.tscn").instance()
|
||||||
|
dialog.set_texts("New library element", "Select a name for the new library element")
|
||||||
add_child(dialog)
|
add_child(dialog)
|
||||||
dialog.connect("ok", self, "do_add_to_user_library", [ selected_nodes ])
|
dialog.connect("ok", self, "do_add_to_user_library", [ selected_nodes ])
|
||||||
dialog.popup_centered()
|
dialog.popup_centered()
|
||||||
|
32
addons/material_maker/nodes/comment.gd
Normal file
32
addons/material_maker/nodes/comment.gd
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
tool
|
||||||
|
extends "res://addons/material_maker/node_base.gd"
|
||||||
|
|
||||||
|
func _get_shader_code(uv):
|
||||||
|
var rv = { defs="", code="" }
|
||||||
|
rv.rgb = "vec3(1.0)"
|
||||||
|
return rv
|
||||||
|
|
||||||
|
func serialize():
|
||||||
|
var data = .serialize()
|
||||||
|
data.text = $Label.text
|
||||||
|
return data
|
||||||
|
|
||||||
|
func deserialize(data):
|
||||||
|
.deserialize(data)
|
||||||
|
if data.has("text"):
|
||||||
|
$Label.text = data.text
|
||||||
|
|
||||||
|
func _on_resize_request(new_minsize):
|
||||||
|
rect_min_size = new_minsize
|
||||||
|
|
||||||
|
func _on_Label_gui_input(ev):
|
||||||
|
if ev is InputEventMouseButton and ev.doubleclick and ev.button_index == BUTTON_LEFT:
|
||||||
|
var dialog = preload("res://addons/material_maker/widgets/text_dialog.tscn").instance()
|
||||||
|
dialog.set_title("Write comment")
|
||||||
|
dialog.set_text($Label.text)
|
||||||
|
add_child(dialog)
|
||||||
|
dialog.connect("ok", self, "set_comment")
|
||||||
|
dialog.popup_centered()
|
||||||
|
|
||||||
|
func set_comment(text):
|
||||||
|
$Label.text = text
|
65
addons/material_maker/nodes/comment.tscn
Normal file
65
addons/material_maker/nodes/comment.tscn
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://addons/material_maker/nodes/comment.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="GraphNode" type="GraphNode" index="0"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_left = 1.0
|
||||||
|
margin_top = 1.0
|
||||||
|
margin_right = 109.0
|
||||||
|
margin_bottom = 81.0
|
||||||
|
rect_min_size = Vector2( 100, 80 )
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
mouse_filter = 0
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
title = "Comment"
|
||||||
|
offset = Vector2( 0, 0 )
|
||||||
|
show_close = true
|
||||||
|
resizable = true
|
||||||
|
selected = false
|
||||||
|
comment = true
|
||||||
|
overlay = 0
|
||||||
|
slot/0/left_enabled = false
|
||||||
|
slot/0/left_type = 0
|
||||||
|
slot/0/left_color = Color( 1, 1, 1, 1 )
|
||||||
|
slot/0/right_enabled = false
|
||||||
|
slot/0/right_type = 0
|
||||||
|
slot/0/right_color = Color( 1, 1, 1, 1 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
_sections_unfolded = [ "custom_styles" ]
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="." index="0"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_left = 16.0
|
||||||
|
margin_top = 24.0
|
||||||
|
margin_right = 92.0
|
||||||
|
margin_bottom = 72.0
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
mouse_filter = 0
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 1
|
||||||
|
size_flags_vertical = 4
|
||||||
|
text = "Double-click to write a comment"
|
||||||
|
autowrap = true
|
||||||
|
percent_visible = 1.0
|
||||||
|
lines_skipped = 0
|
||||||
|
max_lines_visible = -1
|
||||||
|
_sections_unfolded = [ "Mouse" ]
|
||||||
|
|
||||||
|
[connection signal="resize_request" from="." to="." method="_on_resize_request"]
|
||||||
|
|
||||||
|
[connection signal="gui_input" from="Label" to="." method="_on_Label_gui_input"]
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[ext_resource path="res://addons/material_maker/widgets/line_dialog.gd" type="Script" id=1]
|
[ext_resource path="res://addons/material_maker/widgets/line_dialog.gd" type="Script" id=1]
|
||||||
|
|
||||||
[node name="LineDialog" type="WindowDialog" index="0"]
|
[node name="LineDialog" type="WindowDialog"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
@ -17,7 +17,7 @@ mouse_default_cursor_shape = 0
|
|||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
popup_exclusive = false
|
popup_exclusive = false
|
||||||
window_title = "New library element"
|
window_title = "blah"
|
||||||
resizable = false
|
resizable = false
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
text = "Select a name for the new library element"
|
text = "blah"
|
||||||
percent_visible = 1.0
|
percent_visible = 1.0
|
||||||
lines_skipped = 0
|
lines_skipped = 0
|
||||||
max_lines_visible = -1
|
max_lines_visible = -1
|
||||||
@ -83,14 +83,15 @@ anchor_left = 0.0
|
|||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
|
margin_left = 104.0
|
||||||
margin_top = 46.0
|
margin_top = 46.0
|
||||||
margin_right = 124.0
|
margin_right = 228.0
|
||||||
margin_bottom = 66.0
|
margin_bottom = 66.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 0
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 0
|
size_flags_vertical = 0
|
||||||
alignment = 0
|
alignment = 0
|
||||||
_sections_unfolded = [ "Size Flags" ]
|
_sections_unfolded = [ "Size Flags" ]
|
||||||
|
17
addons/material_maker/widgets/text_dialog.gd
Normal file
17
addons/material_maker/widgets/text_dialog.gd
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
tool
|
||||||
|
extends WindowDialog
|
||||||
|
|
||||||
|
signal ok
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
popup()
|
||||||
|
|
||||||
|
func set_title(title):
|
||||||
|
window_title = title
|
||||||
|
|
||||||
|
func set_text(text):
|
||||||
|
$VBoxContainer/TextEdit.text = text
|
||||||
|
|
||||||
|
func _on_OK_pressed():
|
||||||
|
emit_signal("ok", $VBoxContainer/TextEdit.text)
|
||||||
|
queue_free()
|
146
addons/material_maker/widgets/text_dialog.tscn
Normal file
146
addons/material_maker/widgets/text_dialog.tscn
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://addons/material_maker/widgets/text_dialog.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="TextDialog" type="WindowDialog"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_right = 310.0
|
||||||
|
margin_bottom = 178.0
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
mouse_filter = 0
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 1
|
||||||
|
size_flags_vertical = 1
|
||||||
|
popup_exclusive = false
|
||||||
|
window_title = "blah"
|
||||||
|
resizable = false
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="." index="1"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
mouse_filter = 1
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 1
|
||||||
|
size_flags_vertical = 1
|
||||||
|
alignment = 0
|
||||||
|
|
||||||
|
[node name="TextEdit" type="TextEdit" parent="VBoxContainer" index="0"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_right = 310.0
|
||||||
|
margin_bottom = 150.0
|
||||||
|
rect_min_size = Vector2( 0, 150 )
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
focus_mode = 2
|
||||||
|
mouse_filter = 0
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 1
|
||||||
|
size_flags_vertical = 1
|
||||||
|
text = ""
|
||||||
|
readonly = false
|
||||||
|
highlight_current_line = false
|
||||||
|
syntax_highlighting = false
|
||||||
|
show_line_numbers = false
|
||||||
|
highlight_all_occurrences = false
|
||||||
|
override_selected_font_color = false
|
||||||
|
context_menu_enabled = true
|
||||||
|
smooth_scrolling = false
|
||||||
|
v_scroll_speed = 80.0
|
||||||
|
hiding_enabled = 0
|
||||||
|
wrap_lines = false
|
||||||
|
caret_block_mode = false
|
||||||
|
caret_blink = false
|
||||||
|
caret_blink_speed = 0.65
|
||||||
|
caret_moving_by_right_click = true
|
||||||
|
_sections_unfolded = [ "Rect" ]
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer" index="1"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_left = 93.0
|
||||||
|
margin_top = 154.0
|
||||||
|
margin_right = 217.0
|
||||||
|
margin_bottom = 174.0
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
mouse_filter = 1
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 0
|
||||||
|
alignment = 0
|
||||||
|
_sections_unfolded = [ "Size Flags" ]
|
||||||
|
|
||||||
|
[node name="OK" type="Button" parent="VBoxContainer/HBoxContainer" index="0"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_right = 60.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
rect_min_size = Vector2( 60, 0 )
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
focus_mode = 2
|
||||||
|
mouse_filter = 0
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 1
|
||||||
|
size_flags_vertical = 1
|
||||||
|
toggle_mode = false
|
||||||
|
enabled_focus_mode = 2
|
||||||
|
shortcut = null
|
||||||
|
group = null
|
||||||
|
text = "OK"
|
||||||
|
flat = false
|
||||||
|
align = 1
|
||||||
|
_sections_unfolded = [ "Rect" ]
|
||||||
|
|
||||||
|
[node name="Cancel" type="Button" parent="VBoxContainer/HBoxContainer" index="1"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_left = 64.0
|
||||||
|
margin_right = 124.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
rect_min_size = Vector2( 60, 0 )
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
focus_mode = 2
|
||||||
|
mouse_filter = 0
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 1
|
||||||
|
size_flags_vertical = 1
|
||||||
|
toggle_mode = false
|
||||||
|
enabled_focus_mode = 2
|
||||||
|
shortcut = null
|
||||||
|
group = null
|
||||||
|
text = "Cancel"
|
||||||
|
flat = false
|
||||||
|
align = 1
|
||||||
|
_sections_unfolded = [ "Rect" ]
|
||||||
|
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/OK" to="." method="_on_OK_pressed"]
|
||||||
|
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Cancel" to="." method="queue_free"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user