summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/collada.cpp34
-rw-r--r--editor/import/editor_import_collada.h8
-rw-r--r--editor/import/editor_import_plugin.h24
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp166
-rw-r--r--editor/import/editor_scene_importer_gltf.h8
-rw-r--r--editor/import/resource_importer_bitmask.h24
-rw-r--r--editor/import/resource_importer_csv.h20
-rw-r--r--editor/import/resource_importer_csv_translation.h20
-rw-r--r--editor/import/resource_importer_image.h20
-rw-r--r--editor/import/resource_importer_layered_texture.cpp113
-rw-r--r--editor/import/resource_importer_layered_texture.h28
-rw-r--r--editor/import/resource_importer_obj.h28
-rw-r--r--editor/import/resource_importer_scene.h30
-rw-r--r--editor/import/resource_importer_shader_file.h20
-rw-r--r--editor/import/resource_importer_texture.h24
-rw-r--r--editor/import/resource_importer_texture_atlas.h24
-rw-r--r--editor/import/resource_importer_wav.h20
17 files changed, 378 insertions, 233 deletions
diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp
index 41e71248a9..8eb68ecdcf 100644
--- a/editor/import/collada.cpp
+++ b/editor/import/collada.cpp
@@ -262,7 +262,7 @@ void Collada::_parse_asset(XMLParser &parser) {
COLLADA_PRINT("up axis: " + parser.get_node_data());
} else if (name == "unit") {
- state.unit_scale = parser.get_attribute_value("meter").to_double();
+ state.unit_scale = parser.get_attribute_value("meter").to_float();
COLLADA_PRINT("unit scale: " + rtos(state.unit_scale));
}
@@ -433,7 +433,7 @@ Transform Collada::_read_transform(XMLParser &parser) {
Vector<float> farr;
farr.resize(16);
for (int i = 0; i < 16; i++) {
- farr.write[i] = array[i].to_double();
+ farr.write[i] = array[i].to_float();
}
return _read_transform_from_array(farr);
@@ -469,7 +469,7 @@ Variant Collada::_parse_param(XMLParser &parser) {
if (parser.get_node_name() == "float") {
parser.read();
if (parser.get_node_type() == XMLParser::NODE_TEXT) {
- data = parser.get_node_data().to_double();
+ data = parser.get_node_data().to_float();
}
} else if (parser.get_node_name() == "float2") {
Vector<float> v2 = _read_float_array(parser);
@@ -735,29 +735,29 @@ void Collada::_parse_camera(XMLParser &parser) {
camera.mode = CameraData::MODE_ORTHOGONAL;
} else if (name == "xfov") {
parser.read();
- camera.perspective.x_fov = parser.get_node_data().to_double();
+ camera.perspective.x_fov = parser.get_node_data().to_float();
} else if (name == "yfov") {
parser.read();
- camera.perspective.y_fov = parser.get_node_data().to_double();
+ camera.perspective.y_fov = parser.get_node_data().to_float();
} else if (name == "xmag") {
parser.read();
- camera.orthogonal.x_mag = parser.get_node_data().to_double();
+ camera.orthogonal.x_mag = parser.get_node_data().to_float();
} else if (name == "ymag") {
parser.read();
- camera.orthogonal.y_mag = parser.get_node_data().to_double();
+ camera.orthogonal.y_mag = parser.get_node_data().to_float();
} else if (name == "aspect_ratio") {
parser.read();
- camera.aspect = parser.get_node_data().to_double();
+ camera.aspect = parser.get_node_data().to_float();
} else if (name == "znear") {
parser.read();
- camera.z_near = parser.get_node_data().to_double();
+ camera.z_near = parser.get_node_data().to_float();
} else if (name == "zfar") {
parser.read();
- camera.z_far = parser.get_node_data().to_double();
+ camera.z_far = parser.get_node_data().to_float();
}
} else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END && parser.get_node_name() == "camera") {
@@ -806,20 +806,20 @@ void Collada::_parse_light(XMLParser &parser) {
} else if (name == "constant_attenuation") {
parser.read();
- light.constant_att = parser.get_node_data().to_double();
+ light.constant_att = parser.get_node_data().to_float();
} else if (name == "linear_attenuation") {
parser.read();
- light.linear_att = parser.get_node_data().to_double();
+ light.linear_att = parser.get_node_data().to_float();
} else if (name == "quadratic_attenuation") {
parser.read();
- light.quad_att = parser.get_node_data().to_double();
+ light.quad_att = parser.get_node_data().to_float();
} else if (name == "falloff_angle") {
parser.read();
- light.spot_angle = parser.get_node_data().to_double();
+ light.spot_angle = parser.get_node_data().to_float();
} else if (name == "falloff_exponent") {
parser.read();
- light.spot_exp = parser.get_node_data().to_double();
+ light.spot_exp = parser.get_node_data().to_float();
}
} else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END && parser.get_node_name() == "light") {
@@ -1877,10 +1877,10 @@ void Collada::_parse_animation_clip(XMLParser &parser) {
clip.name = parser.get_attribute_value("id");
}
if (parser.has_attribute("start")) {
- clip.begin = parser.get_attribute_value("start").to_double();
+ clip.begin = parser.get_attribute_value("start").to_float();
}
if (parser.has_attribute("end")) {
- clip.end = parser.get_attribute_value("end").to_double();
+ clip.end = parser.get_attribute_value("end").to_float();
}
while (parser.read() == OK) {
diff --git a/editor/import/editor_import_collada.h b/editor/import/editor_import_collada.h
index 57c694b698..5fa17ebd02 100644
--- a/editor/import/editor_import_collada.h
+++ b/editor/import/editor_import_collada.h
@@ -37,10 +37,10 @@ class EditorSceneImporterCollada : public EditorSceneImporter {
GDCLASS(EditorSceneImporterCollada, EditorSceneImporter);
public:
- virtual uint32_t get_import_flags() const;
- virtual void get_extensions(List<String> *r_extensions) const;
- virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = nullptr, Error *r_err = nullptr);
- virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps);
+ virtual uint32_t get_import_flags() const override;
+ virtual void get_extensions(List<String> *r_extensions) const override;
+ virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = nullptr, Error *r_err = nullptr) override;
+ virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps) override;
EditorSceneImporterCollada();
};
diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h
index be4679b6d3..00a7d9efba 100644
--- a/editor/import/editor_import_plugin.h
+++ b/editor/import/editor_import_plugin.h
@@ -41,18 +41,18 @@ protected:
public:
EditorImportPlugin();
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_preset_name(int p_idx) const;
- virtual int get_preset_count() const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
- virtual float get_priority() const;
- virtual int get_import_order() const;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata = nullptr);
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_preset_name(int p_idx) const override;
+ virtual int get_preset_count() const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
+ virtual float get_priority() const override;
+ virtual int get_import_order() const override;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata = nullptr) override;
};
#endif //EDITOR_IMPORT_PLUGIN_H
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 683db0e31d..266df78949 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -184,8 +184,11 @@ String EditorSceneImporterGLTF::_gen_unique_name(GLTFState &state, const String
String EditorSceneImporterGLTF::_sanitize_bone_name(const String &name) {
String p_name = name.camelcase_to_underscore(true);
- RegEx pattern_del("([^a-zA-Z0-9_ ])+");
- p_name = pattern_del.sub(p_name, "", true);
+ RegEx pattern_nocolon(":");
+ p_name = pattern_nocolon.sub(p_name, "_", true);
+
+ RegEx pattern_noslash("/");
+ p_name = pattern_noslash.sub(p_name, "_", true);
RegEx pattern_nospace(" +");
p_name = pattern_nospace.sub(p_name, "_", true);
@@ -200,8 +203,10 @@ String EditorSceneImporterGLTF::_sanitize_bone_name(const String &name) {
}
String EditorSceneImporterGLTF::_gen_unique_bone_name(GLTFState &state, const GLTFSkeletonIndex skel_i, const String &p_name) {
- const String s_name = _sanitize_bone_name(p_name);
-
+ String s_name = _sanitize_bone_name(p_name);
+ if (s_name.empty()) {
+ s_name = "bone";
+ }
String name;
int index = 1;
while (true) {
@@ -379,13 +384,17 @@ Error EditorSceneImporterGLTF::_parse_buffers(GLTFState &state, const String &p_
Vector<uint8_t> buffer_data;
String uri = buffer["uri"];
- if (uri.findn("data:application/octet-stream;base64") == 0) {
- //embedded data
+ if (uri.begins_with("data:")) { // Embedded data using base64.
+ // Validate data MIME types and throw an error if it's one we don't know/support.
+ if (!uri.begins_with("data:application/octet-stream;base64") &&
+ !uri.begins_with("data:application/gltf-buffer;base64")) {
+ ERR_PRINT("glTF: Got buffer with an unknown URI data type: " + uri);
+ }
buffer_data = _parse_base64_uri(uri);
- } else {
- uri = p_base_path.plus_file(uri).replace("\\", "/"); //fix for windows
+ } else { // Relative path to an external image file.
+ uri = p_base_path.plus_file(uri).replace("\\", "/"); // Fix for Windows.
buffer_data = FileAccess::get_file_as_array(uri);
- ERR_FAIL_COND_V(buffer.size() == 0, ERR_PARSE_ERROR);
+ ERR_FAIL_COND_V_MSG(buffer.size() == 0, ERR_PARSE_ERROR, "glTF: Couldn't load binary file as an array: " + uri);
}
ERR_FAIL_COND_V(!buffer.has("byteLength"), ERR_PARSE_ERROR);
@@ -1226,13 +1235,23 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
const Ref<Material> &mat = state.materials[material];
mesh.mesh->surface_set_material(mesh.mesh->get_surface_count() - 1, mat);
+ } else {
+ Ref<StandardMaterial3D> mat;
+ mat.instance();
+ mat->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+
+ mesh.mesh->surface_set_material(mesh.mesh->get_surface_count() - 1, mat);
}
}
+ mesh.blend_weights.resize(mesh.mesh->get_blend_shape_count());
+ for (int32_t weight_i = 0; weight_i < mesh.blend_weights.size(); weight_i++) {
+ mesh.blend_weights.write[weight_i] = 0.0f;
+ }
+
if (d.has("weights")) {
const Array &weights = d["weights"];
- ERR_FAIL_COND_V(mesh.mesh->get_blend_shape_count() != weights.size(), ERR_PARSE_ERROR);
- mesh.blend_weights.resize(weights.size());
+ ERR_FAIL_COND_V(mesh.blend_weights.size() != weights.size(), ERR_PARSE_ERROR);
for (int j = 0; j < weights.size(); j++) {
mesh.blend_weights.write[j] = weights[j];
}
@@ -1251,12 +1270,28 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
return OK;
}
+ // Ref: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#images
+
const Array &images = state.json["images"];
for (int i = 0; i < images.size(); i++) {
const Dictionary &d = images[i];
+ // glTF 2.0 supports PNG and JPEG types, which can be specified as (from spec):
+ // "- a URI to an external file in one of the supported images formats, or
+ // - a URI with embedded base64-encoded data, or
+ // - a reference to a bufferView; in that case mimeType must be defined."
+ // Since mimeType is optional for external files and base64 data, we'll have to
+ // fall back on letting Godot parse the data to figure out if it's PNG or JPEG.
+
+ // We'll assume that we use either URI or bufferView, so let's warn the user
+ // if their image somehow uses both. And fail if it has neither.
+ ERR_CONTINUE_MSG(!d.has("uri") && !d.has("bufferView"), "Invalid image definition in glTF file, it should specific an 'uri' or 'bufferView'.");
+ if (d.has("uri") && d.has("bufferView")) {
+ WARN_PRINT("Invalid image definition in glTF file using both 'uri' and 'bufferView'. 'bufferView' will take precedence.");
+ }
+
String mimetype;
- if (d.has("mimeType")) {
+ if (d.has("mimeType")) { // Should be "image/png" or "image/jpeg".
mimetype = d["mimeType"];
}
@@ -1265,23 +1300,52 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
int data_size = 0;
if (d.has("uri")) {
+ // Handles the first two bullet points from the spec (embedded data, or external file).
String uri = d["uri"];
- if (uri.findn("data:application/octet-stream;base64") == 0 ||
- uri.findn("data:" + mimetype + ";base64") == 0) {
- //embedded data
+ if (uri.begins_with("data:")) { // Embedded data using base64.
+ // Validate data MIME types and throw an error if it's one we don't know/support.
+ if (!uri.begins_with("data:application/octet-stream;base64") &&
+ !uri.begins_with("data:application/gltf-buffer;base64") &&
+ !uri.begins_with("data:image/png;base64") &&
+ !uri.begins_with("data:image/jpeg;base64")) {
+ ERR_PRINT("glTF: Got image data with an unknown URI data type: " + uri);
+ }
data = _parse_base64_uri(uri);
data_ptr = data.ptr();
data_size = data.size();
- } else {
- uri = p_base_path.plus_file(uri).replace("\\", "/"); //fix for windows
- Ref<Texture2D> texture = ResourceLoader::load(uri);
- state.images.push_back(texture);
- continue;
+ // mimeType is optional, but if we have it defined in the URI, let's use it.
+ if (mimetype.empty()) {
+ if (uri.begins_with("data:image/png;base64")) {
+ mimetype = "image/png";
+ } else if (uri.begins_with("data:image/jpeg;base64")) {
+ mimetype = "image/jpeg";
+ }
+ }
+ } else { // Relative path to an external image file.
+ uri = p_base_path.plus_file(uri).replace("\\", "/"); // Fix for Windows.
+ // The spec says that if mimeType is defined, we should enforce it.
+ // So we should only rely on ResourceLoader::load if mimeType is not defined,
+ // otherwise we should use the same logic as for buffers.
+ if (mimetype == "image/png" || mimetype == "image/jpeg") {
+ // Load data buffer and rely on PNG and JPEG-specific logic below to load the image.
+ // This makes it possible to load a file with a wrong extension but correct MIME type,
+ // e.g. "foo.jpg" containing PNG data and with MIME type "image/png". ResourceLoader would fail.
+ data = FileAccess::get_file_as_array(uri);
+ ERR_FAIL_COND_V_MSG(data.size() == 0, ERR_PARSE_ERROR, "glTF: Couldn't load image file as an array: " + uri);
+ data_ptr = data.ptr();
+ data_size = data.size();
+ } else {
+ // Good old ResourceLoader will rely on file extension.
+ Ref<Texture2D> texture = ResourceLoader::load(uri);
+ state.images.push_back(texture);
+ continue;
+ }
}
- }
+ } else if (d.has("bufferView")) {
+ // Handles the third bullet point from the spec (bufferView).
+ ERR_FAIL_COND_V_MSG(mimetype.empty(), ERR_FILE_CORRUPT, "glTF: Image specifies 'bufferView' but no 'mimeType', which is invalid.");
- if (d.has("bufferView")) {
const GLTFBufferViewIndex bvi = d["bufferView"];
ERR_FAIL_INDEX_V(bvi, state.buffer_views.size(), ERR_PARAMETER_RANGE_ERROR);
@@ -1297,45 +1361,36 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
data_size = bv.byte_length;
}
- ERR_FAIL_COND_V(mimetype == "", ERR_FILE_CORRUPT);
+ Ref<Image> img;
- if (mimetype.findn("png") != -1) {
- //is a png
+ if (mimetype == "image/png") { // Load buffer as PNG.
ERR_FAIL_COND_V(Image::_png_mem_loader_func == nullptr, ERR_UNAVAILABLE);
-
- const Ref<Image> img = Image::_png_mem_loader_func(data_ptr, data_size);
-
- ERR_FAIL_COND_V(img.is_null(), ERR_FILE_CORRUPT);
-
- Ref<ImageTexture> t;
- t.instance();
- t->create_from_image(img);
-
- state.images.push_back(t);
- continue;
- }
-
- if (mimetype.findn("jpeg") != -1) {
- //is a jpg
+ img = Image::_png_mem_loader_func(data_ptr, data_size);
+ } else if (mimetype == "image/jpeg") { // Loader buffer as JPEG.
ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == nullptr, ERR_UNAVAILABLE);
+ img = Image::_jpg_mem_loader_func(data_ptr, data_size);
+ } else {
+ // We can land here if we got an URI with base64-encoded data with application/* MIME type,
+ // and the optional mimeType property was not defined to tell us how to handle this data (or was invalid).
+ // So let's try PNG first, then JPEG.
+ ERR_FAIL_COND_V(Image::_png_mem_loader_func == nullptr, ERR_UNAVAILABLE);
+ img = Image::_png_mem_loader_func(data_ptr, data_size);
+ if (img.is_null()) {
+ ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == nullptr, ERR_UNAVAILABLE);
+ img = Image::_jpg_mem_loader_func(data_ptr, data_size);
+ }
+ }
- const Ref<Image> img = Image::_jpg_mem_loader_func(data_ptr, data_size);
-
- ERR_FAIL_COND_V(img.is_null(), ERR_FILE_CORRUPT);
-
- Ref<ImageTexture> t;
- t.instance();
- t->create_from_image(img);
-
- state.images.push_back(t);
+ ERR_FAIL_COND_V_MSG(img.is_null(), ERR_FILE_CORRUPT, "glTF: Couldn't load image with its given mimetype: " + mimetype);
- continue;
- }
+ Ref<ImageTexture> t;
+ t.instance();
+ t->create_from_image(img);
- ERR_FAIL_V(ERR_FILE_CORRUPT);
+ state.images.push_back(t);
}
- print_verbose("Total images: " + itos(state.images.size()));
+ print_verbose("glTF: Total images: " + itos(state.images.size()));
return OK;
}
@@ -1382,6 +1437,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
if (d.has("name")) {
material->set_name(d["name"]);
}
+ material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
if (d.has("pbrMetallicRoughness")) {
const Dictionary &mr = d["pbrMetallicRoughness"];
@@ -1494,7 +1550,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
state.materials.push_back(material);
}
- print_verbose("Total materials: " + itos(state.materials.size()));
+ print_verbose("glTF: Total materials: " + itos(state.materials.size()));
return OK;
}
@@ -3045,6 +3101,8 @@ Node3D *EditorSceneImporterGLTF::_generate_scene(GLTFState &state, const int p_b
}
Node *EditorSceneImporterGLTF::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) {
+ print_verbose(vformat("glTF: Importing file %s as scene.", p_path));
+
GLTFState state;
if (p_path.to_lower().ends_with("glb")) {
diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h
index 95c6b87af5..bd30f8f1dd 100644
--- a/editor/import/editor_scene_importer_gltf.h
+++ b/editor/import/editor_scene_importer_gltf.h
@@ -387,10 +387,10 @@ class EditorSceneImporterGLTF : public EditorSceneImporter {
void _import_animation(GLTFState &state, AnimationPlayer *ap, const GLTFAnimationIndex index, const int bake_fps);
public:
- virtual uint32_t get_import_flags() const;
- virtual void get_extensions(List<String> *r_extensions) const;
- virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = nullptr, Error *r_err = nullptr);
- virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps);
+ virtual uint32_t get_import_flags() const override;
+ virtual void get_extensions(List<String> *r_extensions) const override;
+ virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = nullptr, Error *r_err = nullptr) override;
+ virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps) override;
EditorSceneImporterGLTF();
};
diff --git a/editor/import/resource_importer_bitmask.h b/editor/import/resource_importer_bitmask.h
index 927fac566e..0d3cb23697 100644
--- a/editor/import/resource_importer_bitmask.h
+++ b/editor/import/resource_importer_bitmask.h
@@ -40,18 +40,18 @@ class ResourceImporterBitMap : public ResourceImporter {
GDCLASS(ResourceImporterBitMap, ResourceImporter);
public:
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
-
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
-
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
+
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
+
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
ResourceImporterBitMap();
~ResourceImporterBitMap();
diff --git a/editor/import/resource_importer_csv.h b/editor/import/resource_importer_csv.h
index 7aa48f68de..c9fbe75dd2 100644
--- a/editor/import/resource_importer_csv.h
+++ b/editor/import/resource_importer_csv.h
@@ -37,19 +37,19 @@ class ResourceImporterCSV : public ResourceImporter {
GDCLASS(ResourceImporterCSV, ResourceImporter);
public:
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
ResourceImporterCSV();
};
diff --git a/editor/import/resource_importer_csv_translation.h b/editor/import/resource_importer_csv_translation.h
index 742f6b8f60..7c7646b640 100644
--- a/editor/import/resource_importer_csv_translation.h
+++ b/editor/import/resource_importer_csv_translation.h
@@ -37,19 +37,19 @@ class ResourceImporterCSVTranslation : public ResourceImporter {
GDCLASS(ResourceImporterCSVTranslation, ResourceImporter);
public:
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
ResourceImporterCSVTranslation();
};
diff --git a/editor/import/resource_importer_image.h b/editor/import/resource_importer_image.h
index abb74d0665..dc9c2c3014 100644
--- a/editor/import/resource_importer_image.h
+++ b/editor/import/resource_importer_image.h
@@ -38,19 +38,19 @@ class ResourceImporterImage : public ResourceImporter {
GDCLASS(ResourceImporterImage, ResourceImporter);
public:
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
ResourceImporterImage();
};
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index b57ea3745d..bbf62596d0 100644
--- a/editor/import/resource_importer_layered_texture.cpp
+++ b/editor/import/resource_importer_layered_texture.cpp
@@ -70,7 +70,7 @@ String ResourceImporterLayeredTexture::get_visible_name() const {
return "CubemapArray";
} break;
case MODE_3D: {
- return "3D";
+ return "Texture3D";
} break;
}
@@ -156,15 +156,103 @@ void ResourceImporterLayeredTexture::get_import_options(List<ImportOption> *r_op
}
void ResourceImporterLayeredTexture::_save_tex(Vector<Ref<Image>> p_images, const String &p_to_path, int p_compress_mode, float p_lossy, Image::CompressMode p_vram_compression, Image::CompressSource p_csource, Image::UsedChannels used_channels, bool p_mipmaps, bool p_force_po2) {
- for (int i = 0; i < p_images.size(); i++) {
- if (p_force_po2) {
- p_images.write[i]->resize_to_po2();
+ Vector<Ref<Image>> mipmap_images; //for 3D
+
+ if (mode == MODE_3D) {
+ //3D saves in its own way
+
+ for (int i = 0; i < p_images.size(); i++) {
+ if (p_images.write[i]->has_mipmaps()) {
+ p_images.write[i]->clear_mipmaps();
+ }
+
+ if (p_force_po2) {
+ p_images.write[i]->resize_to_po2();
+ }
}
if (p_mipmaps) {
- p_images.write[i]->generate_mipmaps();
- } else {
- p_images.write[i]->clear_mipmaps();
+ Vector<Ref<Image>> parent_images = p_images;
+ //create 3D mipmaps, this is horrible, though not used very often
+ int w = p_images[0]->get_width();
+ int h = p_images[0]->get_height();
+ int d = p_images.size();
+
+ while (w > 1 || h > 1 || d > 1) {
+ Vector<Ref<Image>> mipmaps;
+ int mm_w = MAX(1, w >> 1);
+ int mm_h = MAX(1, h >> 1);
+ int mm_d = MAX(1, d >> 1);
+
+ for (int i = 0; i < mm_d; i++) {
+ Ref<Image> mm;
+ mm.instance();
+ mm->create(mm_w, mm_h, false, p_images[0]->get_format());
+ Vector3 pos;
+ pos.z = float(i) * float(d) / float(mm_d) + 0.5;
+ for (int x = 0; x < mm_w; x++) {
+ for (int y = 0; y < mm_h; y++) {
+ pos.x = float(x) * float(w) / float(mm_w) + 0.5;
+ pos.y = float(y) * float(h) / float(mm_h) + 0.5;
+
+ Vector3i posi = Vector3i(pos);
+ Vector3 fract = pos - Vector3(posi);
+ Vector3i posi_n = posi;
+ if (posi_n.x < w - 1) {
+ posi_n.x++;
+ }
+ if (posi_n.y < h - 1) {
+ posi_n.y++;
+ }
+ if (posi_n.z < d - 1) {
+ posi_n.z++;
+ }
+
+ Color c000 = parent_images[posi.z]->get_pixel(posi.x, posi.y);
+ Color c100 = parent_images[posi.z]->get_pixel(posi_n.x, posi.y);
+ Color c010 = parent_images[posi.z]->get_pixel(posi.x, posi_n.y);
+ Color c110 = parent_images[posi.z]->get_pixel(posi_n.x, posi_n.y);
+ Color c001 = parent_images[posi_n.z]->get_pixel(posi.x, posi.y);
+ Color c101 = parent_images[posi_n.z]->get_pixel(posi_n.x, posi.y);
+ Color c011 = parent_images[posi_n.z]->get_pixel(posi.x, posi_n.y);
+ Color c111 = parent_images[posi_n.z]->get_pixel(posi_n.x, posi_n.y);
+
+ Color cx00 = c000.lerp(c100, fract.x);
+ Color cx01 = c001.lerp(c101, fract.x);
+ Color cx10 = c010.lerp(c110, fract.x);
+ Color cx11 = c011.lerp(c111, fract.x);
+
+ Color cy0 = cx00.lerp(cx10, fract.y);
+ Color cy1 = cx01.lerp(cx11, fract.y);
+
+ Color cz = cy0.lerp(cy1, fract.z);
+
+ mm->set_pixel(x, y, cz);
+ }
+ }
+
+ mipmaps.push_back(mm);
+ }
+
+ w = mm_w;
+ h = mm_h;
+ d = mm_d;
+
+ mipmap_images.append_array(mipmaps);
+ parent_images = mipmaps;
+ }
+ }
+ } else {
+ for (int i = 0; i < p_images.size(); i++) {
+ if (p_force_po2) {
+ p_images.write[i]->resize_to_po2();
+ }
+
+ if (p_mipmaps) {
+ p_images.write[i]->generate_mipmaps();
+ } else {
+ p_images.write[i]->clear_mipmaps();
+ }
}
}
@@ -175,13 +263,12 @@ void ResourceImporterLayeredTexture::_save_tex(Vector<Ref<Image>> p_images, cons
f->store_8('L');
f->store_32(StreamTextureLayered::FORMAT_VERSION);
- f->store_32(p_images.size());
+ f->store_32(p_images.size()); //2d layers or 3d depth
f->store_32(mode);
- f->store_32(0); //dataformat
- f->store_32(0); //mipmap limit
+ f->store_32(0);
- //reserverd
f->store_32(0);
+ f->store_32(mipmap_images.size()); // amount of mipmaps
f->store_32(0);
f->store_32(0);
@@ -189,6 +276,10 @@ void ResourceImporterLayeredTexture::_save_tex(Vector<Ref<Image>> p_images, cons
ResourceImporterTexture::save_to_stex_format(f, p_images[i], ResourceImporterTexture::CompressMode(p_compress_mode), used_channels, p_vram_compression, p_lossy);
}
+ for (int i = 0; i < mipmap_images.size(); i++) {
+ ResourceImporterTexture::save_to_stex_format(f, mipmap_images[i], ResourceImporterTexture::CompressMode(p_compress_mode), used_channels, p_vram_compression, p_lossy);
+ }
+
f->close();
}
diff --git a/editor/import/resource_importer_layered_texture.h b/editor/import/resource_importer_layered_texture.h
index 18eaf31f6b..b54923be00 100644
--- a/editor/import/resource_importer_layered_texture.h
+++ b/editor/import/resource_importer_layered_texture.h
@@ -93,19 +93,15 @@ private:
static const char *compression_formats[];
protected:
- static void _texture_reimport_srgb(const Ref<StreamTexture2D> &p_tex);
- static void _texture_reimport_3d(const Ref<StreamTexture2D> &p_tex);
- static void _texture_reimport_normal(const Ref<StreamTexture2D> &p_tex);
-
static ResourceImporterLayeredTexture *singleton;
public:
static ResourceImporterLayeredTexture *get_singleton() { return singleton; }
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
enum CompressMode {
COMPRESS_LOSSLESS,
@@ -115,20 +111,20 @@ public:
COMPRESS_BASIS_UNIVERSAL
};
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
void _save_tex(Vector<Ref<Image>> p_images, const String &p_to_path, int p_compress_mode, float p_lossy, Image::CompressMode p_vram_compression, Image::CompressSource p_csource, Image::UsedChannels used_channels, bool p_mipmaps, bool p_force_po2);
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
void update_imports();
- virtual bool are_import_settings_valid(const String &p_path) const;
- virtual String get_import_settings_string() const;
+ virtual bool are_import_settings_valid(const String &p_path) const override;
+ virtual String get_import_settings_string() const override;
void set_mode(Mode p_mode) { mode = p_mode; }
diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h
index aec5de3dcc..4083bc7403 100644
--- a/editor/import/resource_importer_obj.h
+++ b/editor/import/resource_importer_obj.h
@@ -37,10 +37,10 @@ class EditorOBJImporter : public EditorSceneImporter {
GDCLASS(EditorOBJImporter, EditorSceneImporter);
public:
- virtual uint32_t get_import_flags() const;
- virtual void get_extensions(List<String> *r_extensions) const;
- virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr);
- virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps);
+ virtual uint32_t get_import_flags() const override;
+ virtual void get_extensions(List<String> *r_extensions) const override;
+ virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr) override;
+ virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps) override;
EditorOBJImporter();
};
@@ -49,19 +49,19 @@ class ResourceImporterOBJ : public ResourceImporter {
GDCLASS(ResourceImporterOBJ, ResourceImporter);
public:
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
ResourceImporterOBJ();
};
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index 34d96bbc44..465d11116b 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -128,18 +128,18 @@ public:
void add_importer(Ref<EditorSceneImporter> p_importer) { importers.insert(p_importer); }
void remove_importer(Ref<EditorSceneImporter> p_importer) { importers.erase(p_importer); }
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual int get_import_order() const { return 100; } //after everything
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
+ virtual int get_import_order() const override { return 100; } //after everything
void _find_meshes(Node *p_node, Map<Ref<ArrayMesh>, Transform> &meshes);
@@ -152,7 +152,7 @@ public:
void _filter_tracks(Node *scene, const String &p_text);
void _optimize_animations(Node *scene, float p_max_lin_error, float p_max_ang_error, float p_max_angle);
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
Node *import_scene_from_other_importer(EditorSceneImporter *p_exception, const String &p_path, uint32_t p_flags, int p_bake_fps);
Ref<Animation> import_animation_from_other_importer(EditorSceneImporter *p_exception, const String &p_path, uint32_t p_flags, int p_bake_fps);
@@ -164,10 +164,10 @@ class EditorSceneImporterESCN : public EditorSceneImporter {
GDCLASS(EditorSceneImporterESCN, EditorSceneImporter);
public:
- virtual uint32_t get_import_flags() const;
- virtual void get_extensions(List<String> *r_extensions) const;
- virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr);
- virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps);
+ virtual uint32_t get_import_flags() const override;
+ virtual void get_extensions(List<String> *r_extensions) const override;
+ virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr) override;
+ virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps) override;
};
#endif // RESOURCEIMPORTERSCENE_H
diff --git a/editor/import/resource_importer_shader_file.h b/editor/import/resource_importer_shader_file.h
index fa95ceecc1..66ae626c51 100644
--- a/editor/import/resource_importer_shader_file.h
+++ b/editor/import/resource_importer_shader_file.h
@@ -37,19 +37,19 @@ class ResourceImporterShaderFile : public ResourceImporter {
GDCLASS(ResourceImporterShaderFile, ResourceImporter);
public:
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
ResourceImporterShaderFile();
};
diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h
index 12eb7f67c2..bc41aacae5 100644
--- a/editor/import/resource_importer_texture.h
+++ b/editor/import/resource_importer_texture.h
@@ -84,11 +84,11 @@ public:
static void save_to_stex_format(FileAccess *f, const Ref<Image> &p_image, CompressMode p_compress_mode, Image::UsedChannels p_channels, Image::CompressMode p_compress_format, float p_lossy_quality);
static ResourceImporterTexture *get_singleton() { return singleton; }
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
enum Preset {
PRESET_DETECT,
@@ -96,18 +96,18 @@ public:
PRESET_3D,
};
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
void update_imports();
- virtual bool are_import_settings_valid(const String &p_path) const;
- virtual String get_import_settings_string() const;
+ virtual bool are_import_settings_valid(const String &p_path) const override;
+ virtual String get_import_settings_string() const override;
ResourceImporterTexture();
~ResourceImporterTexture();
diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h
index c61fa5c040..25a662a333 100644
--- a/editor/import/resource_importer_texture_atlas.h
+++ b/editor/import/resource_importer_texture_atlas.h
@@ -50,21 +50,21 @@ public:
IMPORT_MODE_2D_MESH
};
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual String get_option_group_file() const;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
+ virtual String get_option_group_file() const override;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
- virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
+ virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths) override;
ResourceImporterTextureAtlas();
};
diff --git a/editor/import/resource_importer_wav.h b/editor/import/resource_importer_wav.h
index 3ff3aea9f4..3c4a8757eb 100644
--- a/editor/import/resource_importer_wav.h
+++ b/editor/import/resource_importer_wav.h
@@ -37,17 +37,17 @@ class ResourceImporterWAV : public ResourceImporter {
GDCLASS(ResourceImporterWAV, ResourceImporter);
public:
- virtual String get_importer_name() const;
- virtual String get_visible_name() const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual String get_save_extension() const;
- virtual String get_resource_type() const;
+ virtual String get_importer_name() const override;
+ virtual String get_visible_name() const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual String get_save_extension() const override;
+ virtual String get_resource_type() const override;
- virtual int get_preset_count() const;
- virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count() const override;
+ virtual String get_preset_name(int p_idx) const override;
- virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
- virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const override;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override;
static void _compress_ima_adpcm(const Vector<float> &p_data, Vector<uint8_t> &dst_data) {
/*p_sample_data->data = (void*)malloc(len);
@@ -162,7 +162,7 @@ public:
}
}
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
ResourceImporterWAV();
};