Skip to content

Commit

Permalink
Resizing checkbox column in tree to be narrow on the right
Browse files Browse the repository at this point in the history
  • Loading branch information
AsherGlick committed Nov 10, 2023
1 parent 1b751c3 commit 85958d4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
29 changes: 16 additions & 13 deletions Spatial.gd
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ onready var minimap := $Control/MiniMap as Node2D

# Called when the node enters the scene tree for the first time.
func _ready():
self.marker_packs.set_column_expand(1, false)
self.marker_packs.set_column_min_width(1, 24)
get_tree().get_root().set_transparent_background(true)
x11_fg = X11_FG.new()
taco_parser = TacoParser.new()
Expand Down Expand Up @@ -482,9 +484,9 @@ func init_category_tree():
self.marker_packs.clear()
var root : TreeItem
root = self.marker_packs.create_item()
root.set_text(0, "Markers available on current map")
root.set_selectable(0, false)
root.set_text(1, "Visible")
root.set_text(0, "Markers")
root.set_expand_right(0, true)



func waypoint_categories_to_godot_nodes():
Expand All @@ -493,8 +495,8 @@ func waypoint_categories_to_godot_nodes():


func _waypoint_categories_to_godot_nodes(item: TreeItem, category, full_category_name: String, collapsed: bool):
var category_item = self.marker_packs.create_item(item)
if category.get_name() == "":
var category_item: TreeItem = self.marker_packs.create_item(item)
if category.get_name() == "":
# If this is called, there is an error in the Waypoint data
category_item.set_text(0, "No name")
category_item.set_metadata(0, "")
Expand All @@ -507,6 +509,7 @@ func _waypoint_categories_to_godot_nodes(item: TreeItem, category, full_category
category_item.set_tooltip(1, "Show/Hide")
category_item.set_editable(1, true)
category_item.set_collapsed(collapsed)
category_item.set_selectable(1, false)

for path in category.get_trail():
var path_points := PoolVector3Array()
Expand Down Expand Up @@ -534,15 +537,15 @@ func _waypoint_categories_to_godot_nodes(item: TreeItem, category, full_category
continue
var full_texture_path = self.marker_file_dir + texture_path.get_path()
gen_new_icon(position_vector, full_texture_path, icon, category_item)

for category_child in category.get_children():
_waypoint_categories_to_godot_nodes(category_item, category_child, full_category_name + "." + category_child.get_name(), true)


func apply_category_visibility_to_nodes(category_item: TreeItem):
Settings.local_category_data[category_item.get_metadata(0)] = {
"checked" : category_item.is_checked(1),
}
}
Settings.save()
var temporary_cateogry_visibility_data = populate_update_dict(category_item, {})
update_node_visibility(temporary_cateogry_visibility_data, self.paths)
Expand Down Expand Up @@ -570,9 +573,9 @@ func update_node_visibility(cateogry_data, nodes):
if node.get_name() == "Path":
var index = node.get_index()
var route2d = self.minimap.get_child(index)
route2d.visible= node.visible
route2d.visible= node.visible

#Child visibility is contigent on all parents having permission
#Child visibility is contigent on all parents having permission
func is_category_visible(category_item: TreeItem) -> bool:
if category_item == marker_packs.get_root():
return true
Expand Down Expand Up @@ -617,7 +620,7 @@ func gen_new_path(points: Array, texture_path: String, waypoint_trail, category_
new_route.visible = is_category_visible(category_item)
else:
new_route.visible = false

paths.add_child(new_route)

# Create a new 2D Path
Expand All @@ -634,7 +637,7 @@ func gen_new_path(points: Array, texture_path: String, waypoint_trail, category_
self.currently_active_path_2d = new_2d_path


func gen_new_icon(position: Vector3, texture_path: String, waypoint_icon, category_item: TreeItem):
func gen_new_icon(position: Vector3, texture_path: String, waypoint_icon, category_item: TreeItem):
position.z = -position.z
var new_icon = icon_scene.instance()
new_icon.translation = position
Expand Down Expand Up @@ -697,7 +700,7 @@ func gen_adjustment_nodes():
if self.currently_active_category.get_metadata(0) == route.waypoint.get_category().get_name():
for i in range(route.get_point_count()):
var gizmo_position = route.get_point_position(i)

# Simplistic cull to prevent nodes that are too far away to be
# visible from being created. Additional work can be done here
# if this is not enough of an optimization in the future.
Expand Down Expand Up @@ -839,7 +842,7 @@ func _on_NewPathPoint_pressed():


################################################################################
#
#
################################################################################
func _on_SavePath_pressed():
$Control/Dialogs/SaveDialog.show()
Expand Down
32 changes: 15 additions & 17 deletions Spatial.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ disabled = true
text = "Reverse Path Direction"

[node name="SettingsDialog" type="WindowDialog" parent="Control/Dialogs"]
visible = false
margin_left = 592.0
margin_top = 146.0
margin_right = 981.0
Expand Down Expand Up @@ -756,6 +755,20 @@ margin_bottom = 336.0
rect_min_size = Vector2( 0, 100 )
size_flags_horizontal = 3

[node name="Spacer" type="Control" parent="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer"]
visible = false
margin_top = 284.0
margin_right = 112.0
margin_bottom = 284.0

[node name="LoadLutrisProfile" type="Button" parent="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer"]
visible = false
margin_left = 116.0
margin_top = 284.0
margin_right = 384.0
margin_bottom = 304.0
text = "Load Lutris Profile"

[node name="MarkerPacks" type="WindowDialog" parent="Control/Dialogs"]
margin_left = 280.0
margin_top = 105.0
Expand All @@ -769,27 +782,12 @@ __meta__ = {
[node name="MarkerPacks" type="Tree" parent="Control/Dialogs/MarkerPacks"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = 47.0
size_flags_vertical = 3
columns = 2
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Spacer" type="Control" parent="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer"]
visible = false
margin_top = 284.0
margin_right = 112.0
margin_bottom = 284.0

[node name="LoadLutrisProfile" type="Button" parent="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer"]
visible = false
margin_left = 116.0
margin_top = 284.0
margin_right = 384.0
margin_bottom = 304.0
text = "Load Lutris Profile"

[node name="Border" type="Control" parent="Control"]
visible = false
anchor_right = 1.0
Expand Down Expand Up @@ -913,9 +911,9 @@ material/0 = SubResource( 4 )
[connection signal="pressed" from="Control/Dialogs/NodeEditorDialog/ScrollContainer/VBoxContainer/SetActivePath" to="." method="_on_SetActivePath_pressed"]
[connection signal="pressed" from="Control/Dialogs/NodeEditorDialog/ScrollContainer/VBoxContainer/ReversePathDirection" to="." method="_on_ReversePathDirection_pressed"]
[connection signal="hide" from="Control/Dialogs/SettingsDialog" to="." method="_on_NodeEditorDialog_hide"]
[connection signal="pressed" from="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer/OverrideSize" to="Control/Dialogs/SettingsDialog" method="save_settings"]
[connection signal="text_changed" from="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer/MinimumWidth" to="Control/Dialogs/SettingsDialog" method="save_settings"]
[connection signal="text_changed" from="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer/MinimumHeight" to="Control/Dialogs/SettingsDialog" method="save_settings"]
[connection signal="pressed" from="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer/OverrideSize" to="Control/Dialogs/SettingsDialog" method="save_settings"]
[connection signal="text_changed" from="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer/OverrideWidth" to="Control/Dialogs/SettingsDialog" method="save_settings"]
[connection signal="text_changed" from="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer/OverrideHeight" to="Control/Dialogs/SettingsDialog" method="save_settings"]
[connection signal="pressed" from="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer/AutoLaunchBurritoLink" to="Control/Dialogs/SettingsDialog" method="save_settings"]
Expand Down

0 comments on commit 85958d4

Please sign in to comment.