Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling xml converter #259

Merged
merged 10 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Category2D.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ func add_path2d(path):
func add_subcategory(subcategory):
self.add_child(subcategory, true)
subcategories.push_back(subcategory)

func clear_all():
self.paths2d = []
self.subcategories = []
for child in self.get_children():
child.queue_free()
7 changes: 7 additions & 0 deletions Category3D.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ func add_icon(icon):
func add_subcategory(subcategory):
self.add_child(subcategory, true)
subcategories.push_back(subcategory)

func clear_all():
self.paths = []
self.icons = []
self.subcategories = []
for child in self.get_children():
child.queue_free()
1 change: 1 addition & 0 deletions Icon.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const Waypoint = preload("res://waypoint.gd")

var texture_path
var waypoint: Waypoint.Icon
var category: TreeItem

func set_icon_image(texture_path: String):
self.texture_path = texture_path
Expand Down
65 changes: 65 additions & 0 deletions PackDialog.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
extends Control

const executable_path: String = "./xml_converter/build/xml_converter"
var protobin_data_folder: String
var split_protobin_data_folder: String
var user_data_dir: String
onready var output_dialog = $WindowDialog
onready var output_label = $WindowDialog/ScrollContainer/Label

func _ready():
var dir = Directory.new()
self.user_data_dir = str(OS.get_user_data_dir())
self.protobin_data_folder = self.user_data_dir.plus_file("packs")
self.split_protobin_data_folder = self.user_data_dir.plus_file("protobins")
if not dir.dir_exists(self.protobin_data_folder):
var success = dir.make_dir(self.protobin_data_folder)
if success != OK:
print("Error: Could not create data folder:", self.protobin_data_folder)


func clear_directory_contents(dir_path: String) -> void:
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved
var dir = Directory.new()
if dir.open(dir_path) == OK:
while dir.get_next():
var entry_path: String = dir_path + "/" + dir.get_file()
# Remove subdirectories and files, but not "." and ".."
if dir.current_is_dir() and dir.get_file() != "." and dir.get_file() != "..":
clear_directory_contents(entry_path)
# Remove the subdirectory after its contents are cleared
dir.remove(entry_path)
elif dir.current_is_file():
dir.remove(entry_path)
else:
print("Failed to open directory:", dir_path)

func _on_FileDialog_dir_selected(dir_path):
var output: Array = []
print("Selected folder:", dir_path)
var dir = Directory.new()
var new_path: String = self.protobin_data_folder.plus_file(dir_path.get_file())
if not dir.dir_exists(new_path):
var success = dir.make_dir(new_path)
if success != OK:
print("Error: Could not create data folder:", self.protobin_data_folder)
#else:
# #Pop up here to confirm overwrite?
# clear_directory_contents(dir_path)
var args: PoolStringArray = [
"--input-taco-path", dir_path,
"--output-waypoint-path", new_path,
"--output-split-waypoint-path", self.split_protobin_data_folder]
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved
custom_print(args)
var result: int = OS.execute(self.executable_path, args, true, output)
custom_print(output)
if result != OK:
print("Failed to execute the command. Error code:", result)
else:
print("Command executed successfully.")

func custom_print(message: Array):
output_dialog.show()
for line in message:
output_label.text += line + "\n"


1 change: 1 addition & 0 deletions Route.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const Waypoint = preload("res://waypoint.gd")
var texture_path
var color = Color(0.9, 0.1, 0.1)
var waypoint: Waypoint.Trail
var category: TreeItem

var point_list := PoolVector3Array()

Expand Down
18 changes: 9 additions & 9 deletions Spatial.gd
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const path2d_scene = preload("res://Route2D.tscn")
const gizmo_scene = preload("res://Gizmo/PointEdit.tscn")
const CategoryData = preload("res://CategoryData.gd")
const Waypoint = preload("res://waypoint.gd")
const PackDialog = preload("res://PackDialog.gd")

##########Node Connections###########
onready var markers_ui := $Control/Dialogs/CategoriesDialog/MarkersUI as Tree
Expand Down Expand Up @@ -83,6 +84,8 @@ func _ready():

