2
0
Эх сурвалжийг харах

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.

(cherry picked from commit 9676650f2f7943ebbf9363fa65e47be62fb22164)
Ryan Roden-Corrent 4 жил өмнө
parent
commit
08d556f677

+ 3 - 4
doc/classes/EditorImportPlugin.xml

@@ -15,7 +15,7 @@
 		    return "my.special.plugin"
 		    return "my.special.plugin"
 
 
 		func get_visible_name():
 		func get_visible_name():
-		    return "Special Mesh Importer"
+		    return "Special Mesh"
 
 
 		func get_recognized_extensions():
 		func get_recognized_extensions():
 		    return ["special", "spec"]
 		    return ["special", "spec"]
@@ -44,8 +44,7 @@
 		    # Fill the Mesh with data read in "file", left as an exercise to the reader
 		    # Fill the Mesh with data read in "file", left as an exercise to the reader
 
 
 		    var filename = save_path + "." + get_save_extension()
 		    var filename = save_path + "." + get_save_extension()
-		    ResourceSaver.save(filename, mesh)
-		    return OK
+		    return ResourceSaver.save(filename, mesh)
 		[/codeblock]
 		[/codeblock]
 	</description>
 	</description>
 	<tutorials>
 	<tutorials>
@@ -143,7 +142,7 @@
 			<return type="String">
 			<return type="String">
 			</return>
 			</return>
 			<description>
 			<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>
 			</description>
 		</method>
 		</method>
 		<method name="import" qualifiers="virtual">
 		<method name="import" qualifiers="virtual">