diff options
Diffstat (limited to 'doc/classes/EditorImportPlugin.xml')
-rw-r--r-- | doc/classes/EditorImportPlugin.xml | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index ec9efcc9c4..6a976d218f 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -48,61 +48,67 @@ [/gdscript] [csharp] using Godot; - using System; - public class MySpecialPlugin : EditorImportPlugin + public partial class MySpecialPlugin : EditorImportPlugin { - public override String GetImporterName() + public override string _GetImporterName() { return "my.special.plugin"; } - public override String GetVisibleName() + public override string _GetVisibleName() { return "Special Mesh"; } - public override Godot.Collections.Array GetRecognizedExtensions() + public override string[] _GetRecognizedExtensions() { - return new Godot.Collections.Array{"special", "spec"}; + return new string[] { "special", "spec" }; } - public override String GetSaveExtension() + public override string _GetSaveExtension() { return "mesh"; } - public override String GetResourceType() + public override string _GetResourceType() { return "Mesh"; } - public override int GetPresetCount() + public override int _GetPresetCount() { return 1; } - public override String GetPresetName(int i) + public override string _GetPresetName(int presetIndex) { return "Default"; } - public override Godot.Collections.Array GetImportOptions(int i) + public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetImportOptions(string path, int presetIndex) { - return new Godot.Collections.Array{new Godot.Collections.Dictionary{{"name", "myOption"}, {"defaultValue", false}}}; + return new Godot.Collections.Array<Godot.Collections.Dictionary> + { + new Godot.Collections.Dictionary + { + { "name", "myOption" }, + { "defaultValue", false }, + } + }; } - public override int Import(String sourceFile, String savePath, Godot.Collections.Dictionary options, Godot.Collections.Array platformVariants, Godot.Collections.Array genFiles) + public override int _Import(string sourceFile, string savePath, Godot.Collections.Dictionary options, Godot.Collections.Array<string> platformVariants, Godot.Collections.Array<string> genFiles) { - var file = new File(); - if (file.Open(sourceFile, File.ModeFlags.Read) != Error.Ok) + using var file = FileAccess.Open(sourceFile, FileAccess.ModeFlags.Read); + if (file.GetError() != Error.Ok) { return (int)Error.Failed; } var mesh = new ArrayMesh(); // Fill the Mesh with data read in "file", left as an exercise to the reader. - String filename = savePath + "." + GetSaveExtension(); + string filename = $"{savePath}.{_GetSaveExtension()}"; return (int)ResourceSaver.Save(mesh, filename); } } @@ -210,7 +216,7 @@ </description> </method> <method name="_import" qualifiers="virtual const"> - <return type="int" /> + <return type="int" enum="Error" /> <param index="0" name="source_file" type="String" /> <param index="1" name="save_path" type="String" /> <param index="2" name="options" type="Dictionary" /> |