summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/editor_import_plugin.h3
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp3
-rw-r--r--editor/import/resource_importer_bitmask.h2
-rw-r--r--editor/import/resource_importer_csv_translation.h3
-rw-r--r--editor/import/resource_importer_image.cpp5
-rw-r--r--editor/import/resource_importer_image.h3
-rw-r--r--editor/import/resource_importer_layered_texture.h2
-rw-r--r--editor/import/resource_importer_obj.cpp3
-rw-r--r--editor/import/resource_importer_obj.h3
-rw-r--r--editor/import/resource_importer_scene.cpp8
-rw-r--r--editor/import/resource_importer_scene.h4
-rw-r--r--editor/import/resource_importer_texture.cpp6
-rw-r--r--editor/import/resource_importer_texture.h2
-rw-r--r--editor/import/resource_importer_texture_atlas.cpp2
-rw-r--r--editor/import/resource_importer_texture_atlas.h2
-rw-r--r--editor/import/resource_importer_wav.cpp6
-rw-r--r--editor/import/resource_importer_wav.h3
17 files changed, 27 insertions, 33 deletions
diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h
index d396dd6d5b..eb119b4ba3 100644
--- a/editor/import/editor_import_plugin.h
+++ b/editor/import/editor_import_plugin.h
@@ -34,7 +34,8 @@
#include "core/io/resource_importer.h"
class EditorImportPlugin : public ResourceImporter {
- GDCLASS(EditorImportPlugin, Reference)
+ GDCLASS(EditorImportPlugin, ResourceImporter);
+
protected:
static void _bind_methods();
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index c97021433b..2bfc77325f 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -1326,9 +1326,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
if (bct.has("index")) {
Ref<Texture> t = _get_texture(state, bct["index"]);
material->set_texture(SpatialMaterial::TEXTURE_METALLIC, t);
- material->set_metallic_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_BLUE);
material->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, t);
- material->set_roughness_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_GREEN);
if (!mr.has("metallicFactor")) {
material->set_metallic(1);
}
@@ -1353,7 +1351,6 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
Dictionary bct = d["occlusionTexture"];
if (bct.has("index")) {
material->set_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION, _get_texture(state, bct["index"]));
- material->set_ao_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_RED);
material->set_feature(SpatialMaterial::FEATURE_AMBIENT_OCCLUSION, true);
}
}
diff --git a/editor/import/resource_importer_bitmask.h b/editor/import/resource_importer_bitmask.h
index 166fa998e4..6ae7608ff2 100644
--- a/editor/import/resource_importer_bitmask.h
+++ b/editor/import/resource_importer_bitmask.h
@@ -37,7 +37,7 @@
class StreamBitMap;
class ResourceImporterBitMap : public ResourceImporter {
- GDCLASS(ResourceImporterBitMap, ResourceImporter)
+ GDCLASS(ResourceImporterBitMap, ResourceImporter);
public:
virtual String get_importer_name() const;
diff --git a/editor/import/resource_importer_csv_translation.h b/editor/import/resource_importer_csv_translation.h
index 6785b68d87..c2753b326f 100644
--- a/editor/import/resource_importer_csv_translation.h
+++ b/editor/import/resource_importer_csv_translation.h
@@ -34,7 +34,8 @@
#include "core/io/resource_importer.h"
class ResourceImporterCSVTranslation : public ResourceImporter {
- GDCLASS(ResourceImporterCSVTranslation, ResourceImporter)
+ GDCLASS(ResourceImporterCSVTranslation, ResourceImporter);
+
public:
virtual String get_importer_name() const;
virtual String get_visible_name() const;
diff --git a/editor/import/resource_importer_image.cpp b/editor/import/resource_importer_image.cpp
index 1259e81be7..ed8ea5497a 100644
--- a/editor/import/resource_importer_image.cpp
+++ b/editor/import/resource_importer_image.cpp
@@ -77,9 +77,8 @@ void ResourceImporterImage::get_import_options(List<ImportOption> *r_options, in
Error ResourceImporterImage::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) {
FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ);
- if (!f) {
- ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
- }
+
+ ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
size_t len = f->get_len();
diff --git a/editor/import/resource_importer_image.h b/editor/import/resource_importer_image.h
index 3d5b99db2c..beadf5a8ea 100644
--- a/editor/import/resource_importer_image.h
+++ b/editor/import/resource_importer_image.h
@@ -35,7 +35,8 @@
#include "core/io/resource_importer.h"
class ResourceImporterImage : public ResourceImporter {
- GDCLASS(ResourceImporterImage, ResourceImporter)
+ GDCLASS(ResourceImporterImage, ResourceImporter);
+
public:
virtual String get_importer_name() const;
virtual String get_visible_name() const;
diff --git a/editor/import/resource_importer_layered_texture.h b/editor/import/resource_importer_layered_texture.h
index 6b393886b7..d6acbbabca 100644
--- a/editor/import/resource_importer_layered_texture.h
+++ b/editor/import/resource_importer_layered_texture.h
@@ -37,7 +37,7 @@
class StreamTexture;
class ResourceImporterLayeredTexture : public ResourceImporter {
- GDCLASS(ResourceImporterLayeredTexture, ResourceImporter)
+ GDCLASS(ResourceImporterLayeredTexture, ResourceImporter);
bool is_3d;
static const char *compression_formats[];
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index e950421476..868f67fd77 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -215,7 +215,6 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
bool generate_tangents = p_generate_tangents;
Vector3 scale_mesh = p_scale_mesh;
- bool flip_faces = false;
int mesh_flags = p_optimize ? Mesh::ARRAY_COMPRESS_DEFAULT : 0;
Vector<Vector3> vertices;
@@ -293,7 +292,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
int idx = j;
- if (!flip_faces && idx < 2) {
+ if (idx < 2) {
idx = 1 ^ idx;
}
diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h
index b2a53f582c..b96bc1b656 100644
--- a/editor/import/resource_importer_obj.h
+++ b/editor/import/resource_importer_obj.h
@@ -47,7 +47,8 @@ public:
};
class ResourceImporterOBJ : public ResourceImporter {
- GDCLASS(ResourceImporterOBJ, ResourceImporter)
+ GDCLASS(ResourceImporterOBJ, ResourceImporter);
+
public:
virtual String get_importer_name() const;
virtual String get_visible_name() const;
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 0989a43705..a8197ec2a2 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -1135,7 +1135,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "nodes/storage", PROPERTY_HINT_ENUM, "Single Scene,Instanced Sub-Scenes"), scenes_out ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/location", PROPERTY_HINT_ENUM, "Node,Mesh"), (meshes_out || materials_out) ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), materials_out ? 1 : 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/compress"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "meshes/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? 1 : 0));
@@ -1145,8 +1145,8 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 15));
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "animation/filter_script", PROPERTY_HINT_MULTILINE_TEXT), ""));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "animation/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), animations_out ? true : false));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/keep_custom_tracks"), animations_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "animation/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), animations_out));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/keep_custom_tracks"), animations_out));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/optimizer/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/optimizer/max_linear_error"), 0.05));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/optimizer/max_angular_error"), 0.01));
@@ -1237,7 +1237,7 @@ Ref<Animation> ResourceImporterScene::import_animation_from_other_importer(Edito
Error ResourceImporterScene::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) {
- String src_path = p_source_file;
+ const String &src_path = p_source_file;
Ref<EditorSceneImporter> importer;
String ext = src_path.get_extension().to_lower();
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index b10c4da2e5..498e0f6fb8 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -85,12 +85,12 @@ public:
String get_source_folder() const;
String get_source_file() const;
virtual Node *post_import(Node *p_scene);
- virtual void init(const String &p_scene_folder, const String &p_scene_path);
+ virtual void init(const String &p_source_folder, const String &p_source_file);
EditorScenePostImport();
};
class ResourceImporterScene : public ResourceImporter {
- GDCLASS(ResourceImporterScene, ResourceImporter)
+ GDCLASS(ResourceImporterScene, ResourceImporter);
Set<Ref<EditorSceneImporter> > importers;
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 5865ceb3af..25431179b5 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -205,11 +205,11 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options,
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/bptc_ldr", PROPERTY_HINT_ENUM, "Enabled,RGBA Only"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/normal_map", PROPERTY_HINT_ENUM, "Detect,Enable,Disabled"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "flags/repeat", PROPERTY_HINT_ENUM, "Disabled,Enabled,Mirrored"), p_preset == PRESET_3D ? 1 : 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/filter"), p_preset == PRESET_2D_PIXEL ? false : true));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/mipmaps"), p_preset == PRESET_3D ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/filter"), p_preset != PRESET_2D_PIXEL));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/mipmaps"), p_preset == PRESET_3D));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/anisotropic"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "flags/srgb", PROPERTY_HINT_ENUM, "Disable,Enable,Detect"), 2));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/fix_alpha_border"), p_preset != PRESET_3D ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/fix_alpha_border"), p_preset != PRESET_3D));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/premult_alpha"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/HDR_as_SRGB"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/invert_color"), false));
diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h
index ef74e4e41e..da712bf84d 100644
--- a/editor/import/resource_importer_texture.h
+++ b/editor/import/resource_importer_texture.h
@@ -37,7 +37,7 @@
class StreamTexture;
class ResourceImporterTexture : public ResourceImporter {
- GDCLASS(ResourceImporterTexture, ResourceImporter)
+ GDCLASS(ResourceImporterTexture, ResourceImporter);
protected:
enum {
diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp
index eca4e58abe..51a6cc6757 100644
--- a/editor/import/resource_importer_texture_atlas.cpp
+++ b/editor/import/resource_importer_texture_atlas.cpp
@@ -205,7 +205,7 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file
for (const Map<String, Map<StringName, Variant> >::Element *E = p_source_file_options.front(); E; E = E->next(), idx++) {
PackData &pack_data = pack_data_files.write[idx];
- String source = E->key();
+ const String &source = E->key();
const Map<StringName, Variant> &options = E->get();
Ref<Image> image;
diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h
index 042deacfe3..3c6fc343c4 100644
--- a/editor/import/resource_importer_texture_atlas.h
+++ b/editor/import/resource_importer_texture_atlas.h
@@ -34,7 +34,7 @@
#include "core/image.h"
#include "core/io/resource_importer.h"
class ResourceImporterTextureAtlas : public ResourceImporter {
- GDCLASS(ResourceImporterTextureAtlas, ResourceImporter)
+ GDCLASS(ResourceImporterTextureAtlas, ResourceImporter);
struct PackData {
Rect2 region;
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index e39f2dabaa..1787a3b88d 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -210,12 +210,6 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
print_line("bits: "+itos(format_bits));
*/
- int len = frames;
- if (format_channels == 2)
- len *= 2;
- if (format_bits > 8)
- len *= 2;
-
data.resize(frames * format_channels);
if (format_bits == 8) {
diff --git a/editor/import/resource_importer_wav.h b/editor/import/resource_importer_wav.h
index f993f9e7bc..24481ea46b 100644
--- a/editor/import/resource_importer_wav.h
+++ b/editor/import/resource_importer_wav.h
@@ -34,7 +34,8 @@
#include "core/io/resource_importer.h"
class ResourceImporterWAV : public ResourceImporter {
- GDCLASS(ResourceImporterWAV, ResourceImporter)
+ GDCLASS(ResourceImporterWAV, ResourceImporter);
+
public:
virtual String get_importer_name() const;
virtual String get_visible_name() const;