diff options
author | Ryan Roden-Corrent <ryan@rcorre.net> | 2021-02-09 08:30:27 -0500 |
---|---|---|
committer | Ryan Roden-Corrent <ryan@rcorre.net> | 2021-02-11 11:13:17 +0100 |
commit | 9676650f2f7943ebbf9363fa65e47be62fb22164 (patch) | |
tree | e6f452609a57b1a48f583823cd079e15d03e360c /doc/classes | |
parent | d39f6386ce3a7916dbb94fef5ff65e7599e060f0 (diff) |
Clarify EditorImportPlugin.get_visible_name.
According to the docs at
https://docs.godotengine.org/en/stable/tutorials/plugins/editor/import_plugins.html#the-editorimportplugin-class
> The get_visible_name() method is responsible for returning the name of
> the type it imports and it will be shown to the user in the Import dock.
> You should choose this name as a continuation to "Import as", e.g.
> "Import as Silly Material"
I've verified Godot's behavior reflects this, so the code examples
should reflect this.
Also document propagating save error in EditorImportPlugin.
It seems that the suggested code ignores any error from
`ResourceSaver.save`, but I think we should return it.
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/EditorImportPlugin.xml | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index e5401134bf..aa64ab4043 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -16,7 +16,7 @@ return "my.special.plugin" func get_visible_name(): - return "Special Mesh Importer" + return "Special Mesh" func get_recognized_extensions(): return ["special", "spec"] @@ -44,8 +44,7 @@ # Fill the Mesh with data read in "file", left as an exercise to the reader. var filename = save_path + "." + get_save_extension() - ResourceSaver.save(filename, mesh) - return OK + return ResourceSaver.save(filename, mesh) [/gdscript] [csharp] using Godot; @@ -60,7 +59,7 @@ public override String GetVisibleName() { - return "Special Mesh Importer"; + return "Special Mesh"; } public override Godot.Collections.Array GetRecognizedExtensions() @@ -104,8 +103,7 @@ var mesh = new ArrayMesh(); // Fill the Mesh with data read in "file", left as an exercise to the reader. String filename = savePath + "." + GetSaveExtension(); - ResourceSaver.Save(filename, mesh); - return (int)Error.Ok; + return (int)ResourceSaver.Save(filename, mesh); } } [/csharp] @@ -220,7 +218,7 @@ <return type="String"> </return> <description> - Gets the name to display in the import window. + Gets the name to display in the import window. You should choose this name as a continuation to "Import as", e.g. "Import as Special Mesh". </description> </method> <method name="import" qualifiers="virtual"> |