diff options
Diffstat (limited to 'modules/fbx/data/fbx_material.cpp')
-rw-r--r-- | modules/fbx/data/fbx_material.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/fbx/data/fbx_material.cpp b/modules/fbx/data/fbx_material.cpp index d54ac86e9f..fb6c67f7b9 100644 --- a/modules/fbx/data/fbx_material.cpp +++ b/modules/fbx/data/fbx_material.cpp @@ -29,6 +29,10 @@ /*************************************************************************/ #include "fbx_material.h" + +// FIXME: Shouldn't depend on core_bind.h! Use DirAccessRef like the rest of +// the engine instead of _Directory. +#include "core/core_bind.h" #include "scene/resources/material.h" #include "scene/resources/texture.h" #include "tools/validation_tools.h" @@ -160,7 +164,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 +227,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 +260,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 +328,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 +424,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 +432,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))) { |