if (Settings.burrito_link_auto_launch_enabled):
launch_burrito_link()


AsherGlick marked this conversation as resolved.
Show resolved Hide resolved


AsherGlick marked this conversation as resolved.
Show resolved Hide resolved
################################################################################
Expand Down Expand Up @@ -479,11 +482,8 @@ func _unhandled_input(event):
################################################################################
func clear_map_markers():
# Clear all the rendered assets to make way for the new ones
for child in self.markers_3d.get_children():
child.queue_free()

for child in self.markers_2d.get_children():
child.queue_free()
self.markers_3d.clear_all()
self.markers_2d.clear_all()

func init_category_tree():
self.markers_ui.clear()
Expand Down Expand Up @@ -634,7 +634,6 @@ func gen_new_icon(position: Vector3, texture_path: String, waypoint_icon, catego
var category_data = category_item.get_metadata(0)
category_data.category3d.add_icon(new_icon)


# This function take all of the currently rendered objects and converts it into
# the data format that is saved/loaded from.
func data_from_renderview():
Expand Down Expand Up @@ -744,9 +743,6 @@ func _on_main_menu_toggle_pressed():
$Control/Dialogs/MainMenu.show()
set_maximal_mouse_block()

func _on_FileDialog_file_selected(path):
pass

func _on_Dialog_hide():
for dialog in $Control/Dialogs.get_children():
if dialog.visible:
Expand Down Expand Up @@ -929,3 +925,7 @@ func _on_MarkersUI_item_edited():
var category_item = self.markers_ui.get_edited()
apply_category_visibility_to_nodes(category_item)


func _on_ImportPath_pressed():
$Control/Dialogs/FileDialog.show()

129 changes: 94 additions & 35 deletions Spatial.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=2]
[gd_scene load_steps=19 format=2]

[ext_resource path="res://Spatial.gd" type="Script" id=1]
[ext_resource path="res://shaders/range_indicators.shader" type="Shader" id=2]
Expand All @@ -12,6 +12,7 @@
[ext_resource path="res://icon_new_point.png" type="Texture" id=11]
[ext_resource path="res://SettingsDialog.gd" type="Script" id=12]
[ext_resource path="res://Category3D.gd" type="Script" id=13]
[ext_resource path="res://PackDialog.gd" type="Script" id=14]
[ext_resource path="res://Category2D.gd" type="Script" id=15]

[sub_resource type="Shader" id=1]
Expand Down Expand Up @@ -183,20 +184,48 @@ __meta__ = {
}

