From 843ece8db861f3b61cf0890577c6b3538d76792d Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 27 Apr 2022 15:09:17 +0200 Subject: [PATCH] Add the double hseparators under the class name only when needed. --- project/ClassControl.gd | 7 +++++++ project/ClassControl.tscn | 12 +----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/project/ClassControl.gd b/project/ClassControl.gd index 5db86a1..32467e1 100644 --- a/project/ClassControl.gd +++ b/project/ClassControl.gd @@ -1,5 +1,7 @@ extends PanelContainer +var _item_added : bool = false + func set_class_name(n): $VBoxContainer/HBoxContainer/ClassName.text = n @@ -9,6 +11,11 @@ func add_h_separator(): $VBoxContainer.add_child(hsep) func add_line(line : String): + if !_item_added: + _item_added = true + add_h_separator() + add_h_separator() + var l : Label = Label.new() l.text = line $VBoxContainer.add_child(l) diff --git a/project/ClassControl.tscn b/project/ClassControl.tscn index 8646c59..cee07d8 100644 --- a/project/ClassControl.tscn +++ b/project/ClassControl.tscn @@ -11,7 +11,7 @@ script = ExtResource( 1 ) margin_left = 7.0 margin_top = 7.0 margin_right = 41.0 -margin_bottom = 37.0 +margin_bottom = 23.0 [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] margin_right = 34.0 @@ -24,13 +24,3 @@ margin_bottom = 14.0 text = "Node" align = 1 valign = 1 - -[node name="HSeparator" type="HSeparator" parent="VBoxContainer"] -margin_top = 18.0 -margin_right = 34.0 -margin_bottom = 22.0 - -[node name="HSeparator2" type="HSeparator" parent="VBoxContainer"] -margin_top = 26.0 -margin_right = 34.0 -margin_bottom = 30.0