swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Bug Description
Import options are not working as intended for Import plugins written in Swift. These are the options provided through the _getImportOptions(path:_, presetIndex:_) method of a EditorImportPlugin. The noticeable effects are:
Import options don't show up in the editor's "Import" dock.
An empty dictionary { } is received through the options parameter of the _import(sourceFile:_,savePath:_,options:_,platformVariants:_, genFiles:_) method.
How to reproduce
Create an EditorImportPlugin subclass:
@Godot(.tool)
class TestPlugin: EditorImportPlugin {}
Override and provide a default implementation to all necessary methods.
Finally, build the library, reload the editor, and enable the plugin on the "Project Settings...". Select a file on the editor's filesystem with the plugin's recognizable extension and open the "Import" tab. Check that no options are shown.
Press the "Reimport" button to trigger an import and check for any values you tried to print to the console.
### Considerations
I tried writing the exact same plugin (same values, same overrides, ...) in GDScript and it works. Options show as intended.
Sometimes, options from another import plugin used leak into the `_import` call (visible by printing to console). Seems like some caching behavior is happening in the editor across plugins.
If someone can make it work is Swift, let me know.
### Reference
For more information on Import plugins options, refer to the official documentation:
https://docs.godotengine.org/en/stable/tutorials/plugins/editor/import_plugins.html#options-and-presets
Environment
Bug Description
Import options are not working as intended for Import plugins written in Swift. These are the options provided through the
_getImportOptions(path:_, presetIndex:_)
method of aEditorImportPlugin
. The noticeable effects are:{ }
is received through theoptions
parameter of the_import(sourceFile:_,savePath:_,options:_,platformVariants:_, genFiles:_)
method.How to reproduce
Create an
EditorImportPlugin
subclass:Override and provide a default implementation to all necessary methods.
Override
_getImportOptions
:Override the
_import
function. Try to print theoptions
parameter or any values that should be in the dictionary.Create a Godot plugin in
res://addons
, provide aplugin.cfg
file, and enable the import plugin with a GDScript:var plugin: TestPlugin
func _get_plugin_name() -> String: return "Test Importer"
func _enter_tree(): plugin = TestPlugin.new() add_import_plugin(plugin)
func _exit_tree(): remove_import_plugin(plugin) plugin = null