feat: updated engine

This commit is contained in:
Sara Gerretsen 2026-07-10 17:04:34 +02:00
parent cbe99774ff
commit f4cf6b3999
6607 changed files with 910135 additions and 430025 deletions

View file

@ -30,12 +30,14 @@
#include "fbx_document.h"
#include "core/config/engine.h"
#include "core/config/project_settings.h"
#include "core/crypto/crypto_core.h"
#include "core/io/config_file.h"
#include "core/io/file_access.h"
#include "core/io/file_access_memory.h"
#include "core/io/image.h"
#include "core/io/resource_loader.h"
#include "core/math/color.h"
#include "scene/3d/bone_attachment_3d.h"
#include "scene/3d/camera_3d.h"
@ -56,11 +58,6 @@
#include "editor/file_system/editor_file_system.h"
#endif
// FIXME: Hardcoded to avoid editor dependency.
#define FBX_IMPORT_USE_NAMED_SKIN_BINDS 16
#define FBX_IMPORT_DISCARD_MESHES_AND_MATERIALS 32
#define FBX_IMPORT_FORCE_DISABLE_MESH_COMPRESSION 64
#include <ufbx.h>
static size_t _file_access_read_fn(void *user, void *data, size_t size) {
@ -761,8 +758,7 @@ Error FBXDocument::_parse_meshes(Ref<FBXState> p_state) {
mesh_surface_tool->set_skin_weight_count(num_skin_weights == 8 ? SurfaceTool::SKIN_8_WEIGHTS : SurfaceTool::SKIN_4_WEIGHTS);
mesh_surface_tool->index();
if (generate_tangents) {
//must generate mikktspace tangents.. ergh..
mesh_surface_tool->generate_tangents();
mesh_surface_tool->generate_tangents(/*split*/ !use_blend_shapes);
}
array = mesh_surface_tool->commit_to_arrays();
@ -831,8 +827,7 @@ Error FBXDocument::_parse_meshes(Ref<FBXState> p_state) {
blend_surface_tool->create_from_triangle_arrays(array_copy);
blend_surface_tool->set_skin_weight_count(num_skin_weights == 8 ? SurfaceTool::SKIN_8_WEIGHTS : SurfaceTool::SKIN_4_WEIGHTS);
if (generate_tangents) {
//must generate mikktspace tangents.. ergh..
blend_surface_tool->generate_tangents();
blend_surface_tool->generate_tangents(/*split*/ false);
}
array_copy = blend_surface_tool->commit_to_arrays();
@ -2169,8 +2164,8 @@ Error FBXDocument::append_from_buffer(const PackedByteArray &p_bytes, const Stri
ERR_FAIL_COND_V(state.is_null(), ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_bytes.ptr(), ERR_INVALID_DATA);
Error err = FAILED;
state->use_named_skin_binds = p_flags & FBX_IMPORT_USE_NAMED_SKIN_BINDS;
state->discard_meshes_and_materials = p_flags & FBX_IMPORT_DISCARD_MESHES_AND_MATERIALS;
state->use_named_skin_binds = p_flags & GLTFDocument::ImportFlags::IMPORT_FLAG_USE_NAMED_SKIN_BINDS;
state->discard_meshes_and_materials = p_flags & GLTFDocument::ImportFlags::IMPORT_FLAG_DISCARD_MESHES_AND_MATERIALS;
Ref<FileAccessMemory> file_access;
file_access.instantiate();
@ -2267,8 +2262,8 @@ Error FBXDocument::append_from_file(const String &p_path, Ref<GLTFState> p_state
p_state.instantiate();
}
state->filename = p_path.get_file().get_basename();
state->use_named_skin_binds = p_flags & FBX_IMPORT_USE_NAMED_SKIN_BINDS;
state->discard_meshes_and_materials = p_flags & FBX_IMPORT_DISCARD_MESHES_AND_MATERIALS;
state->use_named_skin_binds = p_flags & GLTFDocument::ImportFlags::IMPORT_FLAG_USE_NAMED_SKIN_BINDS;
state->discard_meshes_and_materials = p_flags & GLTFDocument::ImportFlags::IMPORT_FLAG_DISCARD_MESHES_AND_MATERIALS;
Error err;
Ref<FileAccess> file = FileAccess::open(p_path, FileAccess::READ, &err);
ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN);