Fix example code for EditorImportPlugin

(cherry picked from commit 817f315eae)
This commit is contained in:
Noshyaar 2018-07-19 20:24:31 +07:00 committed by Rémi Verschelde
parent caea1601c4
commit b4b544ff73
1 changed files with 6 additions and 5 deletions

View File

@ -35,19 +35,20 @@
func get_import_options(i): func get_import_options(i):
return [{"name": "my_option", "default_value": false}] return [{"name": "my_option", "default_value": false}]
func load(src, dst, opts, r_platform_variants, r_gen_files): func import(source_file, save_path, options, r_platform_variants, r_gen_files):
var file = File.new() var file = File.new()
if file.open(src, File.READ) != OK: if file.open(source_file, File.READ) != OK:
return FAILED return FAILED
var mesh = Mesh.new() var mesh = Mesh.new()
var save = dst + "." + get_save_extension() var filename = save_path + "." + get_save_extension()
ResourceSaver.save(file, mesh) ResourceSaver.save(filename, mesh)
return OK return OK
[/codeblock] [/codeblock]
</description> </description>
<tutorials> <tutorials>
<link>http://docs.godotengine.org/en/3.0/tutorials/plugins/editor/import_plugins.html</link>
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -119,7 +120,7 @@
<return type="String"> <return type="String">
</return> </return>
<description> <description>
Get the godot resource type associated with this loader. e.g. "Mesh" or "Animation". Get the Godot resource type associated with this loader. e.g. "Mesh" or "Animation".
</description> </description>
</method> </method>
<method name="get_save_extension" qualifiers="virtual"> <method name="get_save_extension" qualifiers="virtual">