[node name="FileDialog" type="FileDialog" parent="Control/Dialogs"]
margin_left = 636.0
margin_top = 174.0
margin_right = 1307.0
margin_bottom = 672.0
window_title = "Open a File"
mode = 0
access = 1
current_dir = "user://"
current_path = "user://"
visible = true
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved
margin_left = 312.0
margin_top = 82.0
margin_right = 983.0
margin_bottom = 580.0
window_title = "Open a Directory"
mode = 2
access = 2
current_dir = "/home/steph/Desktop/Packs"
current_path = "/home/steph/Desktop/Packs/"
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved
script = ExtResource( 14 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="WindowDialog" type="WindowDialog" parent="Control/Dialogs/FileDialog"]
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved
visible = true
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved
margin_left = 8.0
margin_top = 8.0
margin_right = 663.0
margin_bottom = 462.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="ScrollContainer" type="ScrollContainer" parent="Control/Dialogs/FileDialog/WindowDialog"]
margin_right = 600.0
margin_bottom = 250.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="Control/Dialogs/FileDialog/WindowDialog/ScrollContainer"]
margin_right = 100.0
margin_bottom = 100.0
rect_min_size = Vector2( 100, 100 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="MainMenu" type="WindowDialog" parent="Control/Dialogs"]
visible = true
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved
margin_left = 48.0
margin_top = 82.0
margin_right = 268.0
Expand All @@ -217,51 +246,72 @@ __meta__ = {

[node name="VBoxContainer" type="VBoxContainer" parent="Control/Dialogs/MainMenu/ScrollContainer"]
margin_right = 220.0
margin_bottom = 284.0
margin_bottom = 368.0
size_flags_horizontal = 3

[node name="LoadPath" type="Button" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_right = 220.0
margin_bottom = 40.0
rect_min_size = Vector2( 0, 40 )
text = "Open Markers File"
text = "Toggle Marker Visibility"

[node name="SavePath" type="Button" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
[node name="HSeparator5" type="HSeparator" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 44.0
margin_right = 220.0
margin_bottom = 84.0
margin_bottom = 48.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="ImportPath" type="Button" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 52.0
margin_right = 220.0
margin_bottom = 72.0
text = "Import Marker Pack"
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved

[node name="HSeparator6" type="HSeparator" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 76.0
margin_right = 220.0
margin_bottom = 80.0
__meta__ = {
"_edit_use_anchors_": false
}
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved

[node name="SavePath" type="Button" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 84.0
margin_right = 220.0
margin_bottom = 124.0
rect_min_size = Vector2( 0, 40 )
text = "Save Markers File"

[node name="HSeparator" type="HSeparator" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 88.0
margin_top = 128.0
margin_right = 220.0
margin_bottom = 92.0
margin_bottom = 132.0

[node name="PointEditor" type="Button" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
visible = false
margin_top = 96.0
margin_right = 213.0
margin_bottom = 136.0
margin_top = 136.0
margin_right = 220.0
margin_bottom = 176.0
rect_min_size = Vector2( 0, 40 )
text = "Editor Panel"
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved

[node name="OpenEditorQuickPanel" type="Button" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 96.0
margin_top = 180.0
margin_right = 220.0
margin_bottom = 136.0
margin_bottom = 220.0
rect_min_size = Vector2( 0, 40 )
text = "Editor Panel"

[node name="HSeparator3" type="HSeparator" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 140.0
margin_top = 224.0
margin_right = 220.0
margin_bottom = 144.0
margin_bottom = 228.0

[node name="Ranges" type="Button" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 148.0
margin_top = 232.0
margin_right = 220.0
margin_bottom = 188.0
margin_bottom = 272.0
rect_min_size = Vector2( 0, 40 )
text = "Range Indicators"

Expand All @@ -282,14 +332,14 @@ rect_min_size = Vector2( 0, 40 )
text = "Guacamole Script Editor"

[node name="HSeparator4" type="HSeparator" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 192.0
margin_top = 276.0
margin_right = 220.0
margin_bottom = 196.0
margin_bottom = 280.0

[node name="Settings" type="Button" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 200.0
margin_top = 284.0
margin_right = 220.0
margin_bottom = 240.0
margin_bottom = 324.0
rect_min_size = Vector2( 0, 40 )
text = "Settings"

Expand All @@ -315,9 +365,9 @@ margin_bottom = 284.0
text = "Active Path"

[node name="ExitButton" type="Button" parent="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer"]
margin_top = 244.0
margin_top = 328.0
margin_right = 220.0
margin_bottom = 284.0
margin_bottom = 368.0
rect_min_size = Vector2( 0, 40 )
text = "Exit Burrito"

Expand Down Expand Up @@ -863,24 +913,33 @@ color = Color( 0, 0, 0, 1 )
[node name="Paths" type="Spatial" parent="."]

[node name="Icons" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.106085, 0, 0 )
AsherGlick marked this conversation as resolved.
Show resolved Hide resolved

[node name="FeetLocation" type="Spatial" parent="."]

[node name="DistanceIndicator" type="MeshInstance" parent="FeetLocation"]
mesh = SubResource( 3 )
material/0 = SubResource( 4 )

[node name="Control2" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}

AsherGlick marked this conversation as resolved.
Show resolved Hide resolved
[connection signal="pressed" from="Control/GlobalMenuButton/main_menu_toggle" to="." method="_on_main_menu_toggle_pressed"]
[connection signal="pressed" from="Control/GlobalMenuButton/EditorQuckPanel/HBoxContainer/CloseEditorQuickPanel" to="." method="_on_CloseEditorQuickPanel_pressed"]
[connection signal="pressed" from="Control/GlobalMenuButton/EditorQuckPanel/HBoxContainer/ChangeTexture" to="." method="_on_ChangeTexture_pressed"]
[connection signal="pressed" from="Control/GlobalMenuButton/EditorQuckPanel/HBoxContainer/NewPath" to="." method="_on_NewPath_pressed"]
[connection signal="pressed" from="Control/GlobalMenuButton/EditorQuckPanel/HBoxContainer/NewPathPoint" to="." method="_on_NewPathPoint_pressed"]
[connection signal="pressed" from="Control/GlobalMenuButton/EditorQuckPanel/HBoxContainer/NewIcon" to="." method="_on_NewIcon_pressed"]
[connection signal="pressed" from="Control/GlobalMenuButton/EditorQuckPanel/HBoxContainer/AdjustPoints" to="." method="_on_AdjustNodesButton_pressed"]
[connection signal="file_selected" from="Control/Dialogs/FileDialog" to="." method="_on_FileDialog_file_selected"]
[connection signal="dir_selected" from="Control/Dialogs/FileDialog" to="Control/Dialogs/FileDialog" method="_on_FileDialog_dir_selected"]
[connection signal="hide" from="Control/Dialogs/FileDialog" to="." method="_on_Dialog_hide"]
[connection signal="hide" from="Control/Dialogs/MainMenu" to="." method="_on_Dialog_hide"]
[connection signal="pressed" from="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer/LoadPath" to="." method="_on_LoadPath_pressed"]
[connection signal="pressed" from="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer/ImportPath" to="." method="_on_ImportPath_pressed"]
[connection signal="pressed" from="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer/SavePath" to="." method="_on_SavePath_pressed"]
[connection signal="pressed" from="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer/OpenEditorQuickPanel" to="." method="_on_OpenEditorQuickPanel_pressed"]
[connection signal="pressed" from="Control/Dialogs/MainMenu/ScrollContainer/VBoxContainer/Ranges" to="." method="_on_RangesButton_pressed"]
Expand Down Expand Up @@ -923,9 +982,9 @@ material/0 = SubResource( 4 )
[connection signal="text_changed" from="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer/WinePath" to="Control/Dialogs/SettingsDialog" method="save_settings"]
[connection signal="text_changed" from="Control/Dialogs/SettingsDialog/ScrollContainer/GridContainer/EnvironmentVars" to="Control/Dialogs/SettingsDialog" method="save_settings"]
[connection signal="hide" from="Control/Dialogs/CategoriesDialog" to="." method="_on_Dialog_hide"]
[connection signal="cell_selected" from="Control/Dialogs/CategoriesDialog/MarkersUI" to="." method="_on_MarkerPacks_cell_selected"]
[connection signal="cell_selected" from="Control/Dialogs/CategoriesDialog/MarkersUI" to="." method="_on_MarkersUI_cell_selected"]
[connection signal="item_edited" from="Control/Dialogs/CategoriesDialog/MarkersUI" to="." method="_on_MarkerPacks_item_edited"]
[connection signal="cell_selected" from="Control/Dialogs/CategoriesDialog/MarkersUI" to="." method="_on_MarkerPacks_cell_selected"]
[connection signal="item_edited" from="Control/Dialogs/CategoriesDialog/MarkersUI" to="." method="_on_MarkersUI_item_edited"]
[connection signal="item_edited" from="Control/Dialogs/CategoriesDialog/MarkersUI" to="." method="_on_MarkerPacks_item_edited"]
[connection signal="multi_selected" from="Control/Dialogs/CategoriesDialog/MarkersUI" to="." method="_on_Tree_multi_selected"]
[connection signal="tree_entered" from="Control/Dialogs/CategoriesDialog/MarkersUI" to="." method="_on_Tree_tree_entered"]