Switch app config (name, icon, scene) from editor dropdown
The export_tool_manager dropdown now applies project settings immediately when toggling between "Kalulu Game" and "Prof Tool", replacing the need to manually apply prof_tool_patch.diff. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,12 +6,16 @@ func _get_name() -> String:
|
||||
|
||||
var tool_configs: Dictionary[String, Dictionary] = {
|
||||
"game": {
|
||||
"name": "Kalulu",
|
||||
"main_scene": "res://sources/menus/splash_screen/splash_screen.tscn",
|
||||
"output_name": "kalulu_app"
|
||||
"icon": "res://assets/kalulu_icon.png",
|
||||
"output_name": "Kalulu"
|
||||
},
|
||||
"prof_tool": {
|
||||
"name": "Prof_Tool",
|
||||
"main_scene": "res://sources/language_tool/prof_tool_menu.tscn",
|
||||
"output_name": "prof_tool"
|
||||
"icon": "res://assets/prof_tool_icon.png",
|
||||
"output_name": "Prof_Tool"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +30,8 @@ func _export_begin(features: PackedStringArray, is_debug: bool, path: String, fl
|
||||
push_error("Tool '%s' is not defined in the configuration." % selected_tool)
|
||||
return
|
||||
|
||||
var config: Dictionary[String, String] = tool_configs[selected_tool]
|
||||
var config: Dictionary = tool_configs[selected_tool]
|
||||
ProjectSettings.set_setting("application/config/name", config["name"])
|
||||
ProjectSettings.set_setting("application/run/main_scene", config["main_scene"])
|
||||
ProjectSettings.set_setting("application/config/icon", config["icon"])
|
||||
ProjectSettings.save()
|
||||
|
||||
@@ -3,6 +3,19 @@ extends EditorPlugin
|
||||
|
||||
const EXPORTER_PATH: String = "res://addons/export_tool_manager/export_tool_exporter.gd"
|
||||
|
||||
const TOOL_CONFIGS: Dictionary = {
|
||||
"game": {
|
||||
"name": "Kalulu",
|
||||
"main_scene": "res://sources/menus/splash_screen/splash_screen.tscn",
|
||||
"icon": "res://assets/kalulu_icon.png",
|
||||
},
|
||||
"prof_tool": {
|
||||
"name": "Prof_Tool",
|
||||
"main_scene": "res://sources/language_tool/prof_tool_menu.tscn",
|
||||
"icon": "res://assets/prof_tool_icon.png",
|
||||
}
|
||||
}
|
||||
|
||||
var tool_selector: OptionButton
|
||||
var exporter_plugin: EditorExportPlugin
|
||||
var export_button: Button
|
||||
@@ -11,7 +24,7 @@ func _enter_tree() -> void:
|
||||
# Tool Selector UI
|
||||
tool_selector = OptionButton.new()
|
||||
tool_selector.name = "Tool Exporter"
|
||||
tool_selector.add_item("Game")
|
||||
tool_selector.add_item("Kalulu Game")
|
||||
tool_selector.add_item("Prof Tool")
|
||||
tool_selector.connect("item_selected", _on_tool_selected)
|
||||
add_control_to_container(EditorPlugin.CONTAINER_TOOLBAR, tool_selector)
|
||||
@@ -29,6 +42,8 @@ func _enter_tree() -> void:
|
||||
"game", _:
|
||||
tool_selector.select(0)
|
||||
|
||||
_apply_tool_config(current_tool)
|
||||
|
||||
# Exporter plugin
|
||||
exporter_plugin = load(EXPORTER_PATH).new()
|
||||
add_export_plugin(exporter_plugin)
|
||||
@@ -58,6 +73,20 @@ func _on_tool_selected(index: int) -> void:
|
||||
|
||||
var settings: EditorSettings = get_editor_interface().get_editor_settings()
|
||||
settings.set_setting("export_tool_manager/current_tool", tool)
|
||||
_apply_tool_config(tool)
|
||||
|
||||
|
||||
func _apply_tool_config(tool: String) -> void:
|
||||
if not TOOL_CONFIGS.has(tool):
|
||||
push_error("ExportToolManager: Unknown tool '%s'" % tool)
|
||||
return
|
||||
|
||||
var config: Dictionary = TOOL_CONFIGS[tool]
|
||||
ProjectSettings.set_setting("application/config/name", config["name"])
|
||||
ProjectSettings.set_setting("application/run/main_scene", config["main_scene"])
|
||||
ProjectSettings.set_setting("application/config/icon", config["icon"])
|
||||
ProjectSettings.save()
|
||||
print("ExportToolManager: Switched to '%s' (scene: %s)" % [config["name"], config["main_scene"]])
|
||||
|
||||
func _on_export_all_game_pressed() -> void:
|
||||
export_all_game_presets()
|
||||
|
||||
Reference in New Issue
Block a user