| 1181 | } |
| 1182 | |
| 1183 | void ThreeMFLoader::initFilamentColors_() |
| 1184 | { |
| 1185 | if ( filamentInited_ ) |
| 1186 | return; |
| 1187 | filamentInited_ = true; |
| 1188 | const Json::Value* foundProjSettings{ nullptr }; |
| 1189 | for ( const auto& [path, json] : jsonDocuments_ ) |
| 1190 | { |
| 1191 | if ( pathFromUtf8( path ).stem() == "project_settings" ) |
| 1192 | { |
| 1193 | foundProjSettings = &json; |
| 1194 | break; |
| 1195 | } |
| 1196 | } |
| 1197 | if ( !foundProjSettings ) |
| 1198 | return; |
| 1199 | const auto& projSettings = *foundProjSettings; |
| 1200 | if ( !projSettings["filament_colour"].isArray() ) |
| 1201 | return; |
| 1202 | const auto& fColors = projSettings["filament_colour"]; |
| 1203 | filamentColors_.reserve( fColors.size() ); |
| 1204 | for ( int i = 0; i < int( fColors.size() ); ++i ) |
| 1205 | { |
| 1206 | if ( !fColors[i].isString() ) |
| 1207 | continue; |
| 1208 | auto colorRes = parseColor( fColors[i].asString() ); |
| 1209 | if ( !colorRes.has_value() ) |
| 1210 | continue; |
| 1211 | filamentColors_.emplace_back( std::move( *colorRes ) ); |
| 1212 | } |
| 1213 | if ( filamentColors_.size() != fColors.size() ) |
| 1214 | filamentColors_.clear(); |
| 1215 | } |
| 1216 | |
| 1217 | void Node::initDefaultFillament_( ThreeMFLoader& loader ) |
| 1218 | { |
nothing calls this directly
no test coverage detected