Merge pull request #44621 from fire/update-fbx
Update FBX because of changes in the core api.
This commit is contained in:
commit
1e08647195
3 changed files with 8 additions and 6 deletions
|
@ -115,7 +115,7 @@ struct SurfaceData {
|
||||||
Array morphs;
|
Array morphs;
|
||||||
};
|
};
|
||||||
|
|
||||||
EditorSceneImporterMeshNode *FBXMeshData::create_fbx_mesh(const ImportState &state, const FBXDocParser::MeshGeometry *p_mesh_geometry, const FBXDocParser::Model *model, bool use_compression) {
|
EditorSceneImporterMeshNode3D *FBXMeshData::create_fbx_mesh(const ImportState &state, const FBXDocParser::MeshGeometry *p_mesh_geometry, const FBXDocParser::Model *model, bool use_compression) {
|
||||||
mesh_geometry = p_mesh_geometry;
|
mesh_geometry = p_mesh_geometry;
|
||||||
// todo: make this just use a uint64_t FBX ID this is a copy of our original materials unfortunately.
|
// todo: make this just use a uint64_t FBX ID this is a copy of our original materials unfortunately.
|
||||||
const std::vector<const FBXDocParser::Material *> &material_lookup = model->GetMaterials();
|
const std::vector<const FBXDocParser::Material *> &material_lookup = model->GetMaterials();
|
||||||
|
@ -410,7 +410,7 @@ EditorSceneImporterMeshNode *FBXMeshData::create_fbx_mesh(const ImportState &sta
|
||||||
in_mesh_surface_id += 1;
|
in_mesh_surface_id += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorSceneImporterMeshNode *godot_mesh = memnew(EditorSceneImporterMeshNode);
|
EditorSceneImporterMeshNode3D *godot_mesh = memnew(EditorSceneImporterMeshNode3D);
|
||||||
godot_mesh->set_mesh(mesh);
|
godot_mesh->set_mesh(mesh);
|
||||||
return godot_mesh;
|
return godot_mesh;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include "core/templates/hash_map.h"
|
#include "core/templates/hash_map.h"
|
||||||
#include "editor/import/resource_importer_scene.h"
|
#include "editor/import/resource_importer_scene.h"
|
||||||
|
#include "editor/import/scene_importer_mesh_node_3d.h"
|
||||||
#include "scene/3d/mesh_instance_3d.h"
|
#include "scene/3d/mesh_instance_3d.h"
|
||||||
#include "scene/resources/surface_tool.h"
|
#include "scene/resources/surface_tool.h"
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ struct FBXMeshData : Reference {
|
||||||
// translate fbx mesh data from document context to FBX Mesh Geometry Context
|
// translate fbx mesh data from document context to FBX Mesh Geometry Context
|
||||||
bool valid_weight_indexes = false;
|
bool valid_weight_indexes = false;
|
||||||
|
|
||||||
EditorSceneImporterMeshNode *create_fbx_mesh(const ImportState &state, const FBXDocParser::MeshGeometry *p_mesh_geometry, const FBXDocParser::Model *model, bool use_compression);
|
EditorSceneImporterMeshNode3D *create_fbx_mesh(const ImportState &state, const FBXDocParser::MeshGeometry *p_mesh_geometry, const FBXDocParser::Model *model, bool use_compression);
|
||||||
|
|
||||||
void gen_weight_info(Ref<SurfaceTool> st, int vertex_id) const;
|
void gen_weight_info(Ref<SurfaceTool> st, int vertex_id) const;
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ struct FBXMeshData : Reference {
|
||||||
int max_weight_count = 0;
|
int max_weight_count = 0;
|
||||||
uint64_t armature_id = 0;
|
uint64_t armature_id = 0;
|
||||||
bool valid_armature_id = false;
|
bool valid_armature_id = false;
|
||||||
EditorSceneImporterMeshNode *godot_mesh_instance = nullptr;
|
EditorSceneImporterMeshNode3D *godot_mesh_instance = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void sanitize_vertex_weights(const ImportState &state);
|
void sanitize_vertex_weights(const ImportState &state);
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "editor/editor_log.h"
|
#include "editor/editor_log.h"
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
#include "editor/import/resource_importer_scene.h"
|
#include "editor/import/resource_importer_scene.h"
|
||||||
|
#include "editor/import/scene_importer_mesh_node_3d.h"
|
||||||
#include "scene/3d/bone_attachment_3d.h"
|
#include "scene/3d/bone_attachment_3d.h"
|
||||||
#include "scene/3d/camera_3d.h"
|
#include "scene/3d/camera_3d.h"
|
||||||
#include "scene/3d/light_3d.h"
|
#include "scene/3d/light_3d.h"
|
||||||
|
@ -595,7 +596,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
|
||||||
node_element;
|
node_element;
|
||||||
node_element = node_element->next()) {
|
node_element = node_element->next()) {
|
||||||
Ref<FBXNode> fbx_node = node_element->get();
|
Ref<FBXNode> fbx_node = node_element->get();
|
||||||
EditorSceneImporterMeshNode *mesh_node = nullptr;
|
EditorSceneImporterMeshNode3D *mesh_node = nullptr;
|
||||||
Ref<FBXMeshData> mesh_data_precached;
|
Ref<FBXMeshData> mesh_data_precached;
|
||||||
|
|
||||||
// check for valid geometry
|
// check for valid geometry
|
||||||
|
@ -735,7 +736,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
|
||||||
for (Map<uint64_t, Ref<FBXMeshData>>::Element *mesh_data = state.renderer_mesh_data.front(); mesh_data; mesh_data = mesh_data->next()) {
|
for (Map<uint64_t, Ref<FBXMeshData>>::Element *mesh_data = state.renderer_mesh_data.front(); mesh_data; mesh_data = mesh_data->next()) {
|
||||||
Ref<FBXMeshData> mesh = mesh_data->value();
|
Ref<FBXMeshData> mesh = mesh_data->value();
|
||||||
const uint64_t mesh_id = mesh_data->key();
|
const uint64_t mesh_id = mesh_data->key();
|
||||||
EditorSceneImporterMeshNode *mesh_instance = mesh->godot_mesh_instance;
|
EditorSceneImporterMeshNode3D *mesh_instance = mesh->godot_mesh_instance;
|
||||||
const int mesh_weights = mesh->max_weight_count;
|
const int mesh_weights = mesh->max_weight_count;
|
||||||
Ref<FBXSkeleton> skeleton;
|
Ref<FBXSkeleton> skeleton;
|
||||||
const bool valid_armature = mesh->valid_armature_id;
|
const bool valid_armature = mesh->valid_armature_id;
|
||||||
|
|
Loading…
Reference in a new issue