@tool 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'))) func make_panel(dev_tool:DevTool) -> VBoxContainer: var panel := VBoxContainer.new() var options := JSON.parse_string(FileAccess.get_file_as_string(dev_tool.tool_config)) for option in options: if option.value is String: var comment := Label.new() var line_edit := LineEdit.new() comment.text = option.comment line_edit.text = option.value panel.add_child(comment) panel.add_child(line_edit) panel.tree_exiting.connect(func(): option.value = line_edit.text ) elif option.value is bool: var check_box := CheckBox.new() check_box.text = option.comment check_box.button_pressed = option.value panel.add_child(check_box) panel.tree_exiting.connect(func(): option.value = check_box.button_pressed ) var command := Button.new() command.text = dev_tool.tool_command_name command.button_up.connect(func(): OS.execute('ruby', [dev_tool.tool_script]) ) panel.add_child(command) panel.name = dev_tool.tool_name add_control_to_dock(dev_tool.tool_dock, panel) panel.tree_exited.connect(func(): var json := FileAccess.open(dev_tool.tool_config, FileAccess.WRITE) json.store_string(JSON.stringify(options, "\t")) ) tree_exiting.connect(func(): remove_control_from_docks(panel) panel.queue_free() ) return panel