1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Added ability for multiple images to be imported as an atlas

This adds support for groups in the import system, which point to a single file.
Add property hint for saving files in file field
This commit is contained in:
Juan Linietsky
2019-04-19 15:54:33 -03:00
parent 8e652a1400
commit 04847ef5f9
35 changed files with 1818 additions and 33 deletions

View File

@@ -438,6 +438,8 @@ void ImportDock::_reimport() {
Error err = config->load(params->paths[i] + ".import");
ERR_CONTINUE(err != OK);
String importer_name = params->importer->get_importer_name();
if (params->checking) {
//update only what edited (checkboxes)
for (List<PropertyInfo>::Element *E = params->properties.front(); E; E = E->next()) {
@@ -447,7 +449,7 @@ void ImportDock::_reimport() {
}
} else {
//override entirely
config->set_value("remap", "importer", params->importer->get_importer_name());
config->set_value("remap", "importer", importer_name);
config->erase_section("params");
for (List<PropertyInfo>::Element *E = params->properties.front(); E; E = E->next()) {
@@ -455,6 +457,19 @@ void ImportDock::_reimport() {
}
}
//handle group file
Ref<ResourceImporter> importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(importer_name);
ERR_CONTINUE(!importer.is_valid());
String group_file_property = importer->get_option_group_file();
if (group_file_property != String()) {
//can import from a group (as in, atlas)
ERR_CONTINUE(!params->values.has(group_file_property));
String group_file = params->values[group_file_property];
config->set_value("remap", "group_file", group_file);
} else {
config->set_value("remap", "group_file", Variant()); //clear group file if unused
}
config->save(params->paths[i] + ".import");
}