summaryrefslogtreecommitdiff
path: root/modules/fbx
diff options
context:
space:
mode:
Diffstat (limited to 'modules/fbx')
-rw-r--r--modules/fbx/data/fbx_material.cpp12
-rw-r--r--modules/fbx/data/fbx_mesh_data.cpp6
-rw-r--r--modules/fbx/editor_scene_importer_fbx.cpp26
-rw-r--r--modules/fbx/fbx_parser/FBXParser.cpp2
-rw-r--r--modules/fbx/register_types.cpp2
-rw-r--r--modules/fbx/tools/import_utils.h10
-rw-r--r--modules/fbx/tools/validation_tools.h3
7 files changed, 30 insertions, 31 deletions
diff --git a/modules/fbx/data/fbx_material.cpp b/modules/fbx/data/fbx_material.cpp
index d54ac86e9f..cf5d70fa5b 100644
--- a/modules/fbx/data/fbx_material.cpp
+++ b/modules/fbx/data/fbx_material.cpp
@@ -160,7 +160,7 @@ Ref<StandardMaterial3D> FBXMaterial::import_material(ImportState &state) {
const String p_fbx_current_directory = state.path;
Ref<StandardMaterial3D> spatial_material;
- spatial_material.instance();
+ spatial_material.instantiate();
// read the material file
// is material two sided
@@ -223,7 +223,7 @@ Ref<StandardMaterial3D> FBXMaterial::import_material(ImportState &state) {
} else if (fbx_texture_data != nullptr && fbx_texture_data->Media() != nullptr && fbx_texture_data->Media()->IsEmbedded()) {
// This is an embedded texture. Extract it.
Ref<Image> image;
- //image.instance(); // oooo double instance bug? why make Image::_png_blah call
+ //image.instantiate(); // oooo double instance bug? why make Image::_png_blah call
const String extension = texture_name.get_extension().to_upper();
if (extension == "PNG") {
@@ -256,7 +256,7 @@ Ref<StandardMaterial3D> FBXMaterial::import_material(ImportState &state) {
}
Ref<ImageTexture> image_texture;
- image_texture.instance();
+ image_texture.instantiate();
image_texture->create_from_image(image);
texture = image_texture;
@@ -324,7 +324,7 @@ Ref<StandardMaterial3D> FBXMaterial::import_material(ImportState &state) {
if (spatial_material.is_null()) {
// Done here so if no data no material is created.
- spatial_material.instance();
+ spatial_material.instantiate();
}
const FBXDocParser::TypedProperty<real_t> *real_value = dynamic_cast<const FBXDocParser::TypedProperty<real_t> *>(prop);
@@ -420,7 +420,7 @@ Ref<StandardMaterial3D> FBXMaterial::import_material(ImportState &state) {
} break;
case PROPERTY_DESC_COAT_ROUGHNESS: {
// meaning is that approx equal to zero is disabled not actually zero. ;)
- if (real_value && Math::is_equal_approx(real_value->Value(), 0.0f)) {
+ if (real_value && Math::is_zero_approx(real_value->Value())) {
print_verbose("clearcoat real value: " + rtos(real_value->Value()));
spatial_material->set_clearcoat_gloss(1.0 - real_value->Value());
} else {
@@ -428,7 +428,7 @@ Ref<StandardMaterial3D> FBXMaterial::import_material(ImportState &state) {
}
} break;
case PROPERTY_DESC_EMISSIVE: {
- if (real_value && Math::is_equal_approx(real_value->Value(), 0.0f)) {
+ if (real_value && Math::is_zero_approx(real_value->Value())) {
print_verbose("Emissive real value: " + rtos(real_value->Value()));
spatial_material->set_emission_energy(real_value->Value());
} else if (vector_value && !vector_value->Value().is_equal_approx(Vector3(0, 0, 0))) {
diff --git a/modules/fbx/data/fbx_mesh_data.cpp b/modules/fbx/data/fbx_mesh_data.cpp
index 8f32c523f9..0d33b8e7c6 100644
--- a/modules/fbx/data/fbx_mesh_data.cpp
+++ b/modules/fbx/data/fbx_mesh_data.cpp
@@ -211,7 +211,7 @@ EditorSceneImporterMeshNode3D *FBXMeshData::create_fbx_mesh(const ImportState &s
const int surface_id = polygon_surfaces[*polygon_id];
if (surfaces.has(surface_id) == false) {
SurfaceData sd;
- sd.surface_tool.instance();
+ sd.surface_tool.instantiate();
sd.surface_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
if (surface_id < 0) {
@@ -316,7 +316,7 @@ EditorSceneImporterMeshNode3D *FBXMeshData::create_fbx_mesh(const ImportState &s
Vector3 *normals_ptr = morph_data->normals.ptrw();
Ref<SurfaceTool> morph_st;
- morph_st.instance();
+ morph_st.instantiate();
morph_st->begin(Mesh::PRIMITIVE_TRIANGLES);
for (unsigned int vi = 0; vi < surface->vertices_map.size(); vi += 1) {
@@ -345,7 +345,7 @@ EditorSceneImporterMeshNode3D *FBXMeshData::create_fbx_mesh(const ImportState &s
// Phase 6. Compose the mesh and return it.
Ref<EditorSceneImporterMesh> mesh;
- mesh.instance();
+ mesh.instantiate();
// Add blend shape info.
for (const String *morph_name = morphs.next(nullptr); morph_name != nullptr; morph_name = morphs.next(morph_name)) {
diff --git a/modules/fbx/editor_scene_importer_fbx.cpp b/modules/fbx/editor_scene_importer_fbx.cpp
index 40deaae74d..e3f36ef3e3 100644
--- a/modules/fbx/editor_scene_importer_fbx.cpp
+++ b/modules/fbx/editor_scene_importer_fbx.cpp
@@ -373,7 +373,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
scene_root->add_child(state.root);
state.root->set_owner(scene_root);
- state.fbx_root_node.instance();
+ state.fbx_root_node.instantiate();
state.fbx_root_node->godot_node = state.root;
// Size relative to cm.
@@ -389,11 +389,11 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
// Enabled by default.
state.enable_animation_import = true;
Ref<FBXNode> root_node;
- root_node.instance();
+ root_node.instantiate();
// make sure fake noFBXDocParser::PropertyPtr ptrde always has a transform too ;)
Ref<PivotTransform> pivot_transform;
- pivot_transform.instance();
+ pivot_transform.instantiate();
root_node->pivot_transform = pivot_transform;
root_node->node_name = "root node";
root_node->current_node_id = 0;
@@ -479,7 +479,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
if (state.renderer_mesh_data.has(mesh_id)) {
mesh_vertex_data = state.renderer_mesh_data[mesh_id];
} else {
- mesh_vertex_data.instance();
+ mesh_vertex_data.instantiate();
state.renderer_mesh_data.insert(mesh_id, mesh_vertex_data);
}
@@ -535,7 +535,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
ERR_CONTINUE_MSG(!mat, "Could not convert fbx material by id: " + itos(material_id));
Ref<FBXMaterial> material;
- material.instance();
+ material.instantiate();
material->set_imported_material(mat);
Ref<StandardMaterial3D> godot_material = material->import_material(state);
@@ -575,7 +575,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
if (state.skeleton_map.has(armature_id)) {
fbx_skeleton_inst = state.skeleton_map[armature_id];
} else {
- fbx_skeleton_inst.instance();
+ fbx_skeleton_inst.instantiate();
state.skeleton_map.insert(armature_id, fbx_skeleton_inst);
}
@@ -650,7 +650,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
if (state.renderer_mesh_data.has(mesh_id)) {
mesh_data_precached = state.renderer_mesh_data[mesh_id];
} else {
- mesh_data_precached.instance();
+ mesh_data_precached.instantiate();
state.renderer_mesh_data.insert(mesh_id, mesh_data_precached);
}
@@ -735,7 +735,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
Ref<Skin> skin;
if (!state.MeshSkins.has(mesh_id)) {
print_verbose("Created new skin");
- skin.instance();
+ skin.instantiate();
state.MeshSkins.insert(mesh_id, skin);
} else {
print_verbose("Grabbed skin");
@@ -848,7 +848,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
}
Ref<Animation> animation;
- animation.instance();
+ animation.instantiate();
animation->set_name(animation_name);
animation->set_length(duration);
@@ -1312,7 +1312,7 @@ void EditorSceneImporterFBX::BuildDocumentBones(Ref<FBXBone> p_parent_bone,
// declare our bone element reference (invalid, unless we create a bone in this step)
// this lets us pass valid armature information into children objects and this is why we moved this up here
- // previously this was created .instanced() on the same line.
+ // previously this was created .instantiated() on the same line.
Ref<FBXBone> bone_element;
if (model != nullptr) {
@@ -1324,7 +1324,7 @@ void EditorSceneImporterFBX::BuildDocumentBones(Ref<FBXBone> p_parent_bone,
ERR_FAIL_COND_MSG(state.fbx_bone_map.has(limb_node->ID()), "[serious] duplicate LimbNode detected");
bool parent_is_bone = state.fbx_bone_map.find(p_id);
- bone_element.instance();
+ bone_element.instantiate();
// used to build the bone hierarchy in the skeleton
bone_element->parent_bone_id = parent_is_bone ? p_id : 0;
@@ -1404,12 +1404,12 @@ void EditorSceneImporterFBX::BuildDocumentNodes(
uint64_t current_node_id = model->ID();
Ref<FBXNode> new_node;
- new_node.instance();
+ new_node.instantiate();
new_node->current_node_id = current_node_id;
new_node->node_name = ImportUtils::FBXNodeToName(model->Name());
Ref<PivotTransform> fbx_transform;
- fbx_transform.instance();
+ fbx_transform.instantiate();
fbx_transform->set_parent(parent_transform);
fbx_transform->set_model(model);
fbx_transform->debug_pivot_xform("name: " + new_node->node_name);
diff --git a/modules/fbx/fbx_parser/FBXParser.cpp b/modules/fbx/fbx_parser/FBXParser.cpp
index 163518d18f..a92b23f4ee 100644
--- a/modules/fbx/fbx_parser/FBXParser.cpp
+++ b/modules/fbx/fbx_parser/FBXParser.cpp
@@ -1167,7 +1167,7 @@ Transform3D ReadMatrix(const ElementPtr element) {
// clean values to prevent any IBM damage on inverse() / affine_inverse()
for (float &value : values) {
- if (::Math::is_equal_approx(0, value)) {
+ if (::Math::is_zero_approx(value)) {
value = 0;
}
}
diff --git a/modules/fbx/register_types.cpp b/modules/fbx/register_types.cpp
index c0591dbc77..b615c91cd2 100644
--- a/modules/fbx/register_types.cpp
+++ b/modules/fbx/register_types.cpp
@@ -36,7 +36,7 @@
#ifdef TOOLS_ENABLED
static void _editor_init() {
Ref<EditorSceneImporterFBX> import_fbx;
- import_fbx.instance();
+ import_fbx.instantiate();
ResourceImporterScene::get_singleton()->add_importer(import_fbx);
}
#endif
diff --git a/modules/fbx/tools/import_utils.h b/modules/fbx/tools/import_utils.h
index 7625f67256..fbe7dbd82f 100644
--- a/modules/fbx/tools/import_utils.h
+++ b/modules/fbx/tools/import_utils.h
@@ -137,15 +137,15 @@ public:
static Vector3 safe_import_vector3(const Vector3 &p_vec) {
Vector3 vector = p_vec;
- if (Math::is_equal_approx(0, vector.x)) {
+ if (Math::is_zero_approx(vector.x)) {
vector.x = 0;
}
- if (Math::is_equal_approx(0, vector.y)) {
+ if (Math::is_zero_approx(vector.y)) {
vector.y = 0;
}
- if (Math::is_equal_approx(0, vector.z)) {
+ if (Math::is_zero_approx(vector.z)) {
vector.z = 0;
}
return vector;
@@ -317,7 +317,7 @@ public:
// }
// } else {
// Ref<Image> img;
- // img.instance();
+ // img.instantiate();
// PoolByteArray arr;
// uint32_t size = tex->mWidth * tex->mHeight;
// arr.resize(size);
@@ -362,7 +362,7 @@ public:
// if (found) {
// image_state.raw_image = AssimpUtils::load_image(state, state.assimp_scene, path);
// if (image_state.raw_image.is_valid()) {
- // image_state.texture.instance();
+ // image_state.texture.instantiate();
// image_state.texture->create_from_image(image_state.raw_image);
// image_state.texture->set_storage(ImageTexture::STORAGE_COMPRESS_LOSSY);
// return true;
diff --git a/modules/fbx/tools/validation_tools.h b/modules/fbx/tools/validation_tools.h
index 6c15eb7e12..906a721045 100644
--- a/modules/fbx/tools/validation_tools.h
+++ b/modules/fbx/tools/validation_tools.h
@@ -34,8 +34,7 @@
#ifdef TOOLS_ENABLED
#include "core/io/file_access.h"
-#include "core/io/json.h"
-#include "core/string/ustring.h"
+#include "core/string/print_string.h"
#include "core/templates/local_vector.h"
#include "core/templates/map.h"