Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions modules/fbx/fbx_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ GLTFImageIndex FBXDocument::_parse_image_save_image(Ref<FBXState> p_state, const
return p_state->images.size() - 1;
}

Error FBXDocument::_parse_images(Ref<FBXState> p_state, const String &p_base_path) {
Error FBXDocument::_parse_images(Ref<FBXState> p_state) {
ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);

const ufbx_scene *fbx_scene = p_state->scene.get();
Expand All @@ -1059,8 +1059,8 @@ Error FBXDocument::_parse_images(Ref<FBXState> p_state, const String &p_base_pat
if (path.is_absolute_path()) {
path = path.get_file();
}
if (!p_base_path.is_empty()) {
path = p_base_path.path_join(path);
if (!p_state->base_path.is_empty()) {
path = p_state->base_path.path_join(path);
}
path = path.simplify_path();
Vector<uint8_t> data;
Expand Down Expand Up @@ -2018,7 +2018,7 @@ void FBXDocument::_process_mesh_instances(Ref<FBXState> p_state, Node *p_scene_r
}
}

Error FBXDocument::_parse(Ref<FBXState> p_state, const String &p_path, Ref<FileAccess> p_file) {
Error FBXDocument::_parse(Ref<FBXState> p_state, Ref<FileAccess> p_file) {
p_state->scene.reset();

Error err = ERR_INVALID_DATA;
Expand Down Expand Up @@ -2109,7 +2109,7 @@ Error FBXDocument::_parse(Ref<FBXState> p_state, const String &p_path, Ref<FileA
}
}

err = _parse_fbx_state(p_state, p_path);
err = _parse_fbx_state(p_state);
ERR_FAIL_COND_V(err != OK, err);

return OK;
Expand Down Expand Up @@ -2173,7 +2173,7 @@ Error FBXDocument::append_from_buffer(const PackedByteArray &p_bytes, const Stri
file_access.instantiate();
file_access->open_custom(p_bytes.ptr(), p_bytes.size());
state->base_path = p_base_path.get_base_dir();
err = _parse(state, state->base_path, file_access);
err = _parse(state, file_access);
ERR_FAIL_COND_V(err != OK, err);
for (Ref<GLTFDocumentExtension> ext : document_extensions) {
ERR_CONTINUE(ext.is_null());
Expand All @@ -2183,7 +2183,7 @@ Error FBXDocument::append_from_buffer(const PackedByteArray &p_bytes, const Stri
return OK;
}

Error FBXDocument::_parse_fbx_state(Ref<FBXState> p_state, const String &p_search_path) {
Error FBXDocument::_parse_fbx_state(Ref<FBXState> p_state) {
Error err;

// Abort parsing if the scene is not loaded.
Expand All @@ -2199,7 +2199,7 @@ Error FBXDocument::_parse_fbx_state(Ref<FBXState> p_state, const String &p_searc

if (!p_state->discard_meshes_and_materials) {
/* PARSE IMAGES */
err = _parse_images(p_state, p_search_path);
err = _parse_images(p_state);

ERR_FAIL_COND_V(err != OK, ERR_PARSE_ERROR);

Expand Down Expand Up @@ -2263,7 +2263,7 @@ Error FBXDocument::append_from_file(const String &p_path, Ref<GLTFState> p_state
if (p_state == Ref<FBXState>()) {
p_state.instantiate();
}
state->filename = p_path.get_file().get_basename();
state->filename = p_path.get_file();
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;
Expand All @@ -2275,7 +2275,7 @@ Error FBXDocument::append_from_file(const String &p_path, Ref<GLTFState> p_state
base_path = p_path.get_base_dir();
}
state->base_path = base_path;
err = _parse(p_state, base_path, file);
err = _parse(p_state, file);
ERR_FAIL_COND_V(err != OK, err);
for (Ref<GLTFDocumentExtension> ext : document_extensions) {
ERR_CONTINUE(ext.is_null());
Expand Down
6 changes: 3 additions & 3 deletions modules/fbx/fbx_document.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class FBXDocument : public GLTFDocument {
Error _parse_meshes(Ref<FBXState> p_state);
Ref<Image> _parse_image_bytes_into_image(Ref<FBXState> p_state, const Vector<uint8_t> &p_bytes, const String &p_filename, int p_index);
GLTFImageIndex _parse_image_save_image(Ref<FBXState> p_state, const Vector<uint8_t> &p_bytes, const String &p_file_extension, int p_index, Ref<Image> p_image);
Error _parse_images(Ref<FBXState> p_state, const String &p_base_path);
Error _parse_images(Ref<FBXState> p_state);
Error _parse_materials(Ref<FBXState> p_state);
Error _parse_skins(Ref<FBXState> p_state);
Error _parse_animations(Ref<FBXState> p_state);
Expand All @@ -95,11 +95,11 @@ class FBXDocument : public GLTFDocument {
Error _parse_lights(Ref<FBXState> p_state);

public:
Error _parse_fbx_state(Ref<FBXState> p_state, const String &p_search_path);
Error _parse_fbx_state(Ref<FBXState> p_state);
void _process_mesh_instances(Ref<FBXState> p_state, Node *p_scene_root);
void _generate_scene_node(Ref<FBXState> p_state, const GLTFNodeIndex p_node_index, Node *p_scene_parent, Node *p_scene_root);
void _generate_skeleton_bone_node(Ref<FBXState> p_state, const GLTFNodeIndex p_node_index, Node *p_scene_parent, Node *p_scene_root);
void _import_animation(Ref<FBXState> p_state, AnimationPlayer *p_animation_player,
const GLTFAnimationIndex p_index, const bool p_trimming, const bool p_remove_immutable_tracks);
Error _parse(Ref<FBXState> p_state, const String &p_path, Ref<FileAccess> p_file);
Error _parse(Ref<FBXState> p_state, Ref<FileAccess> p_file);
};
Loading