feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -13,7 +13,7 @@ thirdparty_obj = []
thirdparty_dir = "#thirdparty/ufbx/"
thirdparty_sources = [thirdparty_dir + "ufbx.c"]
env_fbx.Prepend(CPPPATH=[thirdparty_dir])
env_fbx.Prepend(CPPEXTPATH=[thirdparty_dir])
env_thirdparty = env_fbx.Clone()
env_thirdparty.disable_warnings()

View file

@ -30,8 +30,6 @@
#include "editor_scene_importer_fbx2gltf.h"
#ifdef TOOLS_ENABLED
#include "core/config/project_settings.h"
#include "editor/editor_settings.h"
#include "editor_scene_importer_ufbx.h"
@ -142,5 +140,3 @@ void EditorSceneFormatImporterFBX2GLTF::handle_compatibility_options(HashMap<Str
p_import_params["fbx/importer"] = EditorSceneFormatImporterUFBX::FBX_IMPORTER_UFBX;
}
}
#endif // TOOLS_ENABLED

View file

@ -28,10 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_SCENE_IMPORTER_FBX2GLTF_H
#define EDITOR_SCENE_IMPORTER_FBX2GLTF_H
#ifdef TOOLS_ENABLED
#pragma once
#include "editor/import/3d/resource_importer_scene.h"
@ -52,7 +49,3 @@ public:
const HashMap<StringName, Variant> &p_options) override;
virtual void handle_compatibility_options(HashMap<StringName, Variant> &p_import_params) const override;
};
#endif // TOOLS_ENABLED
#endif // EDITOR_SCENE_IMPORTER_FBX2GLTF_H

View file

@ -30,8 +30,6 @@
#include "editor_scene_importer_ufbx.h"
#ifdef TOOLS_ENABLED
#include "../fbx_document.h"
#include "editor_scene_importer_fbx2gltf.h"
@ -104,5 +102,3 @@ void EditorSceneFormatImporterUFBX::handle_compatibility_options(HashMap<StringN
p_import_params["fbx/importer"] = EditorSceneFormatImporterUFBX::FBX_IMPORTER_FBX2GLTF;
}
}
#endif // TOOLS_ENABLED

View file

@ -28,10 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_SCENE_IMPORTER_UFBX_H
#define EDITOR_SCENE_IMPORTER_UFBX_H
#ifdef TOOLS_ENABLED
#pragma once
#include "editor/import/3d/resource_importer_scene.h"
@ -56,6 +53,3 @@ public:
const HashMap<StringName, Variant> &p_options) override;
virtual void handle_compatibility_options(HashMap<StringName, Variant> &p_import_params) const override;
};
#endif // TOOLS_ENABLED
#endif // EDITOR_SCENE_IMPORTER_UFBX_H

View file

@ -251,18 +251,16 @@ static bool _thread_pool_init_fn(void *user, ufbx_thread_pool_context ctx, const
return true;
}
static bool _thread_pool_run_fn(void *user, ufbx_thread_pool_context ctx, uint32_t group, uint32_t start_index, uint32_t count) {
static void _thread_pool_run_fn(void *user, ufbx_thread_pool_context ctx, uint32_t group, uint32_t start_index, uint32_t count) {
ThreadPoolFBX *pool = (ThreadPoolFBX *)user;
ThreadPoolFBX::Group &pool_group = pool->groups[group];
pool_group.start_index = start_index;
pool_group.task_id = pool->pool->add_native_group_task(_thread_pool_task, &pool_group, (int)count, -1, true, "ufbx");
return true;
}
static bool _thread_pool_wait_fn(void *user, ufbx_thread_pool_context ctx, uint32_t group, uint32_t max_index) {
static void _thread_pool_wait_fn(void *user, ufbx_thread_pool_context ctx, uint32_t group, uint32_t max_index) {
ThreadPoolFBX *pool = (ThreadPoolFBX *)user;
pool->pool->wait_for_group_task_completion(pool->groups[group].task_id);
return true;
}
String FBXDocument::_gen_unique_name(HashSet<String> &unique_names, const String &p_name) {
@ -1082,7 +1080,7 @@ Error FBXDocument::_parse_images(Ref<FBXState> p_state, const String &p_base_pat
}
// Fallback to loading as byte array.
data = FileAccess::get_file_as_bytes(path);
if (data.size() == 0) {
if (data.is_empty()) {
WARN_PRINT(vformat("FBX: Image index '%d' couldn't be loaded from path: %s because there was no data to load. Skipping it.", texture_i, path));
p_state->images.push_back(Ref<Texture2D>()); // Placeholder to keep count.
p_state->source_images.push_back(Ref<Image>());
@ -1658,8 +1656,7 @@ void FBXDocument::_generate_scene_node(Ref<FBXState> p_state, const GLTFNodeInde
// Add the node we generated and set the owner to the scene root.
p_scene_parent->add_child(current_node, true);
if (current_node != p_scene_root) {
Array args;
args.append(p_scene_root);
Array args = { p_scene_root };
current_node->propagate_call(StringName("set_owner"), args);
}
current_node->set_transform(fbx_node->transform);
@ -1746,8 +1743,7 @@ void FBXDocument::_generate_skeleton_bone_node(Ref<FBXState> p_state, const GLTF
// Add the node we generated and set the owner to the scene root.
p_scene_parent->add_child(current_node, true);
if (current_node != p_scene_root) {
Array args;
args.append(p_scene_root);
Array args = { p_scene_root };
current_node->propagate_call(StringName("set_owner"), args);
}
// Do not set transform here. Transform is already applied to our bone.

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef FBX_DOCUMENT_H
#define FBX_DOCUMENT_H
#pragma once
#include "fbx_state.h"
@ -99,5 +98,3 @@ public:
const GLTFAnimationIndex p_index, const bool p_trimming, const bool p_remove_immutable_tracks);
Error _parse(Ref<FBXState> p_state, String p_path, Ref<FileAccess> p_file);
};
#endif // FBX_DOCUMENT_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef FBX_STATE_H
#define FBX_STATE_H
#pragma once
#include "modules/gltf/gltf_defines.h"
#include "modules/gltf/gltf_state.h"
@ -65,5 +64,3 @@ public:
bool get_allow_geometry_helper_nodes();
void set_allow_geometry_helper_nodes(bool p_allow_geometry_helper_nodes);
};
#endif // FBX_STATE_H

View file

@ -61,10 +61,6 @@ void initialize_fbx_module(ModuleInitializationLevel p_level) {
#ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
// Editor-specific API.
ClassDB::APIType prev_api = ClassDB::get_current_api();
ClassDB::set_current_api(ClassDB::API_EDITOR);
GDREGISTER_CLASS(EditorSceneFormatImporterUFBX);
GLOBAL_DEF_RST_BASIC("filesystem/import/fbx2gltf/enabled", true);
@ -72,7 +68,6 @@ void initialize_fbx_module(ModuleInitializationLevel p_level) {
GLOBAL_DEF_RST("filesystem/import/fbx2gltf/enabled.android", false);
GLOBAL_DEF_RST("filesystem/import/fbx2gltf/enabled.web", false);
ClassDB::set_current_api(prev_api);
EditorNode::add_init_callback(_editor_init);
}
#endif // TOOLS_ENABLED

View file

@ -28,12 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef FBX_REGISTER_TYPES_H
#define FBX_REGISTER_TYPES_H
#pragma once
#include "modules/register_module_types.h"
void initialize_fbx_module(ModuleInitializationLevel p_level);
void uninitialize_fbx_module(ModuleInitializationLevel p_level);
#endif // FBX_REGISTER_TYPES_H