commit 304b83ff50eaefc97ec16fe25d112b5cb2fc6c61 Author: Andrew Luchuk Date: Wed Jun 11 11:45:55 2025 -0400 hello godot plugin world diff --git a/exporter.gd b/exporter.gd new file mode 100644 index 0000000..3b5532c --- /dev/null +++ b/exporter.gd @@ -0,0 +1,54 @@ +@tool +extends EditorExportPlugin + + +func _export_begin(features: PackedStringArray, is_debug: bool, path: String, flags: int) -> void: + var dir_name = path.get_base_dir() + + var dir = DirAccess.open(".") + if dir and !dir.dir_exists(dir_name): + dir.make_dir_recursive(dir_name) + + #dir = DirAccess.open("res://") + + var extra_files = get_option("extras_exporter/additional_files") + for file_path in extra_files: + var file_name = file_path.get_file() + dir.copy(file_path, dir_name + '/' + file_name) + + if get_option("extras_exporter/write_version_file"): + var file_name = "version.txt" + var version = ProjectSettings.get_setting("application/config/version") + var vf = FileAccess.open(dir_name + "/" + file_name, FileAccess.WRITE) + vf.store_line(version) + + +func _export_end() -> void: + pass + + +func _get_export_options(_platform: EditorExportPlatform) -> Array[Dictionary]: + return [ + { + "option": { + "name": "extras_exporter/additional_files", + "class_name": "", + "type": TYPE_ARRAY, + "hint": PROPERTY_HINT_TYPE_STRING, + "hint_string": "%d/%d:*" % [TYPE_STRING, PROPERTY_HINT_FILE], + "usage": PROPERTY_USAGE_EDITOR, + }, + "default_value": [], + "update_visibility": false, + }, + { + "option": { + "name": "extras_exporter/write_version_file", + "class_name": "", + "type": TYPE_BOOL, + "usage": PROPERTY_USAGE_EDITOR, + }, + "default_value": true, + "update_visibility": false, + } + ] diff --git a/exporter.gd.uid b/exporter.gd.uid new file mode 100644 index 0000000..47df8fe --- /dev/null +++ b/exporter.gd.uid @@ -0,0 +1 @@ +uid://c0jvcmxmnuaj5 diff --git a/extras_exporter.gd b/extras_exporter.gd new file mode 100644 index 0000000..f10f686 --- /dev/null +++ b/extras_exporter.gd @@ -0,0 +1,12 @@ +@tool +extends EditorPlugin + +const Exporter = preload("exporter.gd") +var exporter_plugin = Exporter.new() + +func _enter_tree() -> void: + add_export_plugin(exporter_plugin) + + +func _exit_tree() -> void: + remove_export_plugin(exporter_plugin) diff --git a/extras_exporter.gd.uid b/extras_exporter.gd.uid new file mode 100644 index 0000000..e6c35e8 --- /dev/null +++ b/extras_exporter.gd.uid @@ -0,0 +1 @@ +uid://7u5rugp0fvuc diff --git a/plugin.cfg b/plugin.cfg new file mode 100644 index 0000000..0f178f8 --- /dev/null +++ b/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="Extras Exporter" +description="" +author="Andrew Luchuk" +version="1.0.0" +script="extras_exporter.gd"