@@ -2080,79 +2080,83 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da
2080
2080
{
2081
2081
if (domMesh* mesh = daeSafeCast<domMesh>(geo->getDescendant (daeElement::matchType (domMesh::ID ()))))
2082
2082
{
2083
- for (LLModel* model : mModelsMap .find (mesh)->second )
2083
+ dae_model_map::iterator it = mModelsMap .find (mesh);
2084
+ if (it != mModelsMap .end ())
2084
2085
{
2085
- LLMatrix4 transformation = mTransform ;
2086
+ for (LLModel* model : it->second )
2087
+ {
2088
+ LLMatrix4 transformation = mTransform ;
2086
2089
2087
- if (mTransform .determinant () < 0 )
2088
- { // negative scales are not supported
2089
- LL_INFOS () << " Negative scale detected, unsupported transform. domInstance_geometry: " << getElementLabel (instance_geo) << LL_ENDL;
2090
- LLSD args;
2091
- args[" Message" ] = " NegativeScaleTrans" ;
2092
- args[" LABEL" ] = getElementLabel (instance_geo);
2093
- mWarningsArray .append (args);
2090
+ if (mTransform .determinant () < 0 )
2091
+ { // negative scales are not supported
2092
+ LL_INFOS () << " Negative scale detected, unsupported transform. domInstance_geometry: " << getElementLabel (instance_geo) << LL_ENDL;
2093
+ LLSD args;
2094
+ args[" Message" ] = " NegativeScaleTrans" ;
2095
+ args[" LABEL" ] = getElementLabel (instance_geo);
2096
+ mWarningsArray .append (args);
2094
2097
2095
- badElement = true ;
2096
- }
2098
+ badElement = true ;
2099
+ }
2097
2100
2098
- LLModelLoader::material_map materials = getMaterials (model, instance_geo, dae);
2099
-
2100
- // adjust the transformation to compensate for mesh normalization
2101
- LLVector3 mesh_scale_vector;
2102
- LLVector3 mesh_translation_vector;
2103
- model->getNormalizedScaleTranslation (mesh_scale_vector, mesh_translation_vector);
2104
-
2105
- LLMatrix4 mesh_translation;
2106
- mesh_translation.setTranslation (mesh_translation_vector);
2107
- mesh_translation *= transformation;
2108
- transformation = mesh_translation;
2109
-
2110
- LLMatrix4 mesh_scale;
2111
- mesh_scale.initScale (mesh_scale_vector);
2112
- mesh_scale *= transformation;
2113
- transformation = mesh_scale;
2114
-
2115
- if (transformation.determinant () < 0 )
2116
- { // negative scales are not supported
2117
- LL_INFOS () << " Negative scale detected, unsupported post-normalization transform. domInstance_geometry: " << getElementLabel (instance_geo) << LL_ENDL;
2118
- LLSD args;
2119
- args[" Message" ] = " NegativeScaleNormTrans" ;
2120
- args[" LABEL" ] = getElementLabel (instance_geo);
2121
- mWarningsArray .append (args);
2122
- badElement = true ;
2123
- }
2101
+ LLModelLoader::material_map materials = getMaterials (model, instance_geo, dae);
2102
+
2103
+ // adjust the transformation to compensate for mesh normalization
2104
+ LLVector3 mesh_scale_vector;
2105
+ LLVector3 mesh_translation_vector;
2106
+ model->getNormalizedScaleTranslation (mesh_scale_vector, mesh_translation_vector);
2107
+
2108
+ LLMatrix4 mesh_translation;
2109
+ mesh_translation.setTranslation (mesh_translation_vector);
2110
+ mesh_translation *= transformation;
2111
+ transformation = mesh_translation;
2112
+
2113
+ LLMatrix4 mesh_scale;
2114
+ mesh_scale.initScale (mesh_scale_vector);
2115
+ mesh_scale *= transformation;
2116
+ transformation = mesh_scale;
2117
+
2118
+ if (transformation.determinant () < 0 )
2119
+ { // negative scales are not supported
2120
+ LL_INFOS () << " Negative scale detected, unsupported post-normalization transform. domInstance_geometry: " << getElementLabel (instance_geo) << LL_ENDL;
2121
+ LLSD args;
2122
+ args[" Message" ] = " NegativeScaleNormTrans" ;
2123
+ args[" LABEL" ] = getElementLabel (instance_geo);
2124
+ mWarningsArray .append (args);
2125
+ badElement = true ;
2126
+ }
2124
2127
2125
- std::string label;
2128
+ std::string label;
2126
2129
2127
- if (model->mLabel .empty ())
2128
- {
2129
- label = getLodlessLabel (instance_geo);
2130
+ if (model->mLabel .empty ())
2131
+ {
2132
+ label = getLodlessLabel (instance_geo);
2130
2133
2131
- llassert (!label.empty ());
2134
+ llassert (!label.empty ());
2132
2135
2133
- if (model->mSubmodelID )
2134
- {
2135
- label += (char )((int )' a' + model->mSubmodelID );
2136
- }
2136
+ if (model->mSubmodelID )
2137
+ {
2138
+ label += (char )((int )' a' + model->mSubmodelID );
2139
+ }
2137
2140
2138
- model->mLabel = label + lod_suffix[mLod ];
2139
- }
2140
- else
2141
- {
2142
- // Don't change model's name if possible, it will play havoc with scenes that already use said model.
2143
- size_t ext_pos = getSuffixPosition (model->mLabel );
2144
- if (ext_pos != -1 )
2145
- {
2146
- label = model->mLabel .substr (0 , ext_pos);
2141
+ model->mLabel = label + lod_suffix[mLod ];
2147
2142
}
2148
2143
else
2149
2144
{
2150
- label = model->mLabel ;
2145
+ // Don't change model's name if possible, it will play havoc with scenes that already use said model.
2146
+ size_t ext_pos = getSuffixPosition (model->mLabel );
2147
+ if (ext_pos != -1 )
2148
+ {
2149
+ label = model->mLabel .substr (0 , ext_pos);
2150
+ }
2151
+ else
2152
+ {
2153
+ label = model->mLabel ;
2154
+ }
2151
2155
}
2152
- }
2153
2156
2154
- mScene [transformation].push_back (LLModelInstance (model, label, transformation, materials));
2155
- stretch_extents (model, transformation);
2157
+ mScene [transformation].push_back (LLModelInstance (model, label, transformation, materials));
2158
+ stretch_extents (model, transformation);
2159
+ }
2156
2160
}
2157
2161
}
2158
2162
}
0 commit comments