diff --git a/indra/newview/vjfloaterlocalmesh.cpp b/indra/newview/vjfloaterlocalmesh.cpp index 697a3842d9..2890280140 100644 --- a/indra/newview/vjfloaterlocalmesh.cpp +++ b/indra/newview/vjfloaterlocalmesh.cpp @@ -461,7 +461,7 @@ void LLFloaterLocalMesh::showLog() LLUUID file_id = scroll_ctrl_selected_column->getValue().asUUID(); auto log = LLLocalMeshSystem::getInstance()->getFileLog(file_id); - for (auto log_string : log) + for (const auto& log_string : log) { mLogPanel->appendText(log_string, true); } @@ -600,7 +600,7 @@ void LLFloaterLocalMesh::reloadLowerUI() if (!selected_file_id.isNull()) { const auto& fileinfo_vector = LLLocalMeshSystem::getInstance()->getFileInfoVector(); - for (auto fileinfo : fileinfo_vector) + for (const auto& fileinfo : fileinfo_vector) { if (selected_file_id == fileinfo.mLocalID) { @@ -672,7 +672,7 @@ void LLFloaterLocalMesh::reloadLowerUI() // and if it is loaded & active, fill object list if (selected_file_active && (!selected_object_list.empty())) { - for (auto object_name : selected_object_list) + for (const auto& object_name : selected_object_list) { objectlist_combo_box->addSimpleElement(object_name); } diff --git a/indra/newview/vjlocalmesh.cpp b/indra/newview/vjlocalmesh.cpp index 656525e0ab..f2f10671ca 100644 --- a/indra/newview/vjlocalmesh.cpp +++ b/indra/newview/vjlocalmesh.cpp @@ -267,7 +267,7 @@ void LLLocalMeshObject::fillVolume(LLLocalMeshFileLOD lod) new_face.allocateWeights(current_submesh->getSkin().size()); for (size_t weight_iter = 0; weight_iter < current_submesh->getSkin().size(); ++weight_iter) { - auto current_local_weight = current_submesh->getSkin()[weight_iter]; + const auto& current_local_weight = current_submesh->getSkin()[weight_iter]; LLVector4 current_v4_weight; for (int joint_iter = 0; joint_iter < 4; ++joint_iter) @@ -434,10 +434,9 @@ void LLLocalMeshFile::reloadLocalMeshObjects(bool initial_load) // clear it first just in case mSavedObjectSculptIDs.clear(); - for (auto& local_object : mLoadedObjectList) + for (const auto& local_object : mLoadedObjectList) { - auto id = local_object->getVolumeParams().getSculptID(); - mSavedObjectSculptIDs.push_back(id); + mSavedObjectSculptIDs.emplace_back(local_object->getVolumeParams().getSculptID()); } } @@ -546,7 +545,7 @@ void LLLocalMeshFile::reloadLocalMeshObjects(bool initial_load) change_happened = true; } - auto importer_log = importer_result.second; + const auto& importer_log = importer_result.second; log.reserve(log.size() + importer_log.size()); log.insert(log.end(), importer_log.begin(), importer_log.end()); break; @@ -708,9 +707,9 @@ void LLLocalMeshFile::updateVObjects() { for (size_t object_iter = 0; object_iter < mSavedObjectSculptIDs.size(); ++object_iter) { - auto local_obj_sculpt_id = mSavedObjectSculptIDs[object_iter]; + const auto& local_obj_sculpt_id = mSavedObjectSculptIDs[object_iter]; auto affected_vobject_ids = gObjectList.findMeshObjectsBySculptID(local_obj_sculpt_id); - for (auto current_vobject_id : affected_vobject_ids) + for (const auto& current_vobject_id : affected_vobject_ids) { auto target_object_ptr = static_cast(gObjectList.findObject(current_vobject_id)); diff --git a/indra/newview/vjlocalmeshimportdae.cpp b/indra/newview/vjlocalmeshimportdae.cpp index 8661496df9..8671db5d03 100644 --- a/indra/newview/vjlocalmeshimportdae.cpp +++ b/indra/newview/vjlocalmeshimportdae.cpp @@ -541,7 +541,7 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll extra_names.insert(extra_names.end(), more_extra_names.begin(), more_extra_names.end()); // add the extras to jointmap - for (auto extra_name : extra_names) + for (const auto& extra_name : extra_names) { joint_map[extra_name] = extra_name; } @@ -657,7 +657,7 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll auto name_source = current_source->getName_array(); if (name_source) { - auto list_of_names = name_source->getValue(); + const auto& list_of_names = name_source->getValue(); for (size_t joint_name_iter = 0; joint_name_iter < list_of_names.getCount(); ++joint_name_iter) { std::string current_name = list_of_names.get(joint_name_iter); @@ -674,7 +674,7 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll continue; } - auto list_of_names = id_source->getValue(); + const auto& list_of_names = id_source->getValue(); for (size_t joint_name_iter = 0; joint_name_iter < list_of_names.getCount(); ++joint_name_iter) { std::string current_name = list_of_names.get(joint_name_iter).getID(); @@ -729,7 +729,7 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll } LLMatrix4 newinverse = LLMatrix4(skininfop->mInvBindMatrix[jointname_number_iter].getF32ptr()); - auto joint_translation = joint_transforms[name_lookup].getTranslation(); + const auto& joint_translation = joint_transforms[name_lookup].getTranslation(); newinverse.setTranslation(joint_translation); skininfop->mAlternateBindMatrix.push_back( LLMatrix4a(newinverse) ); } @@ -755,7 +755,7 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll } std::vector transformed_positions; - auto vertex_input_array = raw_vertex_array->getInput_array(); + const auto& vertex_input_array = raw_vertex_array->getInput_array(); for (size_t vertex_input_iterator = 0; vertex_input_iterator < vertex_input_array.getCount(); ++vertex_input_iterator) { @@ -820,7 +820,7 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll return false; } - auto weight_inputs = current_weights->getInput_array(); + const auto& weight_inputs = current_weights->getInput_array(); domFloat_array* vertex_weights = nullptr; for (size_t weight_input_iter = 0; weight_input_iter < weight_inputs.getCount(); ++weight_input_iter) @@ -923,18 +923,18 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll }; auto& faces = current_object->getFaces(mLod); - for (auto& current_face : faces) + for (const auto& current_face : faces) { - auto& positions = current_face->getPositions(); + const auto& positions = current_face->getPositions(); auto& weights = current_face->getSkin(); - for (auto& current_position : positions) + for (const auto& current_position : positions) { int found_iterator = -1; for (size_t internal_position_iter = 0; internal_position_iter < transformed_positions.size(); ++internal_position_iter) { - auto& internal_position = transformed_positions[internal_position_iter]; + const auto& internal_position = transformed_positions[internal_position_iter]; if (soft_compare(current_position, internal_position, F_ALMOST_ZERO)) { found_iterator = internal_position_iter; @@ -947,9 +947,9 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll continue; } - auto cjoints = skinweight_data[transformed_positions[found_iterator]]; + const auto& cjoints = skinweight_data[transformed_positions[found_iterator]]; - LLLocalMeshFace::LLLocalMeshSkinUnit new_wght; + LLLocalMeshFace::LLLocalMeshSkinUnit new_wght{}; // first init all joints to -1, in case below we get less than 4 influences. for (size_t tjidx = 0; tjidx < 4; ++tjidx) @@ -966,13 +966,13 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll */ for (size_t jidx = 0; jidx < cjoints.size(); ++jidx) { - auto cjoint = cjoints[jidx]; + const auto& cjoint = cjoints[jidx]; new_wght.mJointIndices[jidx] = cjoint.mJointIdx; new_wght.mJointWeights[jidx] = llclamp((F32)cjoint.mWeight, 0.f, 0.999f); } - weights.push_back(new_wght); + weights.emplace_back(new_wght); } } skininfop->updateHash(); @@ -1019,8 +1019,7 @@ void LLLocalMeshImportDAE::processSkeletonJoint(domNode* current_node, std::map< if (!current_transformation) // no queries worked { daeSIDResolver jointResolver_matrix(current_node, "./matrix"); - auto joint_transform_matrix = daeSafeCast(jointResolver_matrix.getElement()); - if (joint_transform_matrix) + if (auto joint_transform_matrix = daeSafeCast(jointResolver_matrix.getElement()); joint_transform_matrix) { LLMatrix4 workingTransform; domFloat4x4 domArray = joint_transform_matrix->getValue(); @@ -1332,7 +1331,7 @@ bool LLLocalMeshImportDAE::readMesh_Triangle(LLLocalMeshFace* data_out, const do { // compare to check if you find one with matching normal and uv values size_t seeker_index = std::distance(repeat_map_position_iterable.begin(), seeker_position); - for (auto repeat_vtx_data : repeat_map_data[seeker_index]) + for (const auto& repeat_vtx_data : repeat_map_data[seeker_index]) { if (repeat_vtx_data.vtx_normal_data != attr_normal) { @@ -1563,7 +1562,7 @@ bool LLLocalMeshImportDAE::readMesh_Polylist(LLLocalMeshFace* data_out, const do { // compare to check if you find one with matching normal and uv values int seeker_index = std::distance(repeat_map_position_iterable.begin(), seeker_position); - for (auto repeat_vtx_data : repeat_map_data[seeker_index]) + for (const auto& repeat_vtx_data : repeat_map_data[seeker_index]) { if (repeat_vtx_data.vtx_normal_data != attr_normal) {