You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Mark necessary EditorImportPlugin functions as required
This commit is contained in:
@@ -35,38 +35,28 @@
|
||||
|
||||
String EditorImportPlugin::get_importer_name() const {
|
||||
String ret;
|
||||
if (GDVIRTUAL_CALL(_get_importer_name, ret)) {
|
||||
return ret;
|
||||
}
|
||||
ERR_FAIL_V_MSG(String(), "Unimplemented _get_importer_name in add-on.");
|
||||
GDVIRTUAL_CALL(_get_importer_name, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
String EditorImportPlugin::get_visible_name() const {
|
||||
String ret;
|
||||
if (GDVIRTUAL_CALL(_get_visible_name, ret)) {
|
||||
return ret;
|
||||
}
|
||||
ERR_FAIL_V_MSG(String(), "Unimplemented _get_visible_name in add-on.");
|
||||
GDVIRTUAL_CALL(_get_visible_name, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void EditorImportPlugin::get_recognized_extensions(List<String> *p_extensions) const {
|
||||
Vector<String> extensions;
|
||||
|
||||
if (GDVIRTUAL_CALL(_get_recognized_extensions, extensions)) {
|
||||
for (int i = 0; i < extensions.size(); i++) {
|
||||
p_extensions->push_back(extensions[i]);
|
||||
}
|
||||
return;
|
||||
GDVIRTUAL_CALL(_get_recognized_extensions, extensions);
|
||||
for (int i = 0; i < extensions.size(); i++) {
|
||||
p_extensions->push_back(extensions[i]);
|
||||
}
|
||||
ERR_FAIL_MSG("Unimplemented _get_recognized_extensions in add-on.");
|
||||
}
|
||||
|
||||
String EditorImportPlugin::get_preset_name(int p_idx) const {
|
||||
String ret;
|
||||
if (GDVIRTUAL_CALL(_get_preset_name, p_idx, ret)) {
|
||||
return ret;
|
||||
}
|
||||
ERR_FAIL_V_MSG(itos(p_idx), "Unimplemented _get_preset_name in add-on.");
|
||||
GDVIRTUAL_CALL(_get_preset_name, p_idx, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int EditorImportPlugin::get_preset_count() const {
|
||||
@@ -79,18 +69,14 @@ int EditorImportPlugin::get_preset_count() const {
|
||||
|
||||
String EditorImportPlugin::get_save_extension() const {
|
||||
String ret;
|
||||
if (GDVIRTUAL_CALL(_get_save_extension, ret)) {
|
||||
return ret;
|
||||
}
|
||||
ERR_FAIL_V_MSG(String(), "Unimplemented _get_save_extension in add-on.");
|
||||
GDVIRTUAL_CALL(_get_save_extension, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
String EditorImportPlugin::get_resource_type() const {
|
||||
String ret;
|
||||
if (GDVIRTUAL_CALL(_get_resource_type, ret)) {
|
||||
return ret;
|
||||
}
|
||||
ERR_FAIL_V_MSG(String(), "Unimplemented _get_resource_type in add-on.");
|
||||
GDVIRTUAL_CALL(_get_resource_type, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
float EditorImportPlugin::get_priority() const {
|
||||
@@ -120,35 +106,31 @@ int EditorImportPlugin::get_format_version() const {
|
||||
void EditorImportPlugin::get_import_options(const String &p_path, List<ResourceImporter::ImportOption> *r_options, int p_preset) const {
|
||||
Array needed = { "name", "default_value" };
|
||||
TypedArray<Dictionary> options;
|
||||
if (GDVIRTUAL_CALL(_get_import_options, p_path, p_preset, options)) {
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
Dictionary d = options[i];
|
||||
ERR_FAIL_COND(!d.has_all(needed));
|
||||
String name = d["name"];
|
||||
Variant default_value = d["default_value"];
|
||||
GDVIRTUAL_CALL(_get_import_options, p_path, p_preset, options);
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
Dictionary d = options[i];
|
||||
ERR_FAIL_COND(!d.has_all(needed));
|
||||
String name = d["name"];
|
||||
Variant default_value = d["default_value"];
|
||||
|
||||
PropertyHint hint = PROPERTY_HINT_NONE;
|
||||
if (d.has("property_hint")) {
|
||||
hint = (PropertyHint)d["property_hint"].operator int64_t();
|
||||
}
|
||||
|
||||
String hint_string;
|
||||
if (d.has("hint_string")) {
|
||||
hint_string = d["hint_string"];
|
||||
}
|
||||
|
||||
uint32_t usage = PROPERTY_USAGE_DEFAULT;
|
||||
if (d.has("usage")) {
|
||||
usage = d["usage"];
|
||||
}
|
||||
|
||||
ImportOption option(PropertyInfo(default_value.get_type(), name, hint, hint_string, usage), default_value);
|
||||
r_options->push_back(option);
|
||||
PropertyHint hint = PROPERTY_HINT_NONE;
|
||||
if (d.has("property_hint")) {
|
||||
hint = (PropertyHint)d["property_hint"].operator int64_t();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ERR_FAIL_MSG("Unimplemented _get_import_options in add-on.");
|
||||
String hint_string;
|
||||
if (d.has("hint_string")) {
|
||||
hint_string = d["hint_string"];
|
||||
}
|
||||
|
||||
uint32_t usage = PROPERTY_USAGE_DEFAULT;
|
||||
if (d.has("usage")) {
|
||||
usage = d["usage"];
|
||||
}
|
||||
|
||||
ImportOption option(PropertyInfo(default_value.get_type(), name, hint, hint_string, usage), default_value);
|
||||
r_options->push_back(option);
|
||||
}
|
||||
}
|
||||
|
||||
bool EditorImportPlugin::get_option_visibility(const String &p_path, const String &p_option, const HashMap<StringName, Variant> &p_options) const {
|
||||
@@ -176,16 +158,14 @@ Error EditorImportPlugin::import(ResourceUID::ID p_source_id, const String &p_so
|
||||
}
|
||||
|
||||
Error err = OK;
|
||||
if (GDVIRTUAL_CALL(_import, p_source_file, p_save_path, options, platform_variants, gen_files, err)) {
|
||||
for (int i = 0; i < platform_variants.size(); i++) {
|
||||
r_platform_variants->push_back(platform_variants[i]);
|
||||
}
|
||||
for (int i = 0; i < gen_files.size(); i++) {
|
||||
r_gen_files->push_back(gen_files[i]);
|
||||
}
|
||||
return err;
|
||||
GDVIRTUAL_CALL(_import, p_source_file, p_save_path, options, platform_variants, gen_files, err);
|
||||
for (int i = 0; i < platform_variants.size(); i++) {
|
||||
r_platform_variants->push_back(platform_variants[i]);
|
||||
}
|
||||
ERR_FAIL_V_MSG(ERR_METHOD_NOT_FOUND, "Unimplemented _import in add-on.");
|
||||
for (int i = 0; i < gen_files.size(); i++) {
|
||||
r_gen_files->push_back(gen_files[i]);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
bool EditorImportPlugin::can_import_threaded() const {
|
||||
|
||||
Reference in New Issue
Block a user