Selaa lähdekoodia

refactor: tool load method

LanzaSchneider 1 vuosi sitten
vanhempi
commit
1e6024c612
1 muutettua tiedostoa jossa 6 lisäystä ja 2 poistoa
  1. 6 2
      tblext.gd

+ 6 - 2
tblext.gd

@@ -4,7 +4,11 @@ extends EditorPlugin
 func _enter_tree() -> void:
 	var helper := preload('tblext.gd')
 	var base_dir: String = helper.resource_path.get_base_dir()
-	make_panel(load(base_dir.path_join('editor/tools/config-importer.tres')))
+	var tools_dir := base_dir.path_join('editor/tools')
+	var dir := DirAccess.open(tools_dir)
+	for file in dir.get_files():
+		if file.get_extension() == 'tres':
+			make_panel(load(tools_dir.path_join(file)))
 
 func make_panel(dev_tool:DevTool) -> VBoxContainer:
 	var panel := VBoxContainer.new()
@@ -31,7 +35,7 @@ func make_panel(dev_tool:DevTool) -> VBoxContainer:
 	var command := Button.new()
 	command.text = dev_tool.tool_command_name
 	command.button_up.connect(func():
-		OS.execute('ruby', [dev_tool.tool_script])
+		OS.execute('ruby', [ProjectSettings.globalize_path(dev_tool.tool_script)])
 		)
 	panel.add_child(command)
 	panel.name = dev_tool.tool_name