summaryrefslogtreecommitdiff
path: root/modules/assimp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-10 08:25:31 +0100
committerGitHub <noreply@github.com>2019-12-10 08:25:31 +0100
commit2845e6a21a9a1b7c8bf64dc49575213141a68832 (patch)
treeb4f82b8b4b733aa37dd877a0867a441d67a68d15 /modules/assimp
parent16fc023d4487c2a3f26b5bdd3827628de2cd0ba2 (diff)
parented1c4bc77db88fa0f8f599ca2d3c4b533a94a654 (diff)
Merge pull request #34040 from qarmin/unused_variable_more_precise_numbers
Removed unused variables, add some constants numbers
Diffstat (limited to 'modules/assimp')
-rw-r--r--modules/assimp/editor_scene_importer_assimp.cpp16
-rw-r--r--modules/assimp/import_utils.h8
2 files changed, 6 insertions, 18 deletions
diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp
index 2cb2a71f1e..752b74b9f2 100644
--- a/modules/assimp/editor_scene_importer_assimp.cpp
+++ b/modules/assimp/editor_scene_importer_assimp.cpp
@@ -364,8 +364,6 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
}
} else if (bone != NULL) {
continue;
- } else if (element_assimp_node->mNumMeshes > 0) {
- spatial = memnew(Spatial);
} else {
spatial = memnew(Spatial);
}
@@ -393,16 +391,11 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
ERR_FAIL_COND_V_MSG(parent_node == NULL, state.root,
"Parent node invalid even though lookup successful, out of ram?")
- if (parent_node && spatial != state.root) {
+ if (spatial != state.root) {
parent_node->add_child(spatial);
spatial->set_owner(state.root);
- } else if (spatial == state.root) {
+ } else {
// required - think about it root never has a parent yet is valid, anything else without a parent is not valid.
- } else // Safety for instances
- {
- WARN_PRINT(
- "Failed to find parent node instance after lookup, serious warning report to godot with model");
- memdelete(spatial); // this node is broken
}
} else if (spatial != state.root) {
// if the ainode is not in the tree
@@ -477,11 +470,12 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
for (Map<const aiNode *, Spatial *>::Element *key_value_pair = state.flat_node_map.front(); key_value_pair; key_value_pair = key_value_pair->next()) {
const aiNode *assimp_node = key_value_pair->key();
Spatial *mesh_template = key_value_pair->value();
- Node *parent_node = mesh_template->get_parent();
ERR_CONTINUE(assimp_node == NULL);
ERR_CONTINUE(mesh_template == NULL);
+ Node *parent_node = mesh_template->get_parent();
+
if (mesh_template == state.root) {
continue;
}
@@ -1009,7 +1003,6 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
}
}
- const String mesh_name = AssimpUtils::get_assimp_string(ai_mesh->mName);
aiString mat_name;
if (AI_SUCCESS == ai_material->Get(AI_MATKEY_NAME, mat_name)) {
mat->set_name(AssimpUtils::get_assimp_string(mat_name));
@@ -1495,7 +1488,6 @@ void EditorSceneImporterAssimp::_generate_node(
ERR_FAIL_COND(assimp_node == NULL);
state.nodes.push_back(assimp_node);
- String node_name = AssimpUtils::get_assimp_string(assimp_node->mName);
String parent_name = AssimpUtils::get_assimp_string(assimp_node->mParent->mName);
// please note
diff --git a/modules/assimp/import_utils.h b/modules/assimp/import_utils.h
index 8135b352c6..bf7552e7db 100644
--- a/modules/assimp/import_utils.h
+++ b/modules/assimp/import_utils.h
@@ -309,9 +309,7 @@ public:
if (r_found) {
return;
}
- if (r_found == false) {
- find_texture_path(r_p_path, dir, r_path, r_found, "." + exts[i]);
- }
+ find_texture_path(r_p_path, dir, r_path, r_found, "." + exts[i]);
}
}
@@ -322,9 +320,7 @@ public:
static void set_texture_mapping_mode(aiTextureMapMode *map_mode, Ref<ImageTexture> texture) {
ERR_FAIL_COND(texture.is_null());
ERR_FAIL_COND(map_mode == NULL);
- aiTextureMapMode tex_mode = aiTextureMapMode::aiTextureMapMode_Wrap;
-
- tex_mode = map_mode[0];
+ aiTextureMapMode tex_mode = map_mode[0];
int32_t flags = Texture::FLAGS_DEFAULT;
if (tex_mode == aiTextureMapMode_Wrap) {