diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_file_system.cpp | 16 | ||||
-rw-r--r-- | editor/import/editor_import_collada.cpp | 16 | ||||
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 3 | ||||
-rw-r--r-- | editor/import/resource_importer_obj.cpp | 10 | ||||
-rw-r--r-- | editor/import/resource_importer_obj.h | 1 | ||||
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 4 | ||||
-rw-r--r-- | editor/import/resource_importer_scene.h | 1 | ||||
-rw-r--r-- | editor/node_3d_editor_gizmos.cpp | 48 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 2 |
9 files changed, 63 insertions, 38 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 6dcc505a11..738b88a86b 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -357,10 +357,12 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo List<String> to_check; + String importer_name; String source_file = ""; String source_md5 = ""; Vector<String> dest_files; String dest_md5 = ""; + int version = 0; while (true) { assign = Variant(); @@ -384,6 +386,10 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo for (int i = 0; i < fa.size(); i++) { to_check.push_back(fa[i]); } + } else if (assign == "importer_version") { + version = value; + } else if (assign == "importer") { + importer_name = value; } else if (!p_only_imported_files) { if (assign == "source_file") { source_file = value; @@ -399,6 +405,12 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo memdelete(f); + Ref<ResourceImporter> importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(importer_name); + + if (importer->get_format_version() > version) { + return true; // version changed, reimport + } + // Read the md5's from a separate file (so the import parameters aren't dependent on the file version String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(p_path); FileAccess *md5s = FileAccess::open(base_path + ".md5", FileAccess::READ, &err); @@ -1576,6 +1588,10 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector f->store_line("[remap]"); f->store_line(""); f->store_line("importer=\"" + importer->get_importer_name() + "\""); + int version = importer->get_format_version(); + if (version > 0) { + f->store_line("importer_version=" + itos(importer->get_format_version())); + } if (importer->get_resource_type() != "") { f->store_line("type=\"" + importer->get_resource_type() + "\""); } diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 12cbaaa885..41099dc8ea 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -844,19 +844,19 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me for (int k = 0; k < vertex_array.size(); k++) { if (normal_src) { - surftool->add_normal(vertex_array[k].normal); + surftool->set_normal(vertex_array[k].normal); if (binormal_src && tangent_src) { - surftool->add_tangent(vertex_array[k].tangent); + surftool->set_tangent(vertex_array[k].tangent); } } if (uv_src) { - surftool->add_uv(Vector2(vertex_array[k].uv.x, vertex_array[k].uv.y)); + surftool->set_uv(Vector2(vertex_array[k].uv.x, vertex_array[k].uv.y)); } if (uv2_src) { - surftool->add_uv2(Vector2(vertex_array[k].uv2.x, vertex_array[k].uv2.y)); + surftool->set_uv2(Vector2(vertex_array[k].uv2.x, vertex_array[k].uv2.y)); } if (color_src) { - surftool->add_color(vertex_array[k].color); + surftool->set_color(vertex_array[k].color); } if (has_weights) { @@ -876,8 +876,8 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me } } - surftool->add_bones(bones); - surftool->add_weights(weights); + surftool->set_bones(bones); + surftool->set_weights(weights); } surftool->add_vertex(vertex_array[k].vertex); @@ -923,7 +923,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me mr.push_back(a); } - p_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, d, mr, Dictionary(), p_use_compression ? Mesh::ARRAY_COMPRESS_DEFAULT : 0); + p_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, d, mr, Dictionary(), 0); if (material.is_valid()) { if (p_use_mesh_material) { diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 0c860a8965..c1877895ce 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -970,8 +970,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { return OK; } - bool compress_vert_data = state.import_flags & IMPORT_USE_COMPRESSION; - uint32_t mesh_flags = compress_vert_data ? Mesh::ARRAY_COMPRESS_DEFAULT : 0; + uint32_t mesh_flags = 0; Array meshes = state.json["meshes"]; for (GLTFMeshIndex i = 0; i < meshes.size(); i++) { diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index 49b47bf4be..d4560a2984 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -210,7 +210,7 @@ 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; Vector3 offset_mesh = p_offset_mesh; - int mesh_flags = p_optimize ? Mesh::ARRAY_COMPRESS_DEFAULT : 0; + int mesh_flags = 0; Vector<Vector3> vertices; Vector<Vector3> normals; @@ -294,7 +294,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_ norm += normals.size() + 1; } ERR_FAIL_INDEX_V(norm, normals.size(), ERR_FILE_CORRUPT); - surf_tool->add_normal(normals[norm]); + surf_tool->set_normal(normals[norm]); } if (face[idx].size() >= 2 && face[idx][1] != String()) { @@ -303,7 +303,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_ uv += uvs.size() + 1; } ERR_FAIL_INDEX_V(uv, uvs.size(), ERR_FILE_CORRUPT); - surf_tool->add_uv(uvs[uv]); + surf_tool->set_uv(uvs[uv]); } int vtx = face[idx][0].to_int() - 1; @@ -473,6 +473,10 @@ String ResourceImporterOBJ::get_resource_type() const { return "Mesh"; } +int ResourceImporterOBJ::get_format_version() const { + return 1; +} + int ResourceImporterOBJ::get_preset_count() const { return 0; } diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h index 4083bc7403..97f747b33c 100644 --- a/editor/import/resource_importer_obj.h +++ b/editor/import/resource_importer_obj.h @@ -54,6 +54,7 @@ public: 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_format_version() const override; virtual int get_preset_count() const override; virtual String get_preset_name(int p_idx) const override; diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 5dcdf6bec4..fc4f673ec4 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -172,6 +172,10 @@ String ResourceImporterScene::get_resource_type() const { return "PackedScene"; } +int ResourceImporterScene::get_format_version() const { + return 1; +} + bool ResourceImporterScene::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const { if (p_option.begins_with("animation/")) { if (p_option != "animation/import" && !bool(p_options["animation/import"])) { diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h index 465d11116b..cd61ec01f2 100644 --- a/editor/import/resource_importer_scene.h +++ b/editor/import/resource_importer_scene.h @@ -133,6 +133,7 @@ public: 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_format_version() const override; virtual int get_preset_count() const override; virtual String get_preset_name(int p_idx) const override; diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index b7f7d637d2..97bafdd167 100644 --- a/editor/node_3d_editor_gizmos.cpp +++ b/editor/node_3d_editor_gizmos.cpp @@ -1625,13 +1625,13 @@ void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { int pointidx = 0; for (int j = 0; j < 3; j++) { bones.write[0] = parent; - surface_tool->add_bones(bones); - surface_tool->add_weights(weights); - surface_tool->add_color(rootcolor); + surface_tool->set_bones(bones); + surface_tool->set_weights(weights); + surface_tool->set_color(rootcolor); surface_tool->add_vertex(v0 - grests[parent].basis[j].normalized() * dist * 0.05); - surface_tool->add_bones(bones); - surface_tool->add_weights(weights); - surface_tool->add_color(rootcolor); + surface_tool->set_bones(bones); + surface_tool->set_weights(weights); + surface_tool->set_color(rootcolor); surface_tool->add_vertex(v0 + grests[parent].basis[j].normalized() * dist * 0.05); if (j == closest) { @@ -1654,24 +1654,24 @@ void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { point += axis * dist * 0.1; bones.write[0] = parent; - surface_tool->add_bones(bones); - surface_tool->add_weights(weights); - surface_tool->add_color(bonecolor); + surface_tool->set_bones(bones); + surface_tool->set_weights(weights); + surface_tool->set_color(bonecolor); surface_tool->add_vertex(v0); - surface_tool->add_bones(bones); - surface_tool->add_weights(weights); - surface_tool->add_color(bonecolor); + surface_tool->set_bones(bones); + surface_tool->set_weights(weights); + surface_tool->set_color(bonecolor); surface_tool->add_vertex(point); bones.write[0] = parent; - surface_tool->add_bones(bones); - surface_tool->add_weights(weights); - surface_tool->add_color(bonecolor); + surface_tool->set_bones(bones); + surface_tool->set_weights(weights); + surface_tool->set_color(bonecolor); surface_tool->add_vertex(point); bones.write[0] = i; - surface_tool->add_bones(bones); - surface_tool->add_weights(weights); - surface_tool->add_color(bonecolor); + surface_tool->set_bones(bones); + surface_tool->set_weights(weights); + surface_tool->set_color(bonecolor); surface_tool->add_vertex(v1); points[pointidx++] = point; } @@ -1680,13 +1680,13 @@ void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { SWAP(points[1], points[2]); for (int j = 0; j < 4; j++) { bones.write[0] = parent; - surface_tool->add_bones(bones); - surface_tool->add_weights(weights); - surface_tool->add_color(bonecolor); + surface_tool->set_bones(bones); + surface_tool->set_weights(weights); + surface_tool->set_color(bonecolor); surface_tool->add_vertex(points[j]); - surface_tool->add_bones(bones); - surface_tool->add_weights(weights); - surface_tool->add_color(bonecolor); + surface_tool->set_bones(bones); + surface_tool->set_weights(weights); + surface_tool->set_color(bonecolor); surface_tool->add_vertex(points[(j + 1) % 4]); } diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 3bd5603acc..d0928683fd 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -5345,7 +5345,7 @@ void Node3DEditor::_init_indicators() { Vector2 ofs = Vector2(Math::cos((Math_PI * 2.0 * k) / m), Math::sin((Math_PI * 2.0 * k) / m)); Vector3 normal = ivec * ofs.x + ivec2 * ofs.y; - surftool->add_normal(basis.xform(normal)); + surftool->set_normal(basis.xform(normal)); surftool->add_vertex(vertex); } } |