MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / makeObjectLinesFromFile

Function makeObjectLinesFromFile

source/MRMesh/MRObjectLoad.cpp:275–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275Expected<ObjectLines> makeObjectLinesFromFile( const std::filesystem::path& file, ProgressCallback callback )
276{
277 MR_TIMER;
278
279 VertColors colors;
280 LinesLoadSettings settings
281 {
282 .colors = &colors,
283 .callback = callback
284 };
285 auto lines = LinesLoad::fromAnySupportedFormat( file, settings );
286 if ( !lines.has_value() )
287 return unexpected( std::move( lines.error() ) );
288
289 const auto numVerts = lines->points.size();
290 const bool hasColors = colors.size() >= numVerts;
291
292 ObjectLines objectLines;
293 objectLines.setName( utf8string( file.stem() ) );
294 objectLines.setPolyline( std::make_shared<Polyline3>( std::move( lines.value() ) ) );
295
296 if ( hasColors )
297 {
298 objectLines.setVertsColorMap( std::move( colors ) );
299 objectLines.setColoringType( ColoringType::VertsColorMap );
300 }
301
302 return objectLines;
303}
304
305Expected<ObjectPoints> makeObjectPointsFromFile( const std::filesystem::path& file, ProgressCallback callback )
306{

Callers 1

loadObjectFromFileFunction · 0.85

Calls 8

utf8stringFunction · 0.85
errorMethod · 0.80
setPolylineMethod · 0.80
setColoringTypeMethod · 0.80
fromAnySupportedFormatFunction · 0.70
unexpectedFunction · 0.70
sizeMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected