Skip to content

Commit 0170918

Browse files
committed
Improve comment node
1 parent edf1a14 commit 0170918

11 files changed

Lines changed: 373 additions & 259 deletions

File tree

addons/material_maker/engine/nodes/gen_comment.gd

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
@tool
2-
extends MMGenTexture
2+
extends MMGenBase
33
class_name MMGenComment
44

55

66
# Comments to put in the graph
77

88

99
var text : String = ""
10-
var size : Vector2 = Vector2(300, 200)
10+
var size : Vector2 = Vector2(350, 200)
1111
var title : String = "Comment"
12+
var autoshrink : bool = false
1213

1314
var color = null
1415

1516
func _ready() -> void:
16-
if !parameters.has("size"):
17-
parameters.size = 4
1817
if color == null:
1918
color = Color.WHITE if "light" in mm_globals.main_window.theme.resource_path else Color.BLACK
2019

@@ -33,12 +32,13 @@ func get_input_defs() -> Array:
3332
func get_output_defs(_show_hidden : bool = false) -> Array:
3433
return []
3534

36-
func _serialize(data: Dictionary) -> Dictionary:
35+
func _serialize(data : Dictionary) -> Dictionary:
3736
data.type = "comment"
3837
data.title = title
3938
data.color = MMType.serialize_value(color)
4039
data.text = text
4140
data.size = { x=size.x, y=size.y }
41+
data.autoshrink = MMType.serialize_value(autoshrink)
4242
return data
4343

4444
func _deserialize(data : Dictionary) -> void:
@@ -50,3 +50,5 @@ func _deserialize(data : Dictionary) -> void:
5050
title = data.title
5151
if data.has("color"):
5252
color = MMType.deserialize_value(data.color)
53+
if data.has("autoshrink"):
54+
autoshrink = MMType.deserialize_value(data.autoshrink)

material_maker/main_window.gd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,6 @@ func frame_nodes() -> void:
10551055
# Avoid calling resize twice
10561056
if not mm_globals.get_config("auto_size_comment"):
10571057
nodes[0].resize_to_selection()
1058-
nodes[0].selected = true
10591058

10601059
func make_selected_nodes_editable() -> void:
10611060
var selected_nodes = get_selected_nodes()

material_maker/node_factory.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ func create_node(generator : MMGenBase) -> Node:
2121
return node
2222

2323
func set_theme_overrides(node, generator : MMGenBase = null) -> void:
24+
if node is GraphFrame:
25+
return
2426
var theme : Theme = mm_globals.main_window.theme
2527
if node.theme != null && node.theme != theme:
2628
return

0 commit comments

Comments
 (